summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:31 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:13:31 +0000
commit3caf8614f25d6b1962e20331fdf423c863bc02f3 (patch)
tree069fa30b63dd4804846385d8571928bdaa7b73ad /sca-java-1.x/branches
parent6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches')
-rw-r--r--sca-java-1.x/branches/sca-java-integration/buildtools/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/buildtools/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/buildtools/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-checkstyle.xml295
-rw-r--r--sca-java-1.x/branches/sca-java-integration/buildtools/src/main/resources/tuscany-suppressions.xml32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/pom.xml81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/pom/parent/pom.xml199
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/LICENSE.txt416
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/NOTICE.txt32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/LICENSE.txt416
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/NOTICE.txt32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/pom.xml178
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java279
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java400
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java465
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerDataServiceImpl.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerService.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/accountlogger/AccountLoggerServiceImpl.java216
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java228
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java153
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/DasAccountConfiguration.xml79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/LICENSE.txt416
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/AccountService.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/default.scdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/main/webapp/WEB-INF/web.xml70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/Show.Image.html40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.pngbin0 -> 15889 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.pngbin0 -> 33300 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.pngbin0 -> 6074 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.pngbin0 -> 17123 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.pngbin0 -> 10748 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/pom.xml36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/readme.html894
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/LICENSE.txt416
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/NOTICE.txt32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/pom.xml167
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountLogTag.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockLogTag.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java101
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java161
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt416
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl466
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/CustomerProfile.jsp100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld127
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/default.scdl53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/WEB-INF/web.xml83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountLog.jsp99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/accountTransaction.jsp50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/login.html60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/purchaseStock.jsp59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/stockSale.jsp56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/main/webapp/summary.jsp144
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/readme.html103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/Calculator.composite52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/pom.xml79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/CompositeClient.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Source.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/SourceImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/Target.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/java/composite/TargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite.composite44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/InnerComposite2.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/main/resources/OuterComposite.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/composite-impl/src/test/java/composite/CompositeTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBinding.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBindingLoader.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoBuilder.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoInvoker.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoReference.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/java/echo/EchoService.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/main/resources/META-INF/sca/extension.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Client.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/ClientImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/Echo.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/java/echo/EchoBindingTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-binding/src/test/resources/EchoBinding.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/pom.xml104
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBinding.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBindingLoader.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoBuilder.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoInvoker.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoReference.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/java/echo/EchoService.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/main/resources/META-INF/sca/extension.composite31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentAImpl.java94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/ComponentBImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Echo.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/EchoDataBindingTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface1.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/java/echo/Interface2.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/EchoDataBinding.composite61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/echo-databinding/src/test/resources/wsdl/echo.wsdl45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplication.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClient.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanClientImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/main/resources/loanapplication.composite31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/pom.xml86
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountReport.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountService.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/Account.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/BigBank.composite44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClient.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyClientImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyService.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/MyServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/main/resources/simplecallback.composite31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/readme.htm89
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/run.bat7
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Customer.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/main/resources/supplychain.composite42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/pom.xml49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/default.scdl26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/WEB-INF/web.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/samples/sca/webapp/src/main/webapp/calc.jsp43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/pom.xml146
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/assembly/axis2.xml38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java94
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java331
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderRuntimeException.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingRunTimeException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java72
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java194
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java114
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java390
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java211
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java186
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java79
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java210
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java244
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java44
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java491
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java377
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/binding.axis2.scdl48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/default.scdl49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/META-INF/sca/extension.composite22
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml306
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java229
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java111
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java153
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Greeter.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/GreetingCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/WebServicebindingLoaderTestCase.java187
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/resources/wsdl/hello_world_doc_lit.wsdl151
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/.ruleset172
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/pom.xml78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandler.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/AxiomHelper.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2Object.java40
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2String.java62
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElement2XMLStreamReader.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/OMElementWrapperHandler.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/Object2OMElement.java55
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java60
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/databinding.axiom.scdl57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/default.scdl56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/AxiomExceptionHandlerTestCase.java107
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/java/org/apache/tuscany/databinding/axiom/OMElementTestCase.java103
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xml33
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/ipo.xsd118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/databinding/src/test/resources/order.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/pom.xml89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/OldStyleService.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/old-style/src/test/java/org/apache/tuscany/sca/itest/OldStyleTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/pom.xml41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/pom.xml89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/client.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-explicit-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceExplicitURITestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/pom.xml89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/client.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/service-relative-uri/src/test/java/org/apache/tuscany/sca/itest/ServiceRelativeURITestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/pom.xml89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/client.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/simplest/src/test/java/org/apache/tuscany/sca/itest/SimplestTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/pom.xml90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/client.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/service.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/HelloWorldServer.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/itests/wsdl-binidng/src/test/java/org/apache/tuscany/sca/itest/WsdlElementBindingTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/LICENSE.txt1407
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java153
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/pom.xml39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/LICENSE.txt1407
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/plugins/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/pom.xml181
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/readme.html103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/resources/calculator.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/default.scdl35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/WEB-INF/web.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/calc.jsp43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/calculator-ws/src/main/webapp/index.html5
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/.ruleset172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/readme.htm66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/setup.bat16
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/java/helloworld/HelloWorldService.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/resources/wsdl/helloworld.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/sca/default.scdl48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/META-INF/tuscany/webapp.scdl149
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-ws/src/main/webapp/WEB-INF/web.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/pom.xml80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run.bat53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/run_celtix.bat16
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldClient.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldLocal.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldService.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/META-INF/sca/default.scdl46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/logging.properties29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/main/resources/wsdl/helloworld.wsdl152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-async-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/pom.xml94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/readme.htm48
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/setup.bat16
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldServer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/java/helloworld/om/HelloWorldService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/helloworldws-om.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/main/resources/wsdl/helloworld-om.wsdl78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-ws/src/test/java/helloworld/om/HelloWorldServerTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/pom.xml95
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/run.bat53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldClient.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/java/helloworld/om/HelloWorldServiceComponent.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/helloworldwsclient-om.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/logging.properties27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/main/resources/wsdl/helloworld-om.wsdl78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldClientTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-om-wsclient/src/test/java/helloworld/om/HelloWorldServerTest.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/pom.xml136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/java/greeter/GreeterService.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/resources/wsdl/greeter.wsdl64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/sca/default.scdl40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/binding.axis2.scdl44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.axiom.scdl51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/interface.wsdl.scdl44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/META-INF/tuscany/webapp.scdl148
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-ws/src/main/webapp/WEB-INF/web.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/pom.xml96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterClient.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterLocal.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/java/greeter/GreeterService.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/META-INF/sca/default.scdl42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/main/resources/wsdl/greeter.wsdl64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/java/greeter/GreeterWSOneWayClient.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-oneway-wsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/pom.xml83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldServer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/helloworldws.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/system.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-ws/src/test/java/helloworld/HelloWorldServerTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/pom.xml87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldClient.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/helloworldwsclient.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/logging.properties30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldClientTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/helloworld-wsclient/src/test/java/helloworld/HelloWorldServerTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/pom.xml85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanApplication.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/java/loanappconversation/LoanServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/resources/wsdl/loanappconversation.wsdl271
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/default.scdl41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-ws/src/main/webapp/WEB-INF/web.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/pom.xml85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanAppConversationClient.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanApplication.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClient.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanClientImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/java/loanappconversation/LoanService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/META-INF/sca/default.scdl40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/main/resources/wsdl/loanappconversation.wsdl271
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/loanapplication-wsclient/src/test/java/loanappconversation/LoanAppConversationTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/samples/pom.xml121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/pom.xml164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java435
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java239
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java524
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java521
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java410
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java225
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java373
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java143
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java222
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java230
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java349
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/AccountService.wsdl242
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/helloworld.wsdl121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/test/resources/sequences.xsd100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/pom.xml131
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/pom.xml164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java435
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java239
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java524
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java521
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java410
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java225
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java373
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java143
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java222
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java230
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java357
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/AccountService.wsdl242
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/helloworld.wsdl121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/test/resources/sequences.xsd100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/pom.xml91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/DefaultOperationAndDataBinding.java162
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java177
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingDefinition.java274
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java199
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSProxy.java131
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSReferenceBinding.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSResourceFactory.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSServiceBinding.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/JMSTargetInvoker.java119
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/OperationAndDataBinding.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/SimpleJMSResourceFactory.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/AbstractJmsTransformer.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Input2JmsInputTransformer.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsInput2InputTransformer.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/JmsOutput2OutputTransformer.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/java/org/apache/tuscany/binding/jms/databinding/Output2JmsOutputTransformer.java71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/binding.jms.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/default.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingService.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/GreetingServiceImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldService.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/HelloworldServiceImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroService.java23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/IntroServiceImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSBindingTestCaseX.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/JMSProxyTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/java/org/apache/tuscany/binding/jms/databinding/JmsTransformerTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/META-INF/sca/default.scdl61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/binding/src/test/resources/wsdl/helloworld.wsdl130
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/main/resources/META-INF/sca/default.scdl36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsReference/src/test/java/helloworld/HelloWorldJmsClient.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/main/resources/META-INF/sca/default.scdl36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/helloworld.jmsService/src/test/java/helloworld/HelloWorldJmsServer.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jms/samples/pom.xml97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilder.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingDefinition.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoader.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServlet.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceBinding.java94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServlet.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmd.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/binding.jsonrpc.scdl42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/default.scdl43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/main/resources/org/apache/tuscany/binding/jsonrpc/jsonrpc.js484
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingBuilderTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingLoaderTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCBindingTestCase.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCEntryPointServletTestCase.java186
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/JSONRPCServiceTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/ScriptGetterServletTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/TestInterface.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/binding/src/test/java/org/apache/tuscany/binding/jsonrpc/util/JavaToSmdTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/build.xml81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/pom.xml116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/HelloWorldJSONRPC.html136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/default.scdl32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/WEB-INF/web.xml50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/helloworld/src/main/webapp/style.css4
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/jsonrpc/samples/pom.xml96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/pom.xml159
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/.ruleset190
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/pom.xml96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentTypeLoader.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementation.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationJavaScriptLoader.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationLoader.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationPythonLoader.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptImplementationRubyLoader.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstance.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java151
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptTargetInvoker.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/default.scdl40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/resources/META-INF/sca/script.system.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentBuilderTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeLoaderTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptComponentTypeTestCase.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderLoadingTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationLoaderTestCase.java133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptImplementationTestCase.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/ScriptInvokerTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.componentType9
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/foo.mock1
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType9
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock1
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/pom.xml124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2OMElement.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XWrapperHandler.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/OMElement2E4X.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/databinding.e4x.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/default.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/pom.xml138
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/CalculatorService.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/calculator/DivideService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/helloworld.composite40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/xml.composite44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.py56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.rb48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.py65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.rb39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/sample.calculator.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.groovy22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.js22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.py19
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.py19
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py19
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.js23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.js29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.js27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/calculator/CalculatorClientTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/HelloWorldClientTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/JavaScriptPropertiesTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PythonPropertiesTestCase.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/RubyPropertiesTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/XMLTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/extensions/script/pom.xml40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/pom.xml42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/SCARuntime.java251
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyException.java164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/TuscanyRuntimeException.java168
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/DataType.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/IDLMapping.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Monitor.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/main/java/org/apache/tuscany/api/annotation/Resource.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyExceptionTestCase.java164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/api/src/test/java/org/apache/tuscany/api/TuscanyRuntimeExceptionTestCase.java142
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.checkstyle6
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.pmd2
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/pom.xml96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingBuilder.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingDefinition.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalBindingLoader.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalReferenceBinding.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalServiceBinding.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/Bootstrapper.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java262
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultSCARuntime.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java293
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java627
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IllegalCallbackException.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/IncompatibleInterfacesException.java93
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidTargetTypeException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoCompatibleBindingsException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoConversationalContractException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoRegisteredBuilderException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/TargetServiceNotFoundException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WireConnectException.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WiringExceptionFormatter.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ScopeIdentifier.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java211
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractEvent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/AbstractRequestEvent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeEvent.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStart.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/CompositeStop.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationEnd.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationStart.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/ConversationalEvent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestEnded.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpRequestStart.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEnd.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionEvent.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/HttpSessionStart.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEnd.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestEvent.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/event/RequestStart.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java158
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java189
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactory.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainer.java217
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ConversationalScopeObjectFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeObjectFactory.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapper.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeObjectFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactory.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingInteceptor.java250
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java157
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataTypeLoader.java67
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DirectedGraph.java357
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Exception2ExceptionTransformer.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Group2GroupTransformer.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/GroupDataBinding.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Input2InputTransformer.java201
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/MediatorImpl.java185
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/Output2OutputTransformer.java186
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptor.java131
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java188
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PipedTransformer.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/SimpleDataBinding.java61
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformationContextImpl.java83
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImpl.java101
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformer.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/Java2XMLMapperException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformer.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLStreamReader.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2XMLTransformer.java226
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/JavaBeansDataBinding.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaBeanTransformer.java300
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/javabeans/XML2JavaMapperException.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/BeanUtil.java196
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMDataBinding.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMWrapperHandler.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DelegatingNamespaceContext.java310
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2Node.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputSource2SAX.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2Node.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/InputStream2SAX.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValueArrayStreamReader.java403
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NameValuePairStreamReader.java347
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NamedProperty.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/NilElementStreamReader.java279
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2OutputStream.java66
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2String.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2Writer.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Node2XMLStreamReader.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2Node.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Reader2SAX.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOM.java244
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/SAX2DOMPipe.java67
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Source2ResultTransformer.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAX2SAXAdapter.java256
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXDataBinding.java52
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXHelper.java85
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StreamDataPipe.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2Node.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2SAX.java59
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2XMLStreamReader.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/WrappingXMLStreamReader.java230
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Writer2ReaderDataPipe.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLDocumentStreamReader.java432
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReader.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReaderImpl.java857
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLGroupDataBinding.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2Node.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2SAX.java73
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2String.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamSerializer.java266
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamable.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java176
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java109
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/IllegalCallbackException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/InterfaceJavaLoader.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java169
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/IntrospectionRegistryImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java282
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java232
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java151
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java426
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/Dependency.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoader.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemCompositeBuilder.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java208
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java144
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessor.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AmbiguousConstructorException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessor.java112
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java140
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java142
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DestroyProcessor.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateConstructorException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateDestructorException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateInitException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateReferenceException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateResourceException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessor.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessor.java550
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalCallbackReferenceException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalContextException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalDestructorException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalInitException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalReferenceException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalResourceException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalServiceDefinitionException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java469
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InitProcessor.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidAutowireException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConstructorException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConversationalImplementation.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidPropertyException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidReferenceException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidResourceException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidServiceType.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/MonitorProcessor.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/NoConstructorException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/PropertyProcessor.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java184
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ScopeProcessor.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceProcessor.java156
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceTypeNotFoundException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/UnknownContextTypeException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java184
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoader.java101
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemCompositeComponentTypeLoader.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoader.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ArrayMultiplicityObjectFactory.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/Injector.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidResourceTypeException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIListObjectFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ListMultiplicityObjectFactory.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java123
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceNotFoundException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceObjectFactory.java146
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonListObjectFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/CompositeContextImpl.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LaunchException.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java250
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherRuntimeInfo.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java524
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DefaultPropertyValueLoaderException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DependencyLoader.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/JNDIPropertyFactory.java71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java185
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ManyPropertyValueLoaderException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/MissingTypePropertyLoaderException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java196
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java170
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoaderException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java196
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java205
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/WireLoader.java112
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java321
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java167
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyEngineImpl.java297
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyHelper.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyHelper.java235
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyObjectFactoryImpl.java147
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimpleMultivaluedPropertyObjectFactory.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java283
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntime.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeImpl.java140
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfo.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfoImpl.java184
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/artifact/LocalMavenRepository.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ArtifactResolverRegistryImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java156
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionLoader.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryImpl.java275
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java232
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/DomainUpdateException.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidContributionMetadataException.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidDocumentException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessor.java102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java139
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidComponentDefinitionlException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidFolderContributionURIException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java146
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/MetadataContributionProcessor.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/resolver/ComponentDefinitionArtifactResolver.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/extension/AbstractExtensionDeployer.java122
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistry.java142
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java198
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jca/JcaWorkScheduler.java206
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkScheduler.java217
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkEvent.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkItem.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManager.java220
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/test/SCATestCaseRunner.java213
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java93
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java704
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java184
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java439
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java167
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/LoopBackWire.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java177
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java176
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptor.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java323
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java146
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java137
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandler.java173
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java249
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/META-INF/tuscany/default-system.composite163
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/composite.scdl45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/databinding.scdl183
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/formatters.scdl43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/implementation.scdl78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/loader.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java127
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/BootstrapperTestCase.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java306
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AtomicConnectorTestCase.java125
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java219
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java322
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java104
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java168
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java236
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardNonBlockingCallbackConnectionTestCase.java172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardSyncCallbackConnectionTestCase.java171
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java184
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ReferenceConnectorTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ServiceConnectorTestCase.java172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/SynchronousForwardCallbackConnectionTestCase.java256
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/WorkContextImplTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java127
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java128
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInstanceLifecycleTestCase.java186
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactoryTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeRestartTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java181
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeInstanceLifecycleTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeRestartTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java170
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInitDestroyErrorTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java105
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/MockFactory.java137
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInitDestroyErrorTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInstanceLifecycleTestCase.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeRestartTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ScopeRegistryTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeContainerTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactoryTestCase.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java212
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingInterceptorTestCase.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingLoaderTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImplTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorOptimizationTestCase.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java231
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DirectedGraphTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/IDLTransformerTestCase.java217
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/MediatorImplTestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptorTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java266
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImplTestCase.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformerTestCase.java187
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformerTestCase.java127
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/JavaBean2XMLStreamReaderTestCase.java133
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/Node2StringTestCase.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/StAXHelperTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/TraxTransformerTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java168
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/ConversationalIntrospectionTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/IntrospectionRegistryTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/PojoAtomicComponentTestCase.java159
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/TestUtils.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireResolutionTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireTestCase.java230
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java215
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplSystemWireTestCase.java170
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java179
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentResolutionTestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLifecycleTestCase.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java232
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositePropagationTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java105
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoaderTestCase.java194
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/JavaObjectRegistrationTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemComponentBuilderTestCase.java180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponentTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentMetadataInjectionTestCase.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentNegativeMetadataTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java137
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderConversationIDTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderMetadataTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderReferenceTestCase.java149
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderResourceTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoaderTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java153
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerBasicInvocationTestCase.java188
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerMediationTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerNonBlockingInvocationTestCase.java229
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerSequenceTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerStatelessDestroyTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/MultiplicityTestCase.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/ResourceInjectionTestCase.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java395
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java233
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessorTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java154
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorExtensibilityTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorTestCase.java185
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorPropertyTestCase.java168
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorResourceTestCase.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java197
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConversationProcessorTestCase.java151
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConvertTimeMillisTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/DestroyProcessorTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessorTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicAndPropertyTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicConstructorTestCase.java330
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessorTestCase.java395
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceUniqueTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/InitProcessorTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java204
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java225
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java128
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentWireInvocationTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoaderTestCase.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/FieldInjectorTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/JNDIObjectFactoryTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodEventInvokerTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodInjectorTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/PojoObjectFactoryTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/RequestContextObjectFactoryTestCase.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ResourceObjectFactoryTestCase.java152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java140
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java131
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java278
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/scope/ScopeReferenceTestCase.java781
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/DifferentInterfaceWireTestCase.java137
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/oneway/OneWayWireToJavaInvocationTestCase.java130
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.java201
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java170
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java178
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/DependencyLoaderTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/IncludeLoaderTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/LoaderExceptionFormatterTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/MultivaluePropertyLoadingTestCase.java204
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PolicySetLoaderTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyLoaderTestCase.java180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.java143
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryImplTestCase.java131
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/WireLoaderTestCase.java159
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java153
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/PolicyEngineImplTestCase.java140
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/SimplePropertyObjectFactoryTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/artifact/LocalMavenRepositoryTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java107
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImplTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionLoaderTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryTestCase.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessorTestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessorTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistryTestCase.java147
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java164
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTest.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManagerTestCase.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean1.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean2.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/SuperBean.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java401
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptorTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundWireTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptorTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java138
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java154
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java333
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerSerializationTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java162
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java176
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/order.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/xml/foo.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/property/ipo.xml33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext0
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/pom.xml50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/AbstractRuntimeInfo.java125
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/MonitorFactory.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/RuntimeInfo.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java105
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContentTypes.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/DeploymentException.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/UnsupportedContentTypeException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/launcher/Launcher.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/management/ManagementService.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/ExceptionFormatter.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/FormatterRegistry.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHost.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostAdmin.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostRuntimeException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/InitializationException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/ShutdownException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java115
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/servlet/ServletRequestInjector.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostExceptionTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostRuntimeExceptionTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/pom.xml181
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.checkstyle9
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.pmd2
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/doc/Context Model.emx673
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java86
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderInstantiationException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/GenericBuilder.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ScopeNotFoundException.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java134
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java126
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentException.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java156
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidAutowireInterface.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PersistenceException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PrepareException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAExternalizable.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainerMonitor.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetDestructionException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInitializationException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetResolutionException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.java70
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/ExceptionHandler.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.java44
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.java72
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.java46
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.java49
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java166
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java392
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java940
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolver.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolverRegistry.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandler.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandlerRegistry.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentType.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentTypeDescriber.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessor.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessorRegistry.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionRepository.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/AbstractEventPublisher.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ArtifactResolverExtension.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java225
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java564
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ContributionProcessorExtension.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ExecutionMonitor.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/GenericBuilderExtension.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java90
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHost.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHostRegistry.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceResolutionException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidConversationalOperationException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ServiceFaultException.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/XMLType.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java104
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java205
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java128
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java121
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Resource.java138
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidConfigurationException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidServiceException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidWireException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingReferenceException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingSideFileException.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityViolationException.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedReferenceException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedComponentTypeException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/MarshalException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java137
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java188
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java197
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Contribution.java113
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ContributionImport.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java249
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DeployedArtifact.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Intent.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java140
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java413
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachable.java21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachableModel.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java99
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java132
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java134
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java279
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java163
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtension.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtension.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolutionException.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java197
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/AbstractDiscoveryService.java149
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryService.java75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/RequestListener.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/ResponseListener.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/management/TuscanyManagementService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/DuplicateRecordException.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/RecoveryListener.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/Store.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreException.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreExpirationEvent.java71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreMonitor.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreReadException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreWriteException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/SCAObjectInputStream.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java401
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java104
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundChainHolder.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessor.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorExtension.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorRegistry.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java157
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java128
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.java74
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/event/AbstractEventPublisherTestCase.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java148
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java302
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java332
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java94
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java178
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java176
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/CompositeComponentTypeTestCase.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java16
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/OperationTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtensionTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSCAExternalizable.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSerializable.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/SCAObjectInputStreamTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/stax/StaxUtilTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/OutboundChainHolderTestCase.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/resources/test.scdl34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/pom.xml335
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/.ruleset172
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/pom.xml148
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXB2Node.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBContextHelper.java192
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBDataBinding.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandler.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java123
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessor.java107
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Node2JAXB.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Reader2JAXB.java70
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/XMLStreamReader2JAXB.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/databinding.jaxb.scdl49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/default.scdl49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java127
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java77
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java158
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java44
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/resources/ipo.xsd118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/.ruleset172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java272
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java174
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/resources/ipo.xsd118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.checkstyle6
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.ruleset172
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/pom.xml138
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElement.java89
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObjectSerializer.java408
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/SDODataSource.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElement.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/databinding.sdo-axiom.scdl39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElementTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/MockTransformationContext.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/SDOTransformerTestCaseBase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElementTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/ipo.xsd118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/stock.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.checkstyle6
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.ruleset172
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/pom.xml119
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java61
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java70
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDO.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOBuilder.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java163
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOContextHelper.java111
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java122
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandler.java123
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOHelperContext.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java99
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java62
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java66
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java67
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java82
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandlerTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandlerTestCase.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl34
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/ipo.xsd118
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd233
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/stock.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xml9
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/.ruleset172
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/pom.xml97
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java35
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java56
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java52
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite22
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java99
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsd118
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsdconfig21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/databinding/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/pom.xml61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java146
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLContributionException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessor.java263
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java214
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java525
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java129
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessor.java136
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/extension.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessorTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java91
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java115
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java105
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessorTestCase.java92
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/invalid-stockquote.wsdl40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd118
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.wsdl45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.xsd15
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test2.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/pom.xml63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyLogger.java106
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyService.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java356
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/http.jetty.scdl35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/service.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/test/java/org/apache/tuscany/service/jetty/JettyServiceImplTestCase.java220
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/LICENSE.txt203
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/pom.xml102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/CancelTimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/StopTimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/Timer.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerManager.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/RemoteWorkItem.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/Work.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkCompletedException.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkEvent.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkException.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkItem.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkListener.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkManager.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkRejectedException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/pom.xml49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/pom.xml102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CompositeContext.java93
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ConversationEndedException.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CurrentCompositeContext.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/RequestContext.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceReference.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceRuntimeException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceUnavailableException.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/Version.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Callback.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ComponentName.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Constructor.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Context.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Conversation.java51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ConversationID.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Destroy.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EagerInit.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EndConversation.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Init.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/OneWay.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Property.java54
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Reference.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Remotable.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Resource.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Scope.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Service.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-sca.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-webservice.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-core.xsd233
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-implementation-java.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-java.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-wsdl.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca.xsd34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/pom.xml87
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java109
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/pom.xml52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/sca/default.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl185
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java155
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/sca/default.scdl38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl155
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/pom.xml60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/sca/test.scdl31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/binding.axis2.scdl39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.axiom.scdl52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.sdo.scdl60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/interface.wsdl.scdl55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/test-extensions.scdl29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl142
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/pom.xml41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/pom.xml33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/pom.xml109
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/META-INF/sca/default.scdl42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml51
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/t.bat16
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/IntegrationTestHelp.html1293
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml10
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java341
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite49
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java157
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/pom.xml42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java134
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java142
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/CallBackCTypeClient.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType8
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java45
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java145
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/resources/CallBackIdClient.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java193
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/resources/CallBackSetCallbackTest.composite40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java175
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java58
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java60
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/resources/CallBackSetCallbackConvTest.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/pom.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java18
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java12
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java11
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java466
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java20
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java134
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/resources/ConversationsTest.composite48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/pom.xml120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java130
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm116
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/generate.xsd61
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/pom.xml.vm181
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/wsdl/Dummy.wsdl4
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd59
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Interop.xsd133
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xsd35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Person.xsd30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd46
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/datagraph.xsd88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd221
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/pom.xml200
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm119
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/generate.xml100
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm104
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/pom.xml152
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClient.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClientImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/greeterws.composite67
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/wsdl/Greeter.wsdl88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/xsd/Person.xsd30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/test/java/org/apache/tuscany/sca/itest/JaxbDatabindingTestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/pom.xml188
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml113
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/greeter.composite68
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/pom.xml47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/pom.xml148
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClient.java34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClientImpl.java47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/greetersdo.composite70
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/wsdl/Greeter.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/xsd/Person.xsd30
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/test/java/org/apache/tuscany/sca/itest/SdoDatabindingTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/pom.xml183
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/generate.xml114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm75
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/.ruleset172
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/NOTICE.txt14
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/pom.xml221
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java119
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java249
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Client.java26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Echo.java42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/DataBindingTest.composite34
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xml33
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsd118
-rwxr-xr-xsca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsdconfig21
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/pom.xml189
-rw-r--r--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.java33
-rw-r--r--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.java76
-rw-r--r--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.java37
-rw-r--r--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.java122
-rw-r--r--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.java84
-rw-r--r--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.java76
-rw-r--r--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.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/ExceptionTest.composite26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite42
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/pom.xml161
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java37
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java122
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java76
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java50
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/ExceptionTest.composite26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/pom.xml32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java31
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java56
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java120
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/ExceptionTest.composite26
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/NOTICE.txt14
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/pom.xml43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java105
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptor.java114
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptorWirePostProcessor.java122
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/META-INF/sca/application.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptor.scdl27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/pom.xml135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/pom.xml34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java69
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java72
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite197
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt1
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt6
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java186
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/pom.xml34
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java27
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java29
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java23
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java122
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite48
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite81
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite62
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite55
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite51
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java191
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java84
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java96
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/pom.xml135
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java95
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite402
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite412
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType10
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType10
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType10
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType10
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4a.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4b.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4a.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4b.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java149
-rw-r--r--sca-java-1.x/branches/sca-java-integration/testing/sca/pom.xml165
2575 files changed, 243770 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <artifactId>buildtools</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Build Tools</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <description>Module containing build tools for Apache Tuscany. This contains things such as the configuration for checkstyle and PMD.</description>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+</project>
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 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+Checks to make sure the code meets the Tuscany coding guidelines
+http://java.sun.com/docs/codeconv/index.html
+
+It also enforces aa bunch of other "BestPractices like method
+lengths, if/try depths, etc...
+
+-->
+
+<module name="Checker">
+
+
+ <property name="severity"
+ value="${checkstyle.severity}"
+ default="warning"/>
+
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!--<module name="StrictDuplicateCode"/>-->
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <!--
+ <module name="PackageHtml"/>
+ <module name="JavadocMethod"/>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <!--<module name="AbstractClassName">
+ <property name="format"
+ value="^Abstract.*$|^.*Factory$|^.*Extension$|^.*Exception$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/>
+ </module>-->
+ <module name="ConstantName"/>
+ <!--<module name="LocalFinalVariableName"/>-->
+ <module name="LocalVariableName"/>
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+ <!-- Header checks -->
+ <!-- <module name="Header"/> -->
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport">
+ <property name="excludes"
+ value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/>
+ </module>
+ <!--<module name="IllegalImport">
+ <property name="illegalPkgs" value="org.apache.tuscany.core"/>
+ </module>-->
+ <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <!--<module name="ImportOrder">
+ <property name="groups" value="java,javax,org.w3c,org.xml,w3c,org.osoa"/>
+ <property name="ordered" value="true"/>
+ </module>-->
+ <!--
+ <module name="ImportControl">
+ <property name="file" value="etc/import-control.xml"/>
+ </module>
+ -->
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="AnonInnerLength">
+ <property name="max" value="40"/>
+ </module>
+ <module name="ExecutableStatementCount">
+ <property name="max" value="100"/>
+ </module>
+ <module name="FileLength"/>
+ <module name="LineLength">
+ <property name="max" value="120"/>
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="150"/>
+ <property name="countEmpty" value="false"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="10"/>
+ </module>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="EmptyForInitializerPad"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter">
+ <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+ </module>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="TabCharacter"/>
+ <module name="WhitespaceAfter">
+ <property name="tokens" value="COMMA, SEMI"/>
+ </module>
+ <module name="WhitespaceAround">
+ <property name="tokens"
+ value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/>
+ </module>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true"/>
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!--<module name="ArrayTrailingComma"/>-->
+ <!--<module name="AvoidInlineConditionals"/>-->
+ <module name="CovariantEquals"/>
+ <module name="DoubleCheckedLocking"/>
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <!--<module name="FinalLocalVariable"/>-->
+ <!--<module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true"/>
+ <property name="ignoreSetter" value="true"/>
+ <property name="ignoreAbstractMethods" value="true"/>
+ </module>-->
+ <module name="IllegalInstantiation"/>
+ <!--<module name="IllegalToken"/>-->
+ <!--<module name="IllegalTokenText"/>-->
+ <!--<module name="InnerAssignment"/>-->
+ <!--<module name="MagicNumber"/>-->
+ <!--<module name="MissingSwitchDefault"/>-->
+ <module name="ModifiedControlVariable"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="StringLiteralEquality"/>
+ <module name="NestedIfDepth">
+ <property name="max" value="3"/>
+ </module>
+ <module name="NestedTryDepth">
+ <property name="max" value="3"/>
+ </module>
+ <module name="SuperClone"/>
+ <module name="SuperFinalize"/>
+ <!--<module name="IllegalCatch"/>-->
+ <module name="IllegalThrows">
+ <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/>
+ </module>
+ <!--<module name="RedundantThrows"/>-->
+ <module name="PackageDeclaration"/>
+ <module name="JUnitTestCase"/>
+ <!--<module name="ReturnCount">
+ <property name="max" value="6"/>
+ </module>-->
+
+ <module name="IllegalType">
+ <property name="illegalClassNames" value="java.util.Hashtable, java.util.HashSet, java.util.HashMap, java.util.ArrayList, java.util.LinkedHashMap, java.util.LinkedHashSet, java.util.TreeSet, java.util.TreeMap, java.util.Vector"/>
+ <property name="format" value="^xxx$"/>
+ </module>
+ <module name="DeclarationOrder"/>
+ <!--<module name="ParameterAssignment"/>-->
+ <module name="ExplicitInitialization"/>
+ <module name="DefaultComesLast"/>
+ <!--<module name="MissingCtor"/>-->
+ <module name="FallThrough"/>
+ <!--<module name="MultipleStringLiterals"/>-->
+ <module name="MultipleVariableDeclarations"/>
+ <!--<module name="RequireThis"/>-->
+ <module name="UnnecessaryParentheses"/>
+
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--<module name="DesignForExtension"/>-->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <!--<module name="MutableException"/>-->
+ <module name="ThrowsCount">
+ <property name="max" value="5"/>
+ </module>
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true"/>
+ <property name="packageAllowed" value="true"/>
+ </module>
+
+
+ <!-- Metrics checks. -->
+ <!-- See http://checkstyle.sf.net/config_metrics.html -->
+ <module name="BooleanExpressionComplexity">
+ <property name="max" value="6"/>
+ </module>
+ <!--<module name="ClassDataAbstractionCoupling"/>-->
+ <!--<module name="ClassFanOutComplexity"/>-->
+ <!--<module name="CyclomaticComplexity"/>-->
+ <!--<module name="NPathComplexity"/>-->
+ <module name="JavaNCSS">
+ <property name="methodMaximum" value="120"/>
+ </module>
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ -->
+ <!--
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <module name="TodoComment">
+ <property name="format" value="WARNING"/>
+ </module>
+
+ <module name="UpperEll"/>
+
+ <!--Assert statement may have side effects:-->
+ <module name="DescendantToken">
+ <property name="tokens" value="LITERAL_ASSERT"/>
+ <property name="limitedTokens"
+ value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/>
+ <property name="maximumNumber" value="0"/>
+ </module>
+
+ <!--<module name="UncommentedMain"/>-->
+ <!-- <module name="TrailingComment"/>-->
+ <module name="Indentation">
+ <property name="caseIndent" value="4"/>
+ </module>
+ <!--<module name="RequiredRegexp">-->
+ </module>
+
+</module>
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 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+
+<suppressions>
+ <suppress checks="VisibilityModifier"
+ files="^.*TestCase$.java|BasicInterfaceImpl.java|Bean1.java|SuperBean.java"
+ />
+ <suppress checks="ParameterNumber"
+ files="MockFactory.java"
+ />
+
+</suppressions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>tuscany-project</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Project</name>
+ <url>http://incubator.apache.org/tuscany/</url>
+ <description>
+ Tuscany is an open source project implementing a Service Component Architecture.
+ </description>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+
+ <profiles>
+ <!-- default profile -->
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>pom/parent</module>
+ <module>buildtools</module>
+ <module>spec</module>
+ <module>sca</module>
+ <module>testing/sca</module>
+ <module>samples/sca</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>pom/parent</module>
+ <module>buildtools</module>
+ <module>spec</module>
+ <module>sca</module>
+ <module>testing/sca</module>
+ <module>samples/sca</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>pom/parent</module>
+ <module>buildtools</module>
+ <module>spec</module>
+ <module>sca</module>
+ <module>testing/sca</module>
+ <module>samples/sca</module>
+ </modules>
+ </profile>
+
+ </profiles>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>3</version>
+ </parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Project Parent</name>
+ <description>Parent POM defining settings that can be used across Tuscany</description>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+
+ <prerequisites>
+ <maven>2.0.4</maven>
+ </prerequisites>
+
+ <properties>
+ <notice.dir>.</notice.dir>
+ </properties>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/tuscany/java</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/tuscany/java</developerConnection>
+ <url>http://svn.apache.org/viewvc/incubator/tuscany/java</url>
+ </scm>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/TUSCANY</url>
+ </issueManagement>
+
+ <repositories>
+ <!-- needed for Apache webServices artifacts -->
+ <repository>
+ <id>apache.ws.m1.snapshots</id>
+ <name>Apache Web Services M1 Snapshot Repository</name>
+ <url>http://ws.zones.apache.org/repository</url>
+ <layout>legacy</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <!-- needed for OSGi plugin -->
+ <pluginRepository>
+ <id>apache.snapshots</id>
+ <name>Apache SNAPSHOT Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ <!-- used for Plexus plugins -->
+ <pluginRepository>
+ <id>codehaus-snapshot</id>
+ <name>Codehaus Snapshot Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ <!-- used for SDO plugins -->
+ <pluginRepository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ </pluginRepositories>
+
+ <distributionManagement>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ <snapshotRepository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>${notice.dir}</directory>
+ <targetPath>META-INF</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <!-- this is kind of a hack for eclipse. Eclipse doesn't like "." as a resource directory as then you have
+ source directories inside a source directory which causes all kinds of errors. We'll just point
+ the resources directory back to the resources directory. The NOTICE and LICSENSE files
+ won't be included in the eclipse builds, but it at least works.
+ -->
+ <id>eclipse</id>
+ <properties>
+ <notice.dir>src/main/resources</notice.dir>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>sourcecheck</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked,deprecation,fallthrough,finally</compilerArgument>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.bigbank</groupId>
+ <artifactId>bigbank-scenario</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-bigbank-account</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany BigBank Account Module</name>
+ <description>BigBank Scenario - Account Management Module</description>
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- java.xml.stream API -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- StAX implementation -->
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.das</groupId>
+ <artifactId>tuscany-das-rdb</artifactId>
+ <version>${dasVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <!-- schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile -->
+ <schemaDir>${basedir}/src/main/resources/wsdl</schemaDir>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/main/resources/wsdl/stockquotes.webservicex.wsdl</fileName>
+ <ports>
+ <port>StockQuoteSoap</port>
+ </ports>
+ </wsdlFile>
+ <wsdlFile>
+ <fileName>${basedir}/src/main/resources/wsdl/AccountService.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- Set to true to embed external jars for extensions in the WAR -->
+ <!-- Set to false to leave external jars for extensions to be resolved from maven repository -->
+ <loadExtensionDependencies>false</loadExtensionDependencies>
+
+ <extensions>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ </extensions>
+
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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<AccountSummary> 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<StockSummary> stocks = accountReport.getStockSummaries();
+ if (stocks.size() < 1) {
+ return accountReport; // nothing todo
+ }
+ HashSet<String> owned = new HashSet<String>(stocks.size());
+ for (StockSummary stock : stocks) {
+ owned.add(stock.getSymbol());
+ }
+ ArrayList<String> ownedStr = new ArrayList<String>(owned.size() * 5);
+ for (String s : owned) {
+
+ ownedStr.add(s);
+ }
+
+ Map<String, StockQuote> 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<String, StockQuote> 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("<center><h2>BigBank database initialization servlet !<h2></center>");
+ 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;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @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<String, StockQuote> stocks = new Hashtable<String, StockQuote>();
+
+ public synchronized Map getQuotes(String[] symbols) throws RemoteException {
+ Map<String, StockQuote> ret = new Hashtable<String, StockQuote>();
+ 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<StockQuote> listQuotes = new ArrayList<StockQuote>();
+ Hashtable<String, StockQuote> listQuoteHT = new Hashtable<String, StockQuote>();
+ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd" dataObjectModel="http://www.bigbank.com/account">
+
+ <Table tableName="CUSTOMERS" typeName="CustomerProfileData">
+ <!-- Column name="firstName" primaryKey="true"/ -->
+ <Column columnName="FIRSTNAME"/>
+ <Column columnName="LASTNAME"/>
+ <Column columnName="ADDRESS"/>
+ <Column columnName="EMAIL"/>
+ <Column columnName="LOGINID"/>
+ <Column columnName="PASSWORD"/>
+ <Column columnName="ID"/>
+ </Table>
+
+ <Table tableName="ACCOUNTS" typeName="AccountSummary">
+ <!-- Column name="firstName" primaryKey="true"/ -->
+ <Column columnName="ACCOUNTNUMBER"/>
+ <Column columnName="BALANCE"/>
+ </Table>
+
+
+
+ <Table tableName="STOCKS" typeName="StockSummary" >
+ <Column columnName="ID" propertyName="id"/>
+ <Column columnName="Symbol" propertyName="symbol"/>
+ <Column columnName="quantity" propertyName="quantity"/>
+ <Column columnName="purchasePrice" propertyName="purchasePrice"/>
+ <Column columnName="PURCHASEDATE" propertyName="purchaseDate" converterClassName="bigbank.account.services.accountdata.AccountDataServiceDASImpl$DateConverter"/>
+ </Table>
+
+
+ <Table tableName="ACCTLOG" typeName="AccountLogEntry">
+ <Column columnName="logSeqNo"/>
+ <Column columnName="ID"/>
+ <Column columnName="ACCOUNTNUMBER"/>
+ <Column columnName="ACTIONTYPE"/>
+ <Column columnName="AMOUNT"/>
+ </Table>
+
+
+
+ <Table tableName="STOCKLOG" typeName="StockLogEntry" >
+ <Column columnName="logSeqNo"/>
+ <Column columnName="ID"/>
+ <Column columnName="Symbol"/>
+ <Column columnName="quantity"/>
+ <Column columnName="actionType"/>
+ <Column columnName="purchaseLotNumber"/>
+ </Table>
+
+
+ <Command name="get account" SQL="SELECT accountNumber, accountType, balance FROM accounts where accountNumber = ?" kind="Select" />
+ <Command name="update balance" SQL="update ACCOUNTS set BALANCE = ? where ACCOUNTNUMBER = ?" kind="Update" />
+
+ <Command name="all customers" SQL="select * from CUSTOMERS" kind="Select"/>
+
+ <Command name="all stocks" SQL="select symbol, quantity, purchaseprice, purchasedate from stocks" kind="Select"/>
+ <Command name="stockbylotSelect" SQL="select quantity from STOCKS WHERE purchaseLotNumber = ?" kind="Select" />
+ <Command name="stockbylot" SQL="update STOCKS set quantity = ? WHERE purchaseLotNumber = ?" kind="Update" />
+
+</Config>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.webserviceX.NET/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.webserviceX.NET/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified"
+ targetNamespace="http://www.webserviceX.NET/" >
+ <!--
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="net.x.webservice"
+ -->
+
+
+ >
+ <s:element name="GetQuote">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuoteResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="string" nillable="true" type="s:string"/>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetQuoteSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuote"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuoteResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetIn">
+ <wsdl:part name="symbol" type="s:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetOut">
+ <wsdl:part name="Body" element="tns:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostIn">
+ <wsdl:part name="symbol" type="s:string"/>
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostOut">
+ <wsdl:part name="Body" element="tns:string"/>
+ </wsdl:message>
+ <wsdl:portType name="StockQuoteSoap">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteSoapIn"/>
+ <wsdl:output message="tns:GetQuoteSoapOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpGet">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpGetIn"/>
+ <wsdl:output message="tns:GetQuoteHttpGetOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpPost">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpPostIn"/>
+ <wsdl:output message="tns:GetQuoteHttpPostOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="GetQuote">
+ <soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet">
+ <http:binding verb="GET"/>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote"/>
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuote">
+ <wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap">
+ <soap:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet">
+ <http:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost">
+ <http:address location="http://www.webservicex.com/stockquote.asmx"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="bigbank.account">
+
+
+ <service name="AccountService">
+ <!-- interface.java interface="com.bigbank.account.AccountService"/-->
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+
+
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+
+ <reference>AccountServiceComponent</reference>
+ </service>
+
+
+ <property name="currency" type="xsd:string">USD</property>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.services.account.AccountServiceImpl" />
+ <property name="currency" source="$currency" />
+ <reference name="accountDataService">AccountLoggerDataServiceComponent</reference>
+ <reference name="stockQuoteService">StockQuoteServiceComponent</reference>
+ </component>
+
+ <component name="AccountLoggerDataServiceComponent">
+ <implementation.java class="bigbank.account.services.accountlogger.AccountLoggerDataServiceImpl" />
+ <reference name="accountDataService">AccountDataServiceComponent</reference>
+ <reference name="accountLoggerService">AccountLoggerServiceComponent</reference>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceDASImpl" />
+ </component>
+
+ <component name="AccountLoggerServiceComponent">
+ <implementation.java class="bigbank.account.services.accountlogger.AccountLoggerServiceImpl" />
+ </component>
+
+ <!-- by default, we use the faked stock quote implemented as a POJO component -->
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.account.services.stockquote.StockQuoteServiceImpl" />
+ </component>
+
+ <!-- Please uncomment the following to get the real stock quote -->
+ <!--
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.account.services.stockquote.StockQuoteWebservicexServiceImpl" />
+ <reference name="stockQuoteService">StockQuoteWebService</reference>
+ </component>
+
+ <reference name="StockQuoteWebService">
+ <interface.wsdl interface="http://www.webserviceX.NET/#wsdl.interface(StockQuoteSoap)"
+ wsdli:wsdlLocation="http://www.webserviceX.NET/ wsdl/stockquotes.webservicex.wsdl" />
+ <binding.ws endpoint="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)"
+ location="wsdl/stockquotes.webservicex.wsdl" />
+ </reference>
+ -->
+
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Tuscany Bigbank Account sample</display-name>
+
+ <!-- context-param>
+ <param-name>tuscany.systemScdlPath</param-name>
+ <param-value>/META-INF/tuscany/webapp.scdl</param-value>
+ </context-param -->
+
+ <!-- context-param>
+ <param-name>tuscany.applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param -->
+
+ <context-param>
+ <param-name>tuscany.online</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+
+ </servlet-mapping>
+ <servlet>
+ <!-- Initialize bigbank database -->
+ <servlet-name>AccountDBInit</servlet-name>
+ <servlet-class>bigbank.account.services.accountdb.AccountDBInit</servlet-class>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+ <!-- servlet-mapping>
+ <servlet-name>AccountDBInit</servlet-name>
+ <url-pattern>/AccountDBInit</url-pattern>
+ </servlet-mapping -->
+
+
+</web-app>
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 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+ <head>
+ <style type="text/css">
+ #image {
+ text-align:center;
+ }
+ #close {
+ text-align:center;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="image">
+ <script language="javascript">
+ var search = document.location.search;
+ var url = search.substring(5,search.length);
+ document.write("<img src='" + url + "' alt='" + url + "'/>");
+ </script>
+ </div>
+ <div id="close"><a href="javascript:window.close()">Close Window</a></div>
+ </body>
+</html>
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
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountfiles.png
Binary files 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
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/accountmodule.png
Binary files 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
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/modualoverview.png
Binary files 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
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientfiles.png
Binary files 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
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/samples/sca/bigbank/docs/webclientmodule.png
Binary files 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sampleapps</groupId>
+ <artifactId>tuscany-sampleapps</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.samples.bigbank</groupId>
+ <artifactId>bigbank-scenario</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany BigBank Scenario Sample</name>
+
+ <modules>
+ <module>account</module>
+ <module>webclient</module>
+ </modules>
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<script type="text/javascript">
+function expandImage(img,height,width) {
+window.open(img,"Image","menubar=no,resizable=no,status=no,toolbar=no,location=no,height=" + height + ",width=" + width);
+}
+function goURL(url) {
+window.location = url;
+}
+</script>
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=us-ascii">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+ <title>Tuscany BigBank Sample Application</title>
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+<style type="text/css" media="all">
+</style>
+</head>
+
+<body>
+
+ <h3>Tuscany BigBank Sample Application</h3>
+
+ <h4>Overview</h4>
+
+ <p>The Tuscany BigBank&nbsp;sample application&nbsp; shows using
+ the Tuscany SCA runtime to build a&nbsp; 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</p>
+
+ <h4>Location</h4>
+ <p>This sample is located&nbsp;in the&nbsp;
+ <a href=".">samples\applications\bigbank</a> directory. There are two
+ subdirectories in that for the two modules <a href="account"
+ target="_blank">account</a> and <a href="webclient" target=
+ "_blank">webclient.</a></p>
+
+
+ <h4>Prerequisites</h4>
+
+ <p>Obtain the following prerequisites and install according to
+ their documentation.</p>
+
+ <ul>
+ <li><a href="http://java.sun.com/javase/downloads/index.jsp"
+ target="_blank">JDK 5.0</a></li>
+
+ <li><a href="http://maven.apache.org/download.html" target=
+ "_blank">Maven 2.0.4</a></li>
+
+ <li><a href="http://tomcat.apache.org/download-55.cgi" target=
+ "_blank">Apache Tomcat 5.xx</a> latest version binary core
+ distribution.&nbsp;</li>
+ </ul>
+
+ <h4><a name="Building" id="Building"></a>Building</h4>
+ <p>This sample
+ can be built from the bigbank directory using Maven 2.0.4 with
+ the following command:</p>
+ <p>
+ <code>&nbsp;mvn<br></code>
+ </p>
+
+ <h4>Setup</h4>
+ <p>If you have enabled remote deployment in Tomcat by
+ adding the line:<br>
+ <code>&nbsp; &lt;user username="admin" password=""
+ roles="manager"/&gt;</code><br>
+ into&nbsp; <span style="font-style: italic;">&lt;tomcat
+ dir&gt;</span>\conf\tomcat-users.xml&nbsp; you can deploy the
+ WARs to Tomcat using the tomcat-maven-plugin:<br>
+ <code>mvn tomcat:deploy</code></p>
+ <p>Alternatively you can copy the WAR files to Tomcat's&nbsp;
+ webapps directory.<br>
+
+ <code>copy account\target\sample-bigbank-account.war <span style=
+ "font-style: italic;">&lt;tomcat dir&gt;</span>\webapps</code><br>
+ <code>copy&nbsp;
+ webclient\target\sample-bigbank-webclient.war&nbsp;<span style=
+ "font-style: italic;">&lt;tomcat dir&gt;</span>\webapps</code><br>
+ </p>
+
+ <h4>Running</h4>
+ <p>Once you've started your web server, use your web
+ browser to view the following URL <a href=
+ "http://localhost:8080/sample-bigbank-webclient/" target=
+ "_blank">http://localhost:8080/sample-bigbank-webclient/</a><br>
+ You can either use an already pre configured&nbsp; account with
+ <span style="font-weight: bold;">Login</span> as <span style=
+ "color: rgb(204, 0, 0); font-weight: bold;">test</span> and
+ <span style="font-weight: bold;">Password</span> as <span style=
+ "color: rgb(204, 0, 0); font-weight: bold;">password,</span> or
+ you can &nbsp;create a new account.<br>
+ The demo is first configured to use a local mock stock quote
+ service that returns random stock data. &nbsp;If you want to use
+ an actual stock quote provider follow these steps:</p>
+
+ <ul>
+ <li>Stop your server by issuing in the&nbsp; <span style=
+ "font-style: italic;">&lt;tomcat dir&gt;</span><span style=
+ "font-weight: bold;">\bin</span> directory</li>
+
+ <li>Issue <span style="font-weight: bold;">shutdown</span>
+ command to stop your web application server<span style=
+ "font-weight: bold;">.</span></li>
+
+ <li>Edit the account SCDL file <span style=
+ "font-style: italic;">&lt;tomcat dir&gt;</span><span style=
+ "font-weight: bold;">\webapps\sample-bigbank-account\WEB-INF\default.scdl</span></li>
+
+ <li>Change the SCDL wiring to remove the mock stock quote
+ service by commenting it out as follows:<br>
+ &lt;!--<br>
+ &nbsp;&nbsp;&nbsp; &lt;component
+ name="StockQuoteServiceComponent"&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;implementation.java
+ class="bigbank.account.services.stockquote.StockQuoteServiceImpl"
+ /&gt;<br>
+ &nbsp;&nbsp;&nbsp; &lt;/component&gt;<br>
+ --&gt;</li>
+
+ <li>Uncomment the real stockquote service section in lines 68
+ to 80.<br></li>
+
+ <li>Change to the directory &nbsp;<span style=
+ "font-weight: bold;">apache-tomcat-5.5.17\bin&nbsp;</span></li>
+
+ <li>issue <span style="font-weight: bold;">startup
+ &nbsp;</span> command to start up the server in the
+ <span style="font-style: italic;">&lt;tomcat dir&gt;</span>\bin
+ directory<span style="font-weight: bold;">.</span></li>
+ </ul>
+ <p>The sample should now be using the real stock quote
+ provider.&nbsp;</p>
+
+ <h4>Summary</h4><p>This example illustrates using Tuscany runtime
+ in building a financial Web application&nbsp;using SCA programing
+ model. &nbsp;The following key concepts are covered:</p>
+
+ <ul>
+ <li><b><i>Component implementations</i></b>. that provide web
+ based&nbsp; HTML&nbsp;user interface</li>
+
+ <li><b><i>Component implementations</i></b> that provide
+ <b><i>local services</i></b> in Java. Local services implement
+ internal application business logic such as tracking user state
+ and are not exposed remotely.</li>
+
+ <li><b><i>Component implementations</i></b> that have
+ <b><i>configuration properties</i></b> and <b><i>service
+ references</i></b> to other services</li>
+
+ <li><b><i>Components</i></b> that use and
+ <b><i>configure</i></b> <b><i>the properties and
+ references</i></b> of component implementations</li>
+
+ <li><b><i>SCA Services</i></b> to publish remotable services
+ via a <b><i>Web Service binding</i></b>.</li>
+
+ <li><b><i>SCA References&nbsp;</i></b> to consume remotable
+ services via a <b><i>Web Service binding</i></b></li>
+
+ <li>Assembling implementation, components, entry points and
+ external service into composite components.</li>
+
+ <li>Creating a module and all of its artifacts as part of a
+ <b><i>web application</i></b> to show a front-end access to SCA
+ services</li>
+
+ <li>The use of Data Access services to persist and retrieve
+ Service Data Objects from Apache Derby.</li>
+
+ <li style="text-align: left;">The use of &nbsp;existing Web
+ services in&nbsp; SCA.</li>
+ </ul><p>BigBank sample provides the following user services: account
+ balance,&nbsp;making deposits and withdrawals&nbsp; to purchase
+ and sell stock, and to view current stock value.<br>
+ 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.</p>
+ <br>
+
+ <div style="text-align: center;">
+ <img style="width: 381px; height: 169px;" alt=
+ "Overview of modules." title="Overview of modules." src=
+ "docs/modualoverview.png" align="middle">
+
+ <h5>Webclient</h5><br>
+ <a href=
+ "javascript:expandImage('docs/Show.Image.html?url=webclientmodule.png',1000,1100)">
+ <img style="width: 300px; height: 200px;" alt="Webclient files"
+ title="Click to expand" src="docs/webclientmodule.png"></a><br>
+
+ <p>&nbsp;</p>
+
+ <table style="text-align: left; width: 100%;" border="0"
+ cellpadding="1" cellspacing="0" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" valign="top" width="*">
+ <a href=
+ "javascript:expandImage('docs/Show.Image.html?url=webclientfiles.png',850,500)">
+ <img style="width: 262px; height: 360px;" alt=
+ "Webclient files" title="Click to expand" src=
+ "docs/webclientfiles.png"></a>&nbsp;<br>
+
+ <div style="text-align: center;">
+ <small><span style="font-style: italic;">click to
+ enlarge</span></small>
+ </div>
+ </td>
+
+ <td style="text-align: left;" align="left" valign="top"
+ width="80%">
+ <table style="text-align: left; width: 100%;" border=
+ "0" cellpadding="1" cellspacing="0">
+ <tbody>
+ <tr>
+ <td style="text-align: center;" colspan="3">
+ <span style=
+ "font-weight: bold; text-decoration: underline;">Java
+ source files implementing SCA components and
+ interfaces.</span></td>
+ </tr>
+
+ <tr>
+ <td style="width: 10%;">
+ AccountServiceComponentImpl.java</td>
+
+ <td>&nbsp;</td>
+
+ <td>Implements the account service.</td>
+ </tr>
+
+ <tr>
+ <td>AccountLoginServiceImpl.java</td>
+
+ <td></td>
+
+ <td>Implements the Login service.</td>
+ </tr>
+
+ <tr>
+ <td>LoginService.java</td>
+
+ <td></td>
+
+ <td>Interface for a services provided by a
+ login&nbsp; service component.</td>
+ </tr>
+
+ <tr>
+ <td>ProfileService.java</td>
+
+ <td></td>
+
+ <td>Interface for a service provided by a profile
+ component.</td>
+ </tr>
+
+ <tr>
+ <td>ProfileServiceImpl.java</td>
+
+ <td></td>
+
+ <td>Implements the profile component.</td>
+ </tr>
+
+ <tr>
+ <td>SimpleLoginServiceImpl.java</td>
+
+ <td></td>
+
+ <td>A simple in memory login service.</td>
+ </tr>
+
+ <tr>
+ <td style="text-align: center;" colspan="3">
+ <span style=
+ "font-weight: bold; text-decoration: underline;">Java
+ source files implementing Web HTML
+ interface.</span></td>
+ </tr>
+
+ <tr>
+ <td>AccountStatusTag.java</td>
+
+ <td></td>
+
+ <td>Implements a jsp tag that&nbsp;displays the
+ account information</td>
+ </tr>
+
+ <tr>
+ <td>StockStatusTag.java</td>
+
+ <td></td>
+
+ <td>Implements a jsp tag that displays the stock
+ information.</td>
+ </tr>
+
+ <tr>
+ <td>LoginBarrierTag.java</td>
+
+ <td></td>
+
+ <td>Implements a jsp tag that ensures the user is
+ logged in.</td>
+ </tr>
+
+ <tr>
+ <td>ServiceTag.java</td>
+
+ <td></td>
+
+ <td>Places an SCA service in the JSP page
+ context.</td>
+ </tr>
+
+ <tr>
+ <td>FormServlet.java</td>
+
+ <td></td>
+
+ <td>Process user input and uses the
+ AccountService component.</td>
+ </tr>
+
+ <tr>
+ <td>LoginServlet.java</td>
+
+ <td></td>
+
+ <td>Processes logging in and logout.</td>
+ </tr>
+
+ <tr>
+ <td style="text-align: center;" colspan="3">
+ <span style=
+ "font-weight: bold; text-decoration: underline;">Files
+ that will be loaded as resources along
+ classpath.</span></td>
+ </tr>
+
+ <tr>
+ <td>AccountService.wsdl</td>
+
+ <td></td>
+
+ <td>WSDL that &nbsp;defines the account
+ service.</td>
+ </tr>
+
+ <tr>
+ <td>bigbank-tags.tld</td>
+
+ <td></td>
+
+ <td>Defines the tag libs for the user
+ interface.</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Files
+ located in WEB-INF directory.</span></td>
+ </tr>
+
+ <tr>
+ <td><a href="#SCDL">default.scdl</a></td>
+
+ <td></td>
+
+ <td>Application's SCA SCDL file.</td>
+ </tr>
+
+ <tr>
+ <td><a href="#Web.xml">web.xml</a></td>
+
+ <td></td>
+
+ <td>Application's web.xml file.</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Generated
+ Files.</span></td>
+ </tr>
+
+ <tr>
+ <td>sdo source</td>
+
+ <td></td>
+
+ <td>Generated SDO. Created by <a href=
+ "#tuscany-sdo-plugin"><code><span style=
+ "font-weight: bold;">tuscany-sdo-plugin</span></code></a>
+ maven plugin.</td>
+ </tr>
+
+ <tr>
+ <td>wsdl2java-source</td>
+
+ <td></td>
+
+ <td>Generated SDO interface. Created by <a href=
+ "#tuscany-plugin-wsdl2java"><code><span style=
+ "font-weight: bold;">tuscany-plugin-wsdl2java</span></code></a>
+ maven &nbsp;plugin.</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Build
+ files.</span></td>
+ </tr>
+
+ <tr>
+ <td><a href="#pom.xml">pom.xml</a></td>
+
+ <td></td>
+
+ <td>Maven build file.</td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>&nbsp;</p><!-- account -->
+
+ <h5>Account</h5><br>
+ <a href=
+ "javascript:expandImage('docs/Show.Image.html?url=accountmodule.png',830,1400)">
+ <img style="width: 300px; height: 200px;" alt="Account module"
+ title="Click to expand" src="docs/accountmodule.png"></a><br>
+
+ <p>&nbsp;</p>
+
+ <table style="text-align: left; width: 100%;" border="0"
+ cellpadding="1" cellspacing="0" width="100%">
+ <tbody>
+ <tr>
+ <td align="left" valign="top" width="*">
+ <a href=
+ "javascript:expandImage('docs/Show.Image.html?url=accountfiles.png',850,500)">
+ <img style="width: 262px; height: 360px;" alt=
+ "Webclient files" title="Click to expand" src=
+ "docs/accountfiles.png"></a>&nbsp;<br>
+
+ <div style="text-align: center;">
+ <small><span style="font-style: italic;">click to
+ enlarge</span></small>
+ </div>
+ </td>
+
+ <td style="text-align: left;" align="left" valign="top"
+ width="80%">
+ <table style="text-align: left; width: 100%;" border=
+ "0" cellpadding="1" cellspacing="0">
+ <tbody>
+ <tr>
+ <td style="text-align: center;" colspan="3">
+ <span style=
+ "font-weight: bold; text-decoration: underline;">Java
+ source files implementing SCA components and
+ interfaces.</span></td>
+ </tr>
+
+ <tr>
+ <td style="width: 10%;">
+ AccountServiceImpl.java</td>
+
+ <td>&nbsp;</td>
+
+ <td>Implements the account service
+ component.</td>
+ </tr>
+
+ <tr>
+ <td>AccountDataService.java</td>
+
+ <td></td>
+
+ <td>Interface defined for component implementing
+ &nbsp;an account's data service.</td>
+ </tr>
+
+ <tr>
+ <td>AccountDataServiceDASImpl.java</td>
+
+ <td></td>
+
+ <td>A Data Access Service (DAS) implementation of
+ of the Account Data Service.</td>
+ </tr>
+
+ <tr>
+ <td>AccountDataServiceImpl.java</td>
+
+ <td></td>
+
+ <td>A Data Service implementation not using
+ DAS.</td>
+ </tr>
+
+ <tr>
+ <td>AccountDBInit.java</td>
+
+ <td></td>
+
+ <td>A utility to just create the database and it
+ table and fill in some initial data.</td>
+ </tr>
+
+ <tr>
+ <td>StockQuote.java</td>
+
+ <td></td>
+
+ <td>A class to hold the StockQuote
+ information.</td>
+ </tr>
+
+ <tr>
+ <td>StockQuoteService.java</td>
+
+ <td></td>
+
+ <td>Interface defined for a component
+ implementing a stock quote service.</td>
+ </tr>
+
+ <tr>
+ <td>StockQuoteServiceImpl.java</td>
+
+ <td></td>
+
+ <td>Implements a fake stock quote service.</td>
+ </tr>
+
+ <tr>
+ <td>StockQuoteWebservicexServiceImpl.java</td>
+
+ <td></td>
+
+ <td>Implements an actual stock quote
+ service.</td>
+ </tr>
+
+ <tr>
+ <td style="text-align: center;" colspan="3">
+ <span style=
+ "font-weight: bold; text-decoration: underline;">Files
+ that will be loaded as resources along
+ classpath.</span></td>
+ </tr>
+
+ <tr>
+ <td>AccountService.wsdl</td>
+
+ <td></td>
+
+ <td>WSDL that &nbsp;defines the account
+ service</td>
+ </tr>
+
+ <tr>
+ <td>stockquotes.webservicex.wsdl</td>
+
+ <td></td>
+
+ <td>Actual stock quote service WSDL.</td>
+ </tr>
+
+ <tr>
+ <td><a href=
+ "#DAS_">DasAccountConfiguration.xml</a></td>
+
+ <td></td>
+
+ <td>Provides any needed configuration info
+ including datasource properties, table
+ definitions,</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Files
+ located in WEB-INF directory.</span></td>
+ </tr>
+
+ <tr>
+ <td><a href="#SCDL">default.scdl</a></td>
+
+ <td></td>
+
+ <td>Application's SCA SCDL file.</td>
+ </tr>
+
+ <tr>
+ <td><a href="#Web.xml">web.xml</a></td>
+
+ <td></td>
+
+ <td>Application's web.xml file.</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Generated
+ Files.</span></td>
+ </tr>
+
+ <tr>
+ <td>sdo source</td>
+
+ <td></td>
+
+ <td>Generated SDO. Created by&nbsp;<a href=
+ "#tuscany-sdo-plugin"><code><span style=
+ "font-weight: bold;">tuscany-sdo-plugin</span></code></a>
+ maven plugin.</td>
+ </tr>
+
+ <tr>
+ <td>wsdl2java-source</td>
+
+ <td></td>
+
+ <td>Generated SDO interface. Created
+ by&nbsp;<a href=
+ "#tuscany-plugin-wsdl2java"><code><span style=
+ "font-weight: bold;">tuscany-plugin-wsdl2java</span></code></a>
+ maven &nbsp;plugin.</td>
+ </tr>
+
+ <tr align="center">
+ <td colspan="3"><span style=
+ "font-weight: bold; text-decoration: underline;">Build
+ files.</span></td>
+ </tr>
+
+ <tr>
+ <td><a href="#pom.xml">pom.xml</a></td>
+
+ <td></td>
+
+ <td>Maven build file.</td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div><br>
+ <br>
+
+
+ <h5><a name="pom.xml" id="pom.xml"></a>Pom.xml</h5>
+ <p>The directions
+ for maven&nbsp; how&nbsp; to build the each module is located in
+ each module's directory in the&nbsp;pom.xml file. &nbsp;The
+ application uses Java 1.5 and thus in the build &nbsp;plugin
+ section needs the following compiler directives:</p>
+ &nbsp;&nbsp;<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;plugin&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;configuration&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;source&gt;<span style=
+ "color: rgb(255, 0, 0); font-weight: bold;">1.5</span>&lt;/source&gt;<br>
+
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;target&gt;<span style=
+ "color: rgb(255, 0, 0); font-weight: bold;">1.5</span>&lt;/target&gt;<br>
+
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;/configuration&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &lt;/plugin&gt;</code><br>
+ <p>Both webclient and account uses three maven
+ plugins:&nbsp;<code style=
+ "font-weight: bold;">tuscany-sdo-plugin</code>,&nbsp;<code style=
+ "font-weight: bold;">tuscany-plugin-wsdl2java</code>,
+ and&nbsp;<code style=
+ "font-weight: bold;">tuscany-war-plugin</code>.
+ The&nbsp;tuscany-sdo-plugin is provided by Tuscany 's SDO project
+ while the other two are provided by the Tuscany SCA project.</p>
+ <p>The <code style="font-weight: bold;"><a name="tuscany-sdo-plugin"
+ id="tuscany-sdo-plugin"></a>tuscany-sdo-plugin</code>
+ &nbsp;references the WSDL's schema and generates all the files
+ located in target/sdo_source directory. &nbsp;The application
+ uses these classes as a databinding instead of having to deal
+ directly with XML that &nbsp;represents form as defined in the
+ WSDL's schema.</p>
+ <p>The <code style="font-weight: bold;"><a name=
+ "tuscany-plugin-wsdl2java" id=
+ "tuscany-plugin-wsdl2java"></a>tuscany-plugin-wsdl2java</code>
+ plugin generates a Java interface in the target/wsdl2java-source
+ directory that is used to define the inteface (prottype) in the
+ wsdl.</p>
+ <p>The <code style="font-weight: bold;">tuscany-war-plugin</code> is
+ used to add both the Tuscany runtime and any Tuscany&nbsp;
+ extensions required by the application in the war file.. Looking
+ at the pom.xml and search for &nbsp;"<code style=
+ "font-weight: bold;">tuscany-war-plugin"</code> you'll find the
+ plugin. &nbsp;Which extension you want loaded are specified in
+ the <code><span style=
+ "font-weight: bold;">extensions</span></code> section. The format
+ for this&nbsp; closely follows Maven's artifact naming. &nbsp;The
+ boolean <code><span style=
+ "font-weight: bold;">loadExtensionDependencies</span></code>
+ option if true will &nbsp;resolve all dependencies for each
+ extension listed here and also include them in the war file.
+ &nbsp;<br>
+ <br>
+
+ <h4>Application</h4>
+
+ <h5><a name="Web.xml" id="Web.xml"></a>Web.xml</h5><p>The web.xml
+ file in each module adds necessary "hooks" to initiate and
+ maintain the Tuscany SCA runtime in a web application host.<br>
+ &nbsp;</p>
+
+ <table style="text-align: left; width: 100%;" border="1"
+ cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td>
+ <pre>
+<small>&lt;listener&gt;<br>
+&lt;listener-class&gt;org.apache.tuscany.runtime.webapp.TuscanyContextListener&lt;/listener-class&gt;<br>
+&lt;/listener&gt;</small>
+</pre>
+ </td>
+
+ <td>This class initializes the Tuscany runtime when the
+ applications is started and helps finalize the Tuscany
+ runtime when the application has ended.</td>
+ </tr>
+
+ <tr>
+ <td>
+ <pre>
+<small>&lt;servlet&gt;<br>
+&lt;servlet-name&gt;TuscanyServlet&lt;/servlet-name&gt;<br>
+&lt;display-name&gt;Tuscany Servlet&lt;/display-name&gt;<br>
+&lt;servlet-class&gt;org.apache.tuscany.runtime.webapp.TuscanyServlet&lt;/servlet-class&gt;<br>
+&lt;/servlet&gt;</small>
+</pre>
+ </td>
+
+ <td>This class provides the web applications servlet
+ interface to SCA components. &nbsp;The Axis websevices
+ binding extension requires this.</td>
+ </tr>
+
+ <tr>
+ <td>
+ <pre>
+<small>&lt;listener&gt;<br>
+&lt;listener-class&gt;org.apache.tuscany.runtime.webapp.TuscanySessionListener&lt;/listener-class&gt;<br>
+&lt;/listener&gt;</small>
+</pre>
+ </td>
+
+ <td>This listener helps provide SCA session support .</td>
+ </tr>
+ </tbody>
+ </table><br>
+ <p>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 <code><span style=
+ "font-weight: bold;">tuscany.online</span></code>. If&nbsp; 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.</p>
+
+ <h5><a name="SCDL" id="SCDL"></a>SCDL</h5>
+ <p>Each module's SCA
+ application SCDL is located in the web application&nbsp;
+ WEB-INF/default.scdl file. &nbsp;This is the default location,
+ but within the web.xml it is possible to override this with a
+ context-param element &nbsp;with the name <code><span style=
+ "font-weight: bold;">tuscany.applicationScdlPath</span></code>.
+ &nbsp;The Tuscany System SCDL can also be overridden with another
+ context-param element with the name <code><span style=
+ "font-weight: bold;">tuscany.systemScdlPath</span></code>.<br>
+ The SCDL&nbsp; used by the BigBank application is defined by
+ <a href=
+ "http://www.osoa.org/download/attachments/35/SCA_AssemblyModel_V096.pdf?version=1"
+ target="_blank">SCA Assembly Model V0.96</a> , <a href=
+ "http://www.osoa.org/download/attachments/35/SCA_ClientAndImplementationModelforJava_v0.95.pdf?version=3"
+ target="_blank">SCA Client and Implementation Model for Java
+ (V0.95)</a> &nbsp;and the <a href=
+ "http://www.osoa.org/download/attachments/35/SCA_WebServiceBindings_V096-draft1.pdf?version=3"
+ target="_blank">SCA Web Service bindings</a> specifications.<br>
+ There is one extension to SCDL used by BigBank that is specific
+ to Tuscany that is used by SDO databinding extension.
+ &nbsp;The&nbsp;<code>import.sdo</code> element in the SCDL
+ specifies which&nbsp; SDO factories to register the SDO types.
+ &nbsp;In the case of BigBank the factory is the class generated
+ by the&nbsp;<code style=
+ "font-weight: bold;">tuscany-sdo-plugin</code> maven plugin. An
+ example of this follows:</p>
+ <pre>
+ <code>&lt;dbsdo:import.sdo xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2"
+factory="com.bigbank.account.AccountFactory"/&gt; <br>
+</code>
+</pre>
+
+ <h5>Code</h5><p>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 <a href=
+ "http://www.osoa.org/download/attachments/35/SCA_ClientAndImplementationModelforJava_v0.95.pdf?version=3"
+ target="_blank">SCA Client and Implementation Model for Java
+ (V0.95)</a> 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 <code style=
+ "font-weight: bold;">@DataType(name="commonj.sdo.DataObject")</code>
+ annotation.</p>
+
+ <h4><a name="DAS_" id="DAS_"></a><span style=
+ "font-family: monospace;">RDB DAS</span></h4>
+
+ <p>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.</p>
+
+ <p>The sample demonstrates a few of the RDB DAS capabilities including:</p>
+
+ <ul>
+
+ <li>reading a graph of SDOs based on a select query provided inline </li>
+ <li>reading a graph of SDOs based on a named select query defined in the config file </li>
+ <li>executing a named command to manually insert data</li>
+ <li>leveraging SDO Change Summary to by utilizing the DAS "applyChanges" method to flush graph modifications </li>
+ <li>utilizing the DAS column-converter framework </li>
+ <li>using the column/property name mapping (aliasing)</li>
+
+ </ul>
+
+ <p>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 <a href=
+ "http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_Java_User_Guide"target="_blank">RDBDAS User's Guide</a>.
+ </p>
+ <p>This sample uses the RDB DAS as a utility. A future version of this sample will access the DAS as an SCA service.
+ </p>
+
+</body>
+</html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.bigbank</groupId>
+ <artifactId>bigbank-scenario</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-bigbank-webclient</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany BigBank Web Client Module</name>
+ <description>BigBank Scenario Sample - Web Front-End Module</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- SDO's XMLStreamHelper requires StAX API and impl (it's not pulled by
+ tuscany-sdo-impl because the maven dependency scope is provided -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- Set to true to embed external jars for extensions in the WAR -->
+ <!-- Set to false to leave external jars for extensions to be resolved from maven repository -->
+ <loadExtensionDependencies>false</loadExtensionDependencies>
+
+ <extensions>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+ </extensions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ --%>
+
+<HTML>
+<HEAD>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META http-equiv="Content-Style-Type" content="text/css">
+<%-- LINK href="theme/Master.css" rel="stylesheet" type="text/css" --%>
+<TITLE>BigBank- Customer Account</TITLE>
+</HEAD>
+<BODY><P><FONT size="+1">Customer Account</FONT><BR>
+<BR>
+</P>
+<FORM method="post" action="FormServlet">
+<input type="hidden" name="action" value='createAccount' />
+<TABLE border="0">
+ <TBODY>
+ <TR>
+ <TD>First name </TD>
+ <TD width="10%"></TD>
+ <TD><INPUT type="text" name="firstName" size="20"></TD>
+ </TR>
+ <TR>
+ <TD>Last name</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="lastName" size="20"></TD>
+ </TR>
+ <TR>
+ <TD>Address</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="address" size="36" maxlength="170"></TD>
+ </TR>
+ <TR>
+ <TD>email</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="email" size="16" maxlength="39"></TD>
+ </TR>
+ <TR>
+ <TD>&nbsp;</TD>
+ <TD></TD>
+ <TD></TD>
+ </TR>
+ <TR>
+ <TD>Checkings</TD>
+ <TD></TD>
+ <TD><INPUT type="checkbox" name="checkings" value="checkings" checked></TD>
+ </TR>
+ <TR>
+ <TD>Savings</TD>
+ <TD></TD>
+ <TD><INPUT type="checkbox" name="savings" value="savings" checked></TD>
+ </TR>
+ <TR>
+ <TD>&nbsp;</TD>
+ <TD></TD>
+ <TD></TD>
+ </TR>
+ <TR>
+ <TD>Logon ID</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="loginID" size="20"></TD>
+ </TR>
+ <TR>
+ <TD>Password</TD>
+ <TD></TD>
+ <TD><INPUT type="password" name="password" size="20"></TD>
+ </TR>
+ <TR>
+ <TD></TD>
+ <TD></TD>
+ <TD></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<BR>
+<INPUT type="submit" name="update" value="update">&nbsp;&nbsp;
+<INPUT type="button" name="cancel" value="cancel"></FORM>
+<P><BR>
+</P>
+</BODY>
+</HTML>
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 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
+ <tlibversion>1.0</tlibversion>
+ <jspversion>2.0</jspversion>
+ <shortname>BigBank Tags</shortname>
+ <info>Tag library containing BigBank tags</info>
+ <tag>
+ <name>service</name>
+ <tagclass>bigbank.webclient.tags.sca.ServiceTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Places a reference to an SCA Service in the page context</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>login</name>
+ <tagclass>bigbank.webclient.tags.sca.LoginBarrierTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Redirects if user is not logged in</info>
+ <attribute>
+ <name>profile</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>url</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+
+ </tag>
+ <tag>
+ <name>accountStatus</name>
+ <tagclass>bigbank.webclient.tags.account.AccountStatusTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Accesses and iterates the account service</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>accountService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>profileService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>stockStatus</name>
+ <tagclass>bigbank.webclient.tags.account.StockStatusTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Accesses and iterates the stocks</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <name>accountLog</name>
+ <tagclass>bigbank.webclient.tags.account.AccountLogTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Accesses and iterates the accounts log</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>accountService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>profileService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>stockLog</name>
+ <tagclass>bigbank.webclient.tags.account.StockLogTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Accesses and iterates the stocks log</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+
+</taglib>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="bigbank.webclient">
+
+
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" factory="com.bigbank.account.AccountFactory"/>
+
+ <component name="LoginServiceComponent">
+ <implementation.java class="bigbank.webclient.services.profile.AccountLoginServiceImpl"/>
+ <reference name="accountService">AccountServiceComponent</reference>
+ <reference name="profileService">ProfileServiceComponent</reference>
+ </component>
+
+ <property name="name" type="xsd:string">Anonymous</property>
+
+ <component name="ProfileServiceComponent">
+ <implementation.java class="bigbank.webclient.services.profile.ProfileServiceImpl"/>
+ <property name="firstName" source="$name"/>
+ </component>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.webclient.services.account.AccountServiceComponentImpl"/>
+ <reference name="accountService">AccountService</reference>
+ </component>
+
+
+ <reference name="AccountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)" wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountService.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>Tuscany Bigbank Web UI sample</display-name>
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>login.html</welcome-file>
+ </welcome-file-list>
+
+ <filter>
+ <filter-name>TuscanyFilter</filter-name>
+ <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>TuscanyFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <context-param>
+ <param-name>tuscany.online</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanySessionListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyRequestListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>LoginServlet</servlet-name>
+ <servlet-class>bigbank.webclient.ui.LoginServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>FormServlet</servlet-name>
+ <servlet-class>bigbank.webclient.ui.FormServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>LoginServlet</servlet-name>
+ <url-pattern>/loginAction/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>FormServlet</servlet-name>
+ <url-pattern>/FormServlet/*</url-pattern>
+ </servlet-mapping>
+
+
+
+
+
+
+
+
+</web-app>
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" %>
+
+ <html>
+ <title>BigBank Account and Stock Log</title>
+
+ <body>
+
+ Account Log
+
+ <table>
+ <tr>
+ <td><strong>Seq</strong></td>
+ <td><strong>Account</strong></td>
+ <td><strong>Action</strong></td>
+ <td><strong>Amount</strong></td>
+ </tr>
+ <sca:accountLog accountService="AccountServiceComponent" profileService="ProfileServiceComponent" id="accountlogentry">
+ <tr>
+ <td>
+ <jsp:getProperty name="accountlogentry" property="logSeqNo"/>
+ </td>
+ <td>
+ <jsp:getProperty name="accountlogentry" property="accountNumber"/>
+ </td>
+ <td>
+ <jsp:getProperty name="accountlogentry" property="actionType"/>
+ </td>
+ <td>
+ <jsp:getProperty name="accountlogentry" property="amount"/>
+ </td>
+ </tr>
+ </sca:accountLog>
+ </table>
+
+
+
+ <hr/>
+ Stock Log
+
+ <table>
+
+ <tr>
+ <td><strong>Seq</strong></td>
+ <td><strong>Symbol</strong></td>
+ <td><strong>Quantity</strong></td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td><strong>Action</strong></td>
+ <td><strong>PurchaseLotNumber</strong></td>
+ </tr>
+ <sca:stockLog id="stocklogentry">
+ <tr>
+ <td>
+ <jsp:getProperty name="stocklogentry" property="logSeqNo"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocklogentry" property="symbol"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocklogentry" property="quantity"/>
+ </td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td>
+ <jsp:getProperty name="stocklogentry" property="actionType"/>
+ </td>
+
+ <td>
+ <jsp:getProperty name="stocklogentry" property="purchaseLotNumber"/>
+ </td>
+ </tr>
+ </FORM>
+ </sca:stockLog>
+ </table>
+
+
+ </body>
+ </html>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ --%>
+
+<HTML>
+<HEAD>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<META http-equiv="Content-Style-Type" content="text/css">
+<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
+<TITLE>BigBank - <%=request.getParameter("account") %> </TITLE>
+</HEAD>
+<BODY>
+<P>Account <%= request.getParameter("account") %><BR>
+<BR>
+<BR>
+</P>
+<FORM method="post" action="FormServlet">
+<input type="hidden" name="action" value='account' />
+<input type="hidden" name="account" value='<%= request.getParameter("account") %>' />
+<input type="hidden" name="actionType" value='<%=request.getParameter("transaction")%>' />
+Amount to <%=request.getParameter("transaction")%> <INPUT type="text" name="Amount" size="10"
+ maxlength="10"><BR>
+<BR>
+<BR>
+<BR>
+<INPUT type="submit" name="Submit"
+ value="Submit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit"
+ name="cancel" value="cancel">
+</FORM>
+</BODY>
+</HTML>
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 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+<title>Welcome to Big Bank</title>
+
+<body>
+
+<form action="loginAction" method="post">
+ <table>
+ <tr>
+ <td colspan="2">Please login in to access your account</td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>Login</td>
+ <td><input type="text" name="login"/></td>
+ <td><I><FONT
+ size="-1" color="red">(test)</FONT></I></td>
+ </tr>
+ <tr>
+ <td>Password</td>
+ <td><input type="password" name="password"/></td>
+ <td><I><FONT size="-1" color="red">(password)</FONT></I></td>
+ </tr>
+ <tr>&nbsp;<td></td>
+ <td align="right"><input type="submit" name='login' value="login"/></td>
+ <tr>&nbsp;<td></td>
+ </tr>
+ </table>
+</form>
+<P><BR></P>
+<HR/>
+<FORM action="CustomerProfile.jsp" method="get">
+<BR>New to Big Bank? Please open a new account with us.
+<BR/>
+<P>
+<INPUT type="submit" name="createAccount" value="Create a new account">
+
+</FORM>
+
+
+</body>
+</html>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ --%>
+
+<HTML>
+<HEAD>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META http-equiv="Content-Style-Type" content="text/css">
+<TITLE>BigBank- Stock purchase</TITLE>
+</HEAD>
+<BODY><P><FONT size="+1">Stock purchase</FONT><BR>
+<BR>
+</P>
+<FORM method="post" action="FormServlet">
+<input type="hidden" name="action" value='stockPurchase' />
+<TABLE border="0">
+ <TBODY>
+ <TR>
+ <TD>Symbol </TD>
+ <TD width="10%"></TD>
+ <TD><INPUT type="text" name="symbol" size="6"></TD>
+ </TR>
+ <TR>
+ <TD>Quantity</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="quantity" size="6"></TD>
+ </TR>
+ <TR>
+ <TD></TD>
+ <TD></TD>
+ <TD></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<BR>
+<INPUT type="submit" name="purchase" value="purchase">&nbsp;&nbsp;
+<INPUT type="submit" name="cancel" value="cancel"></FORM>
+<P><BR>
+</P>
+</BODY>
+</HTML>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ --%>
+
+<HTML>
+<HEAD>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META http-equiv="Content-Style-Type" content="text/css">
+<TITLE>BigBank- Stock sale</TITLE>
+</HEAD>
+<BODY><P><FONT size="+1">Stock sale</FONT><BR>
+<BR>
+</P>
+<FORM method="post" action="FormServlet">
+<input type="hidden" name="action" value='stockSale' />
+<input type="hidden" name="purchaseLotNumber" value='<%=request.getParameter("purchaseLotNumber")%>' />
+<TABLE border="0">
+ <TBODY>
+
+ <TR>
+ <TD>Quantity</TD>
+ <TD></TD>
+ <TD><INPUT type="text" name="quantity" size="6"></TD>
+ </TR>
+ <TR>
+ <TD></TD>
+ <TD></TD>
+ <TD></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<BR>
+<INPUT type="submit" name="stockSale" value="sell">&nbsp;&nbsp;
+<INPUT type="submit" name="cancel" value="cancel"></FORM>
+<P><BR>
+</P>
+</BODY>
+</HTML>
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" %>
+<sca:login profile="ProfileServiceComponent" url="login.html">
+ <sca:service id="profile" name="ProfileServiceComponent"/>
+
+ <html>
+ <title>BigBank Account Summary</title>
+
+ <body>
+
+ Account Information for
+ <FORM method="post" action='loginAction'>
+ <jsp:getProperty name='profile' property='firstName'/>
+ <jsp:getProperty name='profile' property='lastName'/>
+ <input type="hidden" name="logoutHIDDEN" value='logoutHIDDEN' />
+ &nbsp;&nbsp;<INPUT type="submit" name='logout' value="logout">
+ <br>
+ </FORM>
+
+ <table>
+ <tr>
+ <td><strong>Account</strong></td>
+ <td>&nbsp;</td>
+ <td><strong>Balance</strong></td>
+ </tr>
+ <sca:accountStatus accountService="AccountServiceComponent" profileService="ProfileServiceComponent" id="account">
+ <tr>
+ <FORM method="post" action='accountTransaction.jsp'>
+ <input type="hidden" name="account" value='<%=((AccountSummary)pageContext.getAttribute("account")).getAccountNumber()%>' />
+ <td>
+ <jsp:getProperty name="account" property="accountNumber"/>
+ </td>
+
+ <td>
+ <jsp:getProperty name="account" property="accountType"/>
+ </td>
+ <td>
+ <jsp:getProperty name="account" property="balance"/>
+ </td>
+ <td>
+
+ <INPUT type="submit" name='transaction' value="deposit">
+ </td>
+ <td>
+ <INPUT type="submit" name='transaction' value="withdraw">
+ </td>
+ </FORM>
+ </tr>
+ </sca:accountStatus>
+ </table>
+
+
+
+ <hr/>
+ <FORM method="post" action='purchaseStock.jsp'>
+ Stocks: &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" name='Purchase' value="Purchase"><br/>
+ </FORM>
+
+ <table>
+
+ <tr>
+ <td><strong>Symbol</strong></td>
+ <td><strong>Quantity</strong></td>
+ <td><strong>Purchase Date</strong></td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td><strong>Purchase Price</strong></td>
+ <td><strong>Current Price</strong></td>
+ <td><strong>Company Name</strong></td>
+ <td><strong>Today High</strong></td>
+ <td><strong>Today Low</strong></td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td> <%-- sell button --%></td>
+ </tr>
+ <sca:stockStatus id="stocksummary">
+ <FORM method="post" action='stockSale.jsp' >
+ <tr>
+ <td>
+ <jsp:getProperty name="stocksummary" property="symbol"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocksummary" property="quantity"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocksummary" property="purchaseDate"/>
+ </td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td>
+ <jsp:getProperty name="stocksummary" property="purchasePrice"/>
+ </td>
+
+ <td>
+ <jsp:getProperty name="stocksummary" property="currentPrice"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocksummary" property="company"/>
+ </td>
+
+ <td>
+ <jsp:getProperty name="stocksummary" property="highPrice"/>
+ </td>
+ <td>
+ <jsp:getProperty name="stocksummary" property="lowPrice"/>
+ </td>
+ <td>&nbsp;&nbsp;</td> <%-- spacer --%>
+ <td>
+ <INPUT type="submit" name='stocksale' value="sell"><br/>
+ <input type="hidden" name="purchaseLotNumber" value='<%=((StockSummary)pageContext.getAttribute("stocksummary")).getPurchaseLotNumber()%>' />
+ </td>
+ </tr>
+ </FORM>
+ </sca:stockStatus>
+ </table>
+
+ <hr/>
+ <FORM method="post" action='accountLog.jsp'>
+ Account and Stock Logs: &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="submit" name='Logs' value="Logs"><br/>
+ </FORM>
+
+
+ </body>
+ </html>
+</sca:login>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-calculator</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Calculator Sample</name>
+ <description>A sample Calculator made of several SCA components wired together.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>calculator.CalculatorClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=us-ascii">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+ <title>Tuscany Simple Calculator Sample</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+ <h3>Tuscany Simple Calculator Sample</h3>
+
+ <h4>Overview</h4>
+
+ <p>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.</p>
+
+ <h4>Location</h4>
+
+ <p>This sample is located &nbsp;in the
+ samples\standalone\calculator directory. All the
+ following commands should be issued while working in the sample
+ directory.</p>
+
+ <h4>Prerequisites</h4>
+
+ <p>Obtain the following prerequisites and install according to
+ their documentation.</p>
+
+ <ul>
+ <li><a href="http://java.sun.com/javase/downloads/index.jsp"
+ target="_blank">JDK 5.0</a></li>
+
+ <li><a href="http://maven.apache.org/download.html" target=
+ "_blank">Maven 2.0.4</a></li>
+ </ul>
+
+ <h4>Building</h4>
+
+ <p>To build the sample&nbsp; issue :</p>
+ <pre>
+<code>mvn<br></code>
+</pre>
+
+ <p>The result after executing is in the <span style=
+ "font-weight: bold;">target</span> subdirectory the <span style=
+ "font-weight: bold;">sample-calculator.jar</span></p>
+
+ <h4>Setup</h4>
+
+ <p>Set up the Tuscany standalone runtime environment using the
+ following command:</p>
+ <pre>
+<code>mvn dependency:unpack <br></code>
+</pre>
+
+ <p>After completion there should be a <span style=
+ "font-weight: bold;">target\distribution</span> subdirectory
+ created that has the Tuscany standalone runtime.</p>
+
+ <h4>Running</h4>
+
+ <p>Execute the following command: (<span style=
+ "font-style: italic;">cut and paste to command line</span>)</p>
+ <pre>
+<code>java -jar target/distribution/bin/launcher.jar target/sample-calculator.jar</code>
+</pre>
+
+ <h4>Results</h4>
+
+ <p>The sample when run should simply display to the standard
+ output:<br>
+<samp>
+<br>3 + 2=5.0
+<br>3 - 2=1.0
+<br>3 * 2=6.0
+<br>3 / 2=1.5
+</samp>
+</p>
+</body>
+</html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="Calculator">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService"/>
+ <reference>CalculatorServiceComponent</reference>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"></reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-composite-impl</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Composite Implementation Sample</name>
+ <description>A sample showing local wiring of a component implemented by a composite.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>composite.CompositeClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="InnerComposite">
+
+ <service name="InnerSourceService" target="InnerSourceComponent">
+ <interface.java interface="composite.Source"/>
+ <reference name="innerSource">InnerSourceComponent</reference>
+ </service>
+
+ <component name="InnerSourceComponent">
+ <implementation.java class="composite.SourceImpl"/>
+ <!--reference name="targetReference">TargetComponentRef</reference>
+ <reference name="targetReference2">TargetComponentRef2</reference-->
+ </component>
+
+ <reference name="TargetComponentRef" promote="InnerSourceComponent/targetReference">
+ <interface.java interface="composite.Target"
+ callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+ <reference name="TargetComponentRef2" promote="InnerSourceComponent/targetReference2">
+ <interface.java interface="composite.Target"
+ callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="InnerComposite2">
+
+ <service name="InnerTargetService" target="InnerTargetComponent">
+ <interface.java interface="composite.Target"
+ callbackInterface="composite.SourceCallback"/>
+ <reference name="innerSource">InnerTargetComponent</reference>
+ </service>
+
+ <component name="InnerTargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OuterComposite">
+
+ <component name="SourceComponent">
+ <implementation.composite name="InnerComposite" scdlLocation="InnerComposite.composite"/>
+ <reference name="TargetComponentRef" target="TargetComponent"></reference>
+ <reference name="TargetComponentRef2" target="TargetComponent2/InnerTargetService"></reference>
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+ <component name="TargetComponent2">
+ <implementation.composite name="InnerComposite2" scdlLocation="InnerComposite2.composite"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-echo-binding</artifactId>
+ <name>Apache Tuscany Echo Binding Sample</name>
+ <description>A Sample Binding Extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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<EchoBinding> {
+
+ 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<EchoBinding> {
+
+ 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<EchoBinding> 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="echobinding-extension">
+
+ <component name="BindingLoader">
+ <system:implementation.system class="echo.EchoBindingLoader"/>
+ </component>
+
+ <component name="BindingBuilder">
+ <system:implementation.system class="echo.EchoBuilder"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="echo">
+
+ <service name="ClientService">
+ <interface.java class="echo.Client"/>
+ <binding.echo/>
+ <reference>Client</reference>
+ </service>
+
+ <component name="Client">
+ <implementation.java class="echo.ClientImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="Client">
+ <interface.java interface="echo.Echo"/>
+ <binding.echo/>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-echo-databinding</artifactId>
+ <name>Apache Tuscany Echo DataBinding Sample</name>
+ <description>A DataBinding Sample</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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<EchoBinding> {
+
+ 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<EchoBinding> {
+
+ 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<EchoBinding> 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="binding.echo">
+
+ <component name="BindingLoader">
+ <system:implementation.system class="echo.EchoBindingLoader" />
+ </component>
+
+ <component name="BindingBuilder">
+ <system:implementation.system class="echo.EchoBuilder" />
+ </component>
+
+</composite>
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("<message><foo>123</foo></message>");
+ componentA.call1("<message><foo>123</foo></message>");
+ }
+
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:f="http://foo"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="EchoDataBinding">
+
+ <service name="EchoService">
+ <interface.java class="echo.Interface1" />
+ <binding.echo />
+ <reference>ComponentB</reference>
+ </service>
+
+ <component name="ComponentA">
+ <implementation.java class="echo.ComponentAImpl" />
+ <reference name="componentBReference" target="ComponentB"></reference>
+ <property name="prefix">ABC</property>
+ <property name="prefix1" source="$messagePrefix"></property>
+ <property name="bar" source="$complexProperty/*[local-name()='foo']/*[local-name()='bar']"></property>
+ <property name="omProperty"><a><b>XYZ</b></a></property>
+ </component>
+
+ <component name="ComponentB">
+ <implementation.java class="echo.ComponentBImpl" />
+ </component>
+
+ <reference name="EchoReference" promote="ComponentB/echoReference">
+ <!--
+ <interface.java interface="echo.Echo"/>
+ -->
+ <interface.wsdl interface="http://example.com/echo.wsdl#wsdl.interface(EchoPortType)" wsdli:wsdlLocation="http://example.com/echo.wsdl wsdl/echo.wsdl">
+ <db:databinding xmlns:db="http://tuscany.apache.org/xmlns/sca/databinding/1.0" name="org.apache.axiom.om.OMElement"/>
+ </interface.wsdl>
+ <binding.echo />
+ </reference>
+
+ <property name="messagePrefix" type="xsd:string">ABC</property>
+ <property name="complexProperty" type="f:FooType">
+ <foo>
+ <bar attr="barAttr">BAR</bar>
+ </foo>
+ </property>
+
+</composite>
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 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/echo.wsdl" xmlns:tns="http://example.com/echo.wsdl"
+ xmlns:xsd1="http://example.com/echo.xsd" xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/echo.xsd" xmlns:tns="http://example.com/echo.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="messageType">
+ <sequence>
+ <element name="foo" type="string"></element>
+ </sequence>
+ </complexType>
+ <element name="echo">
+ <complexType>
+ <sequence>
+ <element name="message" type="tns:messageType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echoResponse">
+ <complexType>
+ <sequence>
+ <element name="message" type="tns:messageType" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="EchoInput">
+ <part name="body" element="xsd1:echo" />
+ </message>
+
+ <message name="EchoOutput">
+ <part name="body" element="xsd1:echoResponse" />
+ </message>
+
+ <portType name="EchoPortType">
+ <operation name="echo">
+ <input message="tns:EchoInput" />
+ <output message="tns:EchoOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-loanapplication</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Loan Application Conversation Sample</name>
+ <description>A sample implementation of a loan application conversation.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>loanapplication.LoanApplicationClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="loanapplication">
+
+ <component name="LoanClientComponent">
+ <implementation.java class="loanapplication.LoanClientImpl"/>
+ <reference name="loanService" target="LoanServiceComponent"></reference>
+ </component>
+
+ <component name="LoanServiceComponent">
+ <implementation.java class="loanapplication.LoanServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>calculator</module>
+ <module>composite-impl</module>
+ <module>loanapplication</module>
+ <module>simple-bigbank</module>
+ <module>simple-callback</module>
+ <module>supplychain</module>
+ <module>echo-binding</module>
+ <module>echo-databinding</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-simple-bigbank</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Simplified BigBank Sample</name>
+ <description>Simplified Big Bank Sample</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>bigbank.BigBankClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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<String> summaries = new ArrayList<String>();
+
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="BigBank">
+
+ <service name="AccountService">
+ <interface.java interface="bigbank.account.AccountService"/>
+ <reference>AccountServiceComponent</reference>
+ </service>
+
+ <!--
+ <reference name="StockQuoteService">
+ <interface.java interface="bigbank.stock.StockQuoteService"/>
+ </reference>
+ -->
+
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+ <reference name="accountDataService" target="AccountDataServiceComponent"></reference>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-simple-callback</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Simple Callback Sample</name>
+ <description>A sample implementation of a simple callback application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>simplecallback.SimpleCallbackClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="simplecallback">
+
+ <component name="MyClientComponent">
+ <implementation.java class="simplecallback.MyClientImpl"/>
+ <reference name="myService" target="MyServiceComponent"></reference>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="simplecallback.MyServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-supplychain</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Supply Chain Sample</name>
+ <description>A sample implementation of an asynchronous supply chain application.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>supplychain.SupplyChainClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"><title>Tuscany
+Supply Chain</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+<style type="text/css" media="all">
+@import url("../../../../css/maven-base.css");
+@import url("../../../../css/maven-theme.css");
+@import url("../../../../css/site.css");
+</style><link rel="stylesheet" href="./css/print.css" type="text/css" media="print"></head>
+<body><h2>Tuscany
+Supply Chain Sample</h2>
+<h3>Overview</h3>
+<p>The Tuscany supply chain sample shows using the Tuscany SCA
+runtime in a J2SE environment&nbsp;executing the SCA asynchronous API.</p>
+<h3>Location</h3>This
+sample is located &nbsp;in the samples\sca\supplychain directory.<br>
+<h3>Setup</h3>This sample depends on the Tuscany runtime
+and the sample jar,&nbsp;<span style="font-weight: bold;">sample-supplychain-incubating-M1.jar</span>
+, both of these must be available on the classpath to run the sample.
+<h3>Running</h3> In the directory&nbsp;samples\sca\supplychain
+use the JDK 1.5 java command to run the class <span style="font-weight: bold;">supplychain.SupplyChainClient</span> <pre>Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient</pre>
+<pre>Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient</pre><h3>Results</h3>
+<p>The sample when run should simply display to the standard
+output: <code></code></p><p>May 16, 2006
+3:12:13 PM org.apache.tuscany.core.client.TuscanyRuntime$Monitor
+moduleStarted<br>INFO: Started application module [supplychain]<br>Main
+thread Thread[main,5,main]<br>Work thread Thread[Thread-1,5,main]
+- <span style="font-weight: bold;">Order, submitted, fulfilled, shipped</span><code></code></p>
+<h3>Code Overview</h3>
+The source files are physically organized as shown below:
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr><td>src<br>+---main<br>&nbsp;&nbsp;&nbsp;
++---java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp; +---supplychain<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Customer.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+CustomerComponentImpl.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Retailer.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+RetailerComponentImpl.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Shipper.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ShipperComponentImpl.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+SupplyChainClient.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Warehouse.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+WarehouseComponentImpl.java<br>&nbsp;&nbsp;&nbsp;
+&brvbar;<br>&nbsp;&nbsp;&nbsp; +---resources<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+logging.properties<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+sca.module<br></td></tr></tbody></table>
+<br><table style="text-align: left; width: 879px; height: 154px;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="vertical-align: top;">Customer.java</td>
+<td>Defines the Java interface implemented by the Customer
+component.</td>
+</tr> <tr> <td style="vertical-align: top;">CustomerComponentImpl.java</td>
+<td>Implements the SCA Customer component.</td>
+</tr> <tr> <td style="vertical-align: top;">Retailer.java</td>
+<td>Defines the Java interface implemented by the Retailer
+component.</td>
+</tr><tr><td>RetailerComponentImpl.java</td><td>Implements
+the SCA&nbsp;RetailerComponent component.</td></tr><tr><td>Shipper.java</td><td>Defines
+the Java interface implemented by the&nbsp;Shipper component</td></tr><tr><td>ShipperComponentImpl.java</td><td>Implements
+the SCA&nbsp;ShipperComponent component.</td></tr><tr><td>SupplyChainClient.java</td><td>SupplyChainClient.java
+loads SCA runtime</td></tr><tr><td>Warehouse.java</td><td>Defines
+the Java interface implemented by the&nbsp;Warehouse component.</td></tr><tr><td>WarehouseComponentImpl.java</td><td>Implements
+the SCA&nbsp;WarehouseComponent component.</td></tr><tr><td>logging.properties</td><td>Configures
+Tuscany logging. Provides the output of this demo.</td></tr><tr><td>sca.module</td><td>Defines
+and assembles the SCA components</td></tr> </tbody></table><br></body></html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.CustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent"></reference>
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.RetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"></reference>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.WarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent"></reference>
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.ShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent"></reference>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany Simple WebApp Sample</name>
+ <description>A sample Web Application showing how to use SCA from a JSP.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CalculatorComposite">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.composite name="CalculatorComposite" jarLocation="lib/sample-calculator-1.0-incubator-SNAPSHOT.jar"/>
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>Apache Tuscany Simple Webapp Sample</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+ <filter>
+ <filter-name>TuscanyFilter</filter-name>
+ <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>TuscanyFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+</web-app>
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");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calc.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calc.subtract(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-axis2</artifactId>
+ <name>Apache Tuscany Binding for Axis2</name>
+ <description>Implementation of the SCA Web Services binding using Axis2</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- A hack to bring in databinding-axiom transitively -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>httpcomponents-httpcore</groupId>
+ <artifactId>jakarta-httpcore</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>extension</outputDirectory>
+ <includes>
+ <include>org.apache.tuscany.bindings:axis2</include>
+ </includes>
+ <fileMode>644</fileMode>
+ </dependencySet>
+ </dependencySets>
+</assembly>
+
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<Object> 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<WebServiceBindingDefinition> {
+ 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, <binding.ws> with no wsdl only works with <interface.wsdl>
+ if (wsBinding.getWSDLDefinition() == null) {
+ if (outboundContract instanceof WSDLServiceContract) {
+ String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI();
+ wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+ } else {
+ throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
+ }
+ }
+
+ // 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, <binding.ws> with no wsdl only works with <interface.wsdl>
+ if (wsBinding.getWSDLDefinition() == null) {
+ if (inboundContract instanceof WSDLServiceContract) {
+ String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
+ wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+ } else {
+ throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
+ }
+ }
+
+ // 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<WebServiceBindingDefinition> 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 <binding.ws> 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) {
+ // <binding.ws> 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 <binding.ws>?
+ // 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<Object> 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<Operation<?>, 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<T> 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<Object> 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<Object> 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<Object, InvocationContext> invCtxMap = new HashMap<Object, InvocationContext>();
+
+ private String serviceName;
+
+ private WorkContext workContext;
+
+ private Boolean conversational = null;
+
+ private Set<String> seenConversations = Collections.synchronizedSet(new HashSet<String>());
+
+ 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 <code>WebServiceBindingDefinition</code> entry in an assembly XML file
+ *
+ * TODO: TUSCANY-1153 support <wsa:EndpointReference>
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@SuppressWarnings("deprecation")
+public class WebServiceBindingLoader extends LoaderExtension<WebServiceBindingDefinition> {
+ 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<Service>) 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
+ * <p/> 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<Part> inputHeaderParts;
+ private transient Set<Part> outputHeaderParts;
+ private transient String style;
+ private transient String use;
+ private transient String soapAction;
+ private transient List<Object> 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<Part> getInputHeaderParts() {
+ if (inputHeaderParts == null) {
+ // Build a set of header parts that we need to exclude
+ inputHeaderParts = new HashSet<Part>();
+ 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<Part> getOutputHeaderParts() {
+ if (outputHeaderParts == null) {
+ // Build a set of header parts that we need to exclude
+ outputHeaderParts = new HashSet<Part>();
+ 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<String> getSOAPBodyParts(boolean input) {
+ javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input);
+ if (soapBody != null) {
+ List parts = soapBody.getParts();
+ if (parts != null) {
+ List<String> names = new ArrayList<String>();
+ 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<String> styles = (List<String>) 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<Object>();
+
+ 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<String> 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<Integer> getBodyPartIndexes(boolean isInput) {
+ List<Integer> indexes = new ArrayList<Integer>();
+
+ Message message = getMessage(isInput);
+ if (message == null) {
+ return indexes;
+ }
+
+ List<String> 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<WebServiceOperationMetaData> 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<WebServiceOperationMetaData> list = getAllOperationMetaData();
+ return list.get(0).getUse();
+ }
+
+ /**
+ * Returns the encoding attribute
+ */
+ public String getEncoding() {
+ List<WebServiceOperationMetaData> 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> T getExtensibilityElement(List elements, Class<T> 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 <T> List<T> getExtensibilityElements(List elements, Class<T> type) {
+ List<T> result = new ArrayList<T>();
+ 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<WebServiceOperationMetaData> getAllOperationMetaData() {
+ if (allOperationMetaData == null) {
+ allOperationMetaData = new ArrayList<WebServiceOperationMetaData>();
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>tuscany-axis2</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>databinding-axiom</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader" />
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder" />
+ </component>
+
+ <!-- A workaround to handle inter-extension dependencies -->
+ <include name="idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl" />
+ <include name="databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl" />
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>tuscany-axis2</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>databinding-axiom</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+ <!-- A workaround to handle inter-extension dependencies -->
+ <include name="idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl"/>
+ <include name="databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl"/>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing peaxis2ssions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.binding.axis2">
+ <include name="org.apache.tuscany.binding.axis2.include" scdlLocation="binding.axis2.scdl" />
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <parameter name="enableSwA" locked="false">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments" locked="false">true</parameter>
+ <parameter name="attachmentDIR" locked="false"></parameter>
+ <parameter name="sizeThreshold" locked="false">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in seconds-->
+ <parameter name="ConfigContextTimeoutInterval" locked="false">30</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults" locked="false">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason" locked="false">false</parameter>
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot" locked="false">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distingiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath" locked="false">services</parameter>-->
+ <!--<parameter name="restPath" locked="false">rest</parameter>-->
+
+
+ <!--Set the flag to true if you want to enable transport level session mangment-->
+ <parameter name="manageTransportSession" locked="false">false</parameter>
+
+ <!--Following two parameters will be used to handle REST in Axis2. The default settings will make Axis2 to have two-->
+ <!--different endpoints, one for REST (AxisRESTServlet) one for SOAP message handling (AxisServlet). But following-->
+ <!--parameters help to tweak the message handling of two main servlets. -->
+
+ <!-- If the enableRESTInAxis2MainServlet is true, then Axis2MainServlet will handle both SOAP and REST messages -->
+ <parameter name="enableRESTInAxis2MainServlet" locked="true">true</parameter>
+
+ <!-- Following parameter will completely disable REST handling in both the servlets-->
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!-- This will disable the separate servlet we have for REST handling. -->
+ <parameter name="disableSeparateEndpointForREST" locked="true">false</parameter>
+
+ <!-- If you have a frontend host which exposes this webservice using a different public URL -->
+ <!-- use this parameter to override autodetected url -->
+ <!--<parameter name="httpFrontendHostUrl" locked="false">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInOutAsyncMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.binding.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills us (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname" locked="false">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer" locked="false">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout" locked="false">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay" locked="false">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize" locked="false">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize" locked="false">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime" locked="false">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit" locked="false">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have SMTP transport support-->
+ <!--<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">-->
+ <!--<parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>-->
+ <!--<parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.port" locked="false">110</parameter>-->
+ <!--<parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>-->
+ <!--</transportReceiver>-->
+
+ <transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncommet following paramter , and set as you required.-->
+ <!--<parameter name="hostname" locked="false">tcp://myApp.com/ws</parameter>-->
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+
+ <!-- Commented out by Tuscany
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <!-- Commented out by Tuscany
+ <module ref="addressing"/>
+ -->
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+ <handler name="TuscanyDispatcher"
+ class="org.apache.tuscany.binding.axis2.TuscanyDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
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<SOAPAddress> ees = new ArrayList<SOAPAddress>();
+ 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<String, Service> services = new HashMap<String, Service>();
+ 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<Type>("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<Type> callbackOp =
+ new Operation<Type>("sayHiCallback", null, null, null, true, null, NO_CONVERSATION);
+ HashMap<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
+ callbackOps.put("sayHiCallback", callbackOp);
+ contract.setCallbackOperations(callbackOps);
+ EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+ EasyMock.replay(inboundWire);
+
+ axis2Reference.setInboundWire(inboundWire);
+ Operation operation = new Operation<Type>("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<String, Operation<Type>> opMap = new HashMap<String, Operation<Type>>();
+ for (Method m : Greeter.class.getMethods()) {
+ opMap.put(m.getName(), new Operation<Type>(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<Operation<?>, OutboundInvocationChain> map = new HashMap<Operation<?>, 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<String, Servlet> mappings = new HashMap<String, Servlet>();
+
+ 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<String, Service> services = new HashMap<String, Service>();
+ 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<String, Service> services = new HashMap<String, Service>();
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http"
+ xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+ elementFormDefault="qualified">
+ <simpleType name="MyStringType">
+ <restriction base="string">
+ <maxLength value="30" />
+ </restriction>
+ </simpleType>
+
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="tns:MyStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeWithCallback">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeWithCallback">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-axiom</artifactId>
+ <name>Apache Tuscany Data Binding for Axiom</name>
+ <description>Tuscany Axiom Data Binding</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
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<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<XMLType> faultType = new DataType<XMLType>(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<OMElement> {
+
+ @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<OMElement, String> implements PullTransformer<OMElement, String> {
+ // 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<OMElement, XMLStreamReader> implements PullTransformer<OMElement, XMLStreamReader> {
+ // 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<OMElement> {
+
+ 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<Object> elements = new ArrayList<Object>();
+ 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<OMElement> {
+
+ 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<String, OMElement> implements
+ PullTransformer<String, OMElement> {
+
+ @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<XMLStreamReader, OMElement> implements
+ PullTransformer<XMLStreamReader, OMElement> {
+
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- This is the copy ot be included by other extensions -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.axiom.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>databinding-axiom</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.axiom">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.axis2</group>
+ <name>databinding-axiom</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.axiom">
+ <include name="org.apache.tuscany.databinding.axiom.include" scdlLocation="databinding.axiom.scdl" />
+</composite> \ 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 =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ 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<XMLType>(ServiceFaultException.class, null));
+ assertEquals(OMElement.class, dataType.getPhysical());
+ assertEquals(XMLType.UNKNOWN, dataType.getLogical());
+ assertEquals(AxiomDataBinding.NAME, dataType.getDataBinding());
+ dataType = handler.getFaultType(new DataType<XMLType>(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 =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ 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("<ipo:comment>") != -1);
+ }
+
+ public final void testStringTransform2() {
+ String str =
+ "<p0:firstName xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:p0=\"http://helloworld\">Robert</p0:firstName>";
+ 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("<ipo:comment>") != -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 @@
+<?xml version="1.0"?>
+<ipo:purchaseOrder
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ipo="http://www.example.com/IPO"
+ xsi:schemaLocation="http://www.example.com/IPO ipo.xsd"
+ orderDate="1999-12-01">
+
+ <shipTo exportCode="1" xsi:type="ipo:UKAddress">
+ <name>Helen Zoe</name>
+ <street>47 Eden Street</street>
+ <city>Cambridge</city>
+ <postcode>CB1 1JR</postcode>
+ </shipTo>
+
+ <billTo xsi:type="ipo:USAddress">
+ <name>Robert Smith</name>
+ <street>8 Oak Avenue</street>
+ <city>Old Town</city>
+ <state>PA</state>
+ <zip>95819</zip>
+ </billTo>
+
+ <items>
+ <item partNum="833-AA">
+ <productName>Lapis necklace</productName>
+ <quantity>1</quantity>
+ <USPrice>99.95</USPrice>
+ <ipo:comment>Want this for the holidays</ipo:comment>
+ <shipDate>1999-12-05</shipDate>
+ </item>
+ </items>
+</ipo:purchaseOrder>
+
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 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
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 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
+ xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
+ <element name="checkOrderStatus">
+ <complexType>
+ <sequence>
+ <element name="customerId" type="string" />
+ <element name="order" type="ipo:PurchaseOrderType" />
+ <element name="flag" type="int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="checkOrderStatusResponse">
+ <complexType>
+ <sequence>
+ <element name="status" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="note" type="string" />
+ </schema>
+ </types>
+
+ <message name="CheckOrderStatusInput1">
+ <part name="body" element="xsd1:checkOrderStatus" />
+ </message>
+
+ <message name="CheckOrderStatusOutput1">
+ <part name="body" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <message name="CheckOrderStatusInput2">
+ <part name="p1" element="xsd1:checkOrderStatus" />
+ <part name="p2" element="xsd1:note" />
+ </message>
+
+ <message name="CheckOrderStatusOutput2">
+ <part name="p1" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <portType name="OrderPortType">
+ <operation name="checkOrderStatus">
+ <input message="tns:CheckOrderStatusInput1" />
+ <output message="tns:CheckOrderStatusOutput1" />
+ </operation>
+ <operation name="checkOrderStatus2">
+ <input message="tns:CheckOrderStatusInput2" />
+ <output message="tns:CheckOrderStatusOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>axis2-itest-old-style</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Axis2 itests old style scdl</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="OldStyleReference">
+
+ <component name="HelloworldClient">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloworldClientRef</reference>
+ </component>
+
+ <reference name="HelloworldClientRef">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworld.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="OldStyleService">
+
+ <service name="HelloWorldWebService">
+ <interface.java class="helloworld.HelloWorldService" />
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" / -->
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.itests</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Axis2 itests</name>
+
+ <modules>
+ <module>old-style</module>
+ <module>simplest</module>
+ <module>service-explicit-uri</module>
+ <module>service-relative-uri</module>
+ </modules>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>axis2-itest-service-explicit-uri</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Axis2 itests service explicit uri</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="client">
+
+ <component name="HelloworldClient">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloworldClientRefSimplest</reference>
+ </component>
+
+ <reference name="HelloworldClientRefSimplest">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws/>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="service">
+
+ <service name="HelloWorldWebService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws uri="http://this.will.be.ignored/myserviceendpoint"/>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/myserviceendpoint"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>axis2-itest-service-relative-uri</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Axis2 itests service relative uri</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="client">
+
+ <component name="HelloworldClient">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloworldClientRefSimplest</reference>
+ </component>
+
+ <reference name="HelloworldClientRefSimplest">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws/>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="service">
+
+ <service name="HelloWorldWebService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws uri="/myserviceendpoint"/>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/HelloWorldServiceComponent/myserviceendpoint"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>axis2-itest-simplest</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Axis2 itests simplest binding.ws</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="client">
+
+ <component name="HelloworldClient">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloworldClientRefSimplest</reference>
+ </component>
+
+ <reference name="HelloworldClientRefSimplest">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws/>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="service">
+
+ <service name="HelloWorldWebService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws/>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/HelloWorldServiceComponent/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>axis2-itest-wsdl-binding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Axis2 itests service relative uri</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="client">
+
+ <component name="HelloworldClient">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloworldClientRefSimplest</reference>
+ </component>
+
+ <reference name="HelloworldClientRefSimplest">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws wsdlElement="http://helloworld>#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8080/HelloWorldServiceComponent/myserviceendpoint" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="service">
+
+ <service name="HelloWorldWebService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws wsdlElement="http://helloworld>#wsdl.binding(HelloWorldSoapBinding)" uri="/myserviceendpoint"/>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/HelloWorldServiceComponent/myserviceendpoint"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-plugin-java2wsdl</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Axis2 Maven Plugin for Java2WSDL</name>
+ <description>Implementation of Java2WSDL Generator</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.tools</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Axis2 Maven Plugins</name>
+ <description>Maven plugins for the Axis2 extension</description>
+
+ <modules>
+ <module>java2wsdl</module>
+ <module>wsdl2java</module>
+ </modules>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Axis2 Maven Plugin for WSDL2Java</name>
+ <description>Implementation of WSDL2Java Generator</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.tools</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Extensions for Axis2</name>
+
+ <repositories>
+ <repository>
+ <id>apache.ws</id>
+ <name>Apache WebServices Repository</name>
+ <url>http://ws.zones.apache.org/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>binding</module>
+ <module>databinding</module>
+ <module>tools</module>
+ <module>plugins</module>
+ <!-- module>itests</module -->
+ <module>samples</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>binding</module>
+ <module>databinding</module>
+ <module>tools</module>
+ <module>plugins</module>
+ <module>itests</module>
+ <module>samples</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>binding</module>
+ <module>databinding</module>
+ <module>tools</module>
+ <module>plugins</module>
+ <module>itests</module>
+ <module>samples</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>1.0.0M6</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>httpcomponents-httpcore</groupId>
+ <artifactId>jakarta-httpcore</artifactId>
+ <version>4.0-alpha2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-calculator-ws</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany Simple WebApp Sample</name>
+ <description>A sample WebApplication showing how to include a Tuscany runtime.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>sample-calculator</artifactId>
+ <version>${tuscanyVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${tuscanyVersion}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>calculator</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <extensions>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${tuscanyVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>${tuscanyVersion}</version>
+ </dependency>
+ </extensions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=us-ascii">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+
+ <title>Tuscany Simple Calculator Sample</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+ <h3>Tuscany Simple Calculator Sample</h3>
+
+ <h4>Overview</h4>
+
+ <p>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.</p>
+
+ <h4>Location</h4>
+
+ <p>This sample is located &nbsp;in the
+ samples\standalone\calculator directory. All the
+ following commands should be issued while working in the sample
+ directory.</p>
+
+ <h4>Prerequisites</h4>
+
+ <p>Obtain the following prerequisites and install according to
+ their documentation.</p>
+
+ <ul>
+ <li><a href="http://java.sun.com/javase/downloads/index.jsp"
+ target="_blank">JDK 5.0</a></li>
+
+ <li><a href="http://maven.apache.org/download.html" target=
+ "_blank">Maven 2.0.4</a></li>
+ </ul>
+
+ <h4>Building</h4>
+
+ <p>To build the sample&nbsp; issue :</p>
+ <pre>
+<code>mvn<br></code>
+</pre>
+
+ <p>The result after executing is in the <span style=
+ "font-weight: bold;">target</span> subdirectory the <span style=
+ "font-weight: bold;">sample-calculator.jar</span></p>
+
+ <h4>Setup</h4>
+
+ <p>Set up the Tuscany standalone runtime environment using the
+ following command:</p>
+ <pre>
+<code>mvn dependency:unpack <br></code>
+</pre>
+
+ <p>After completion there should be a <span style=
+ "font-weight: bold;">target\distribution</span> subdirectory
+ created that has the Tuscany standalone runtime.</p>
+
+ <h4>Running</h4>
+
+ <p>Execute the following command: (<span style=
+ "font-style: italic;">cut and paste to command line</span>)</p>
+ <pre>
+<code>java -jar target/distribution/bin/launcher.jar target/sample-calculator.jar</code>
+</pre>
+
+ <h4>Results</h4>
+
+ <p>The sample when run should simply display to the standard
+ output:<br>
+<samp>
+<br>3 + 2=5.0
+<br>3 - 2=1.0
+<br>3 * 2=6.0
+<br>3 / 2=1.5
+</samp>
+</p>
+</body>
+</html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://example.com/Calculator"
+ xmlns:tns="http://example.com/Calculator"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="calculator">
+
+ <wsdl:types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://example.com/Calculator"
+ elementFormDefault="qualified">
+
+ <element name="value" type="double"/>
+
+ <element name="valuePair">
+ <complexType>
+ <sequence>
+ <element name="first" type="double"/>
+ <element name="second" type="double"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="request">
+ <wsdl:part element="tns:valuePair" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="response">
+ <wsdl:part element="tns:value" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="CalculatorService">
+ <wsdl:operation name="add">
+ <wsdl:input message="tns:request"/>
+ <wsdl:output message="tns:response"/>
+ </wsdl:operation>
+ </wsdl:portType>
+</wsdl:definitions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="CalculatorComposite">
+
+ <service name="Calculator">
+ <interface.wsdl interface="http://example.com/Calculator#wsdl.interface(CalculatorService)"
+ wsdli:wsdlLocation="http://example.com/Calculator calculator.wsdl"/>
+ <reference>CalculatorServiceComponent</reference>
+ <binding.ws endpoint=""
+ wsdli:wsdlLocation="http://example.com/Calculator calculator.wsdl"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.composite name="CalculatorComposite" jarLocation="lib/sample-calculator-1.0-incubator-SNAPSHOT.jar"/>
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>Apache Tuscany Simple Webapp Sample</display-name>
+
+ <filter>
+ <filter-name>TuscanyFilter</filter-name>
+ <filter-class>org.apache.tuscany.runtime.webapp.TuscanyFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>TuscanyFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+</web-app>
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");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calc.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calc.subtract(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html> \ 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 @@
+<html>
+<body>
+Hello World
+</body>
+</html> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-async-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany HelloWorld Web Service Sample</name>
+ <description>A sample HelloWorld Async Web Service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Style-Type" content="text/css"><title>Tuscany
+Hello World Web Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --><!-- maven -->
+<style type="text/css" media="all">
+@import url("../../../../css/maven-base.css");
+@import url("../../../../css/maven-theme.css");
+@import url("../../../../css/site.css");
+</style><link rel="stylesheet" href="./css/print.css" type="text/css" media="print"><!-- end maven --></head>
+<body><h2>Tuscany
+Hello World WS Sample</h2>
+<h3>Overview</h3>
+<p>The Tuscany hello world ws sample shows using the Tuscany SCA
+runtime in a Tomcat environment&nbsp;providing&nbsp;a web
+service.</p>
+<h3>Location</h3>
+This sample is located &nbsp;in the samples\sca\helloworldws
+directory.<br>
+<h3>Setup</h3>
+Set up your server as described in the <a href="../../../GettingStarted.htm" target="_blank">Tomcat
+Setup</a>. &nbsp;If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add
+ <span style="font-weight: bold;">sample-helloworldws-incubating-M1.war</span>
+to your Tomcat's webapp directory.
+<h3>Running</h3>
+This service can be invoked by&nbsp;the Tuscany SCA <a target="_blank" href="../helloworldwsclient/readme.htm">helloworldwsclient</a> or <a target="_blank" href="../helloworldjsclient/readme.htm">helloworldjsclient</a>
+sample.<br>
+<h3>Code Overview</h3>
+The source files are physically organized as shown below:<br>
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>
+<pre>+---main<br> +---resources<br> &brvbar; &brvbar; sca.module<br> &brvbar; &brvbar;<br> &brvbar; +---wsdl<br> &brvbar; helloworld.wsdl<br> &brvbar;<br> +---webapp<br> +---WEB-INF<br> web.xml<br></pre></td></tr></tbody></table>
+<br><br><table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2"><tbody>
+<tr><td style="vertical-align: top; height: 62px;">sca.module</td>
+<td style="height: 62px;">Defines 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&nbsp;HelloWorldServiceComponent</td>
+</tr><tr>
+<td>helloworld.wsdl</td>
+<td>WSDL for the service.</td>
+</tr><tr><td>web.xml</td>
+<td>Standard J2EE web application's web.xml</td>
+</tr></tbody></table>
+<p>You may have noticed that there is no Java source for this
+components implementation. &nbsp;There reason is this sample reuses
+the code from the helloworld sample to implement the service.
+</p></body></html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsCallback">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsWithCallback">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsWithCallbackResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsCallback">
+ <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsWithCallbackRequest">
+ <wsdl:part element="tns:getGreetingsWithCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsWithCallbackResponse">
+ <wsdl:part element="tns:getGreetingsWithCallbackResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdl:input message="tns:getGreetings1Request" name="getGreetings1Request"/>
+ <wsdl:output message="tns:getGreetings1Response" name="getGreetings1Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsWithCallback">
+ <wsdl:input message="tns:getGreetingsWithCallbackRequest" name="getGreetingsWithCallbackRequest"/>
+ <wsdl:output message="tns:getGreetingsWithCallbackResponse" name="getGreetingsWithCallbackResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="HelloWorldCallback">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetings1Request">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetings1Response">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsWithCallback">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsWithCallbackRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsWithCallbackResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-async-1.0-incubator-SNAPSHOT/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="helloworldws">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/helloworld.wsdl" />
+
+ <service name="HelloWorldWebService" target="http:///foo">
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ callbackInterface="http://helloworld#wsdl.interface(HelloWorldCallback)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+
+ <!--
+ <interface.java interface="helloworld.HelloWorldService"
+ callbackInterface="helloworld.HelloWorldCallback"/>
+ -->
+
+ <!--FIXME the location attribute is a really bad hack here! does not follow to spec at all
+ -->
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/helloworld.wsdl" />
+
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2">
+
+ <!-- [rfeng] Commented it out for now. When this SCDL is loaded, the DependencyLoader component
+ has not been initiated yet. We may need to play with initLevel setting -->
+ <!--
+ <tuscany:dependency>
+ <group>axis2</group>
+ <artifact>axis2-core</artifact>
+ <version>SNAPSHOT</version>
+ </tuscany:dependency>
+ -->
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 449867 $ $Date: 2006-09-25 17:01:40 -0700 (Mon, 25 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.runtime.webapp.System">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="wireService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireService"/>
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="introspector">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.module">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeObjectFactory"/>
+ </component>
+
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeObjectFactory"/>
+ </component>
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.launcher.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.launcher.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.launcher.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.launcher.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.launcher.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.launcher.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- Data Binding -->
+ <include name="org.apache.tuscany.launcher.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <!-- Web app ServletHost -->
+ <component name="servletHost">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.ServletHostImpl"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <!-- this value needs to change to a correct one -->
+ <property name = "repository">.</property>
+ </component>
+
+ <include name="databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="binding.axis2" scdlLocation="binding.axis2.scdl"/>
+ <include name="interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+
+
+</composite>
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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Tuscany HelloWorld Web Service Sample</display-name>
+
+ <context-param>
+ <param-name>tuscany.systemScdlPath</param-name>
+ <param-value>/META-INF/tuscany/webapp.scdl</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>tuscany.applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-async-wsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany HelloWorld Web Service Async Client Sample</name>
+ <description>A sample client for a HelloWorld Web Service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>tuscany-sample-helloworld-async-ws</artifactId>
+ <scope>test</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="helloworldwsclient">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/helloworld.wsdl"/>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">HelloWorldService</reference>
+ </component>
+
+ <reference name="HelloWorldService">
+ <!--
+ <interface.java interface="helloworld.HelloWorldService"
+ callbackInterface="helloworld.HelloWorldCallback"/>
+ -->
+
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ callbackInterface="http://helloworld#wsdl.interface(HelloWorldCallback)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworld.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsCallback">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsCallback">
+ <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdl:input message="tns:getGreetings1Request" name="getGreetings1Request"/>
+ <wsdl:output message="tns:getGreetings1Response" name="getGreetings1Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsWithCallback">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="HelloWorldCallback">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetings1Request">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetings1Response">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getGreetingsWithCallback">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-async-1.0-incubator-SNAPSHOT/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlResource="META-INF/sca/databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlResource="META-INF/sca/binding.axis2.scdl"/>
+
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-om-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Axiom Web Service Sample</name>
+ <description>A sample HelloWorld Web Service using Axiom OM.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.om.HelloWorldServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><!-- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Style-Type" content="text/css"><title>Tuscany
+Hello World Web Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --><!-- maven -->
+<style type="text/css" media="all">
+@import url("../../../../css/maven-base.css");
+@import url("../../../../css/maven-theme.css");
+@import url("../../../../css/site.css");
+</style><link rel="stylesheet" href="./css/print.css" type="text/css" media="print"><!-- end maven --></head>
+<body><h2>Tuscany
+Hello World WS Sample</h2>
+<h3>Overview</h3>
+<p>The Tuscany hello world ws sample shows using the Tuscany SCA
+runtime in a Tomcat environment&nbsp;providing&nbsp;a web
+service.</p>
+<h3>Location</h3>
+This sample is located &nbsp;in the samples\sca\helloworldws
+directory.<br>
+<h3>Setup</h3>
+Set up your server as described in the <a href="../../../GettingStarted.htm" target="_blank">Tomcat
+Setup</a>. &nbsp;If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add
+ <span style="font-weight: bold;">sample-helloworldws-incubating-M1.war</span>
+to your Tomcat's webapp directory.
+<h3>Running</h3>
+This service can be invoked by&nbsp;the Tuscany SCA <a target="_blank" href="../helloworldwsclient/readme.htm">helloworldwsclient</a> or <a target="_blank" href="../helloworldjsclient/readme.htm">helloworldjsclient</a>
+sample.<br>
+<h3>Code Overview</h3>
+The source files are physically organized as shown below:<br>
+<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>
+<pre>+---main<br> +---resources<br> &brvbar; &brvbar; sca.module<br> &brvbar; &brvbar;<br> &brvbar; +---wsdl<br> &brvbar; helloworldOM.wsdl<br> &brvbar;<br> +---webapp<br> +---WEB-INF<br> web.xml<br></pre></td></tr></tbody></table>
+<br><br><table style="text-align: left; width: 100%; height: 154px;" border="0" cellpadding="2" cellspacing="2"><tbody>
+<tr><td style="vertical-align: top; height: 62px;">sca.module</td>
+<td style="height: 62px;">Defines 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&nbsp;HelloWorldServiceComponent</td>
+</tr><tr>
+<td>helloworldOM.wsdl</td>
+<td>WSDL for the service.</td>
+</tr><tr><td>web.xml</td>
+<td>Standard J2EE web application's web.xml</td>
+</tr></tbody></table>
+<p>You may have noticed that there is no Java source for this
+components implementation. &nbsp;There reason is this sample reuses
+the code from the helloworldOM sample to implement the service.
+</p></body></html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="helloworldws-om">
+
+ <service name="HelloWorldWebService">
+ <!-- interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)"/ -->
+ <interface.java interface="helloworld.om.HelloWorldService"/>
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)" wsdlLocation="http://helloworld-om wsdl/helloworld-om.wsdl" />
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.om.HelloWorldImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld-om" xmlns:tns="http://helloworld-om" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld-om">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-om-wsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Axiom Web Service Client Sample</name>
+ <description>A sample client for a HelloWorld Web Service using Axiom.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>tuscany-sample-helloworld-om-ws</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.om.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="helloworldwsclient-om">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.om.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService"></reference>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent">
+ <interface.java interface="helloworld.om.HelloWorldService"/>
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)" wsdlLocation="http://helloworld-om wsdl/helloworld-om.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld-om" xmlns:tns="http://helloworld-om" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld-om">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-oneway-ws</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany Greeter Web Service Sample</name>
+ <description>A sample Greeter OneWay Web Service.</description>
+
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-host</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>sample-greeterws-oneway-0.1-integration-incubating-SNAPSHOT</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://greeter" xmlns:tns="http://greeter" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="greeter">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://greeter" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="greet">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="greetRequest">
+ <wsdl:part element="tns:greet" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="greet">
+ <wsdl:input message="tns:greetRequest" name="greetRequest" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterSoapBinding" type="tns:Greeter">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="greet">
+ <wsdlsoap:operation soapAction="greet" />
+ <wsdl:input name="greetRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port binding="tns:GreeterSoapBinding" name="GreeterSoapPort">
+ <wsdlsoap:address
+ location="http://localhost:8080/sample-greeterws-oneway-1.0-incubator-SNAPSHOT/services/GreeterWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="greeterws">
+
+ <service name="GreeterWebService" target="http:///foo">
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://greeter#wsdl.interface(Greeter)"
+ wsdli:wsdlLocation="http://greeter wsdl/greeter.wsdl" />
+
+ <!--FIXME the location attribute is a really bad hack here! does not follow to spec at all
+ -->
+ <binding.ws endpoint="http://greeter#wsdl.endpoint(GreeterService/GreeterSoapPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/greeter.wsdl" />
+
+ <reference>GreeterServiceComponent</reference>
+ </service>
+
+ <component name="GreeterServiceComponent">
+ <implementation.java class="greeter.GreeterImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2">
+
+ <!-- [rfeng] Commented it out for now. When this SCDL is loaded, the DependencyLoader component
+ has not been initiated yet. We may need to play with initLevel setting -->
+ <!--
+ <tuscany:dependency>
+ <group>axis2</group>
+ <artifact>axis2-core</artifact>
+ <version>SNAPSHOT</version>
+ </tuscany:dependency>
+ -->
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 449867 $ $Date: 2006-09-25 17:01:40 -0700 (Mon, 25 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.runtime.webapp.System">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Wire service -->
+ <component name="wireService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireService"/>
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="introspector">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl"/>
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.module">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeObjectFactory"/>
+ </component>
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeObjectFactory"/>
+ </component>
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.launcher.Loader" scdlResource="org/apache/tuscany/core/loader.scdl"/>
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.launcher.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl"/>
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.launcher.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl"/>
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.launcher.Composite" scdlResource="org/apache/tuscany/core/composite.scdl"/>
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.launcher.SystemImplementation" scdlResource="org/apache/tuscany/core/systemImplementation.scdl"/>
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.launcher.JavaImplementation" scdlResource="org/apache/tuscany/core/javaImplementation.scdl"/>
+
+ <!-- Data Binding -->
+ <include name="org.apache.tuscany.launcher.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl"/>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system
+ class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager"/>
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler"/>
+ </component>
+
+ <!-- Web app ServletHost -->
+ <component name="servletHost">
+ <system:implementation.system class="org.apache.tuscany.runtime.webapp.ServletHostImpl"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <!-- this value needs to change to a correct one -->
+ <property name = "repository">.</property>
+ </component>
+
+ <include name="databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="binding.axis2" scdlLocation="binding.axis2.scdl"/>
+ <include name="interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+
+
+</composite>
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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Tuscany Greeter Web Service Sample</display-name>
+
+ <context-param>
+ <param-name>tuscany.systemScdlPath</param-name>
+ <param-value>/META-INF/tuscany/webapp.scdl</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>tuscany.applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-oneway-wsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Web Service Async Client Sample</name>
+ <description>A sample client for a HelloWorld Web Service.</description>
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>${tuscanyVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>greeter.GreeterClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="greeterws">
+
+ <component name="GreeterServiceComponent">
+ <implementation.java class="greeter.GreeterImpl" />
+ </component>
+
+ <component name="GreeterServiceComponent">
+ <implementation.java class="greeter.GreeterImpl" />
+ <reference name="greeterService">GreeterService</reference>
+ </component>
+
+ <reference name="GreeterService">
+ <!--
+ <interface.java interface="helloworld.HelloWorldService"
+ callbackInterface="helloworld.HelloWorldCallback"/>
+ -->
+
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" interface="http://greeter#wsdl.interface(Greeter)"
+ wsdli:wsdlLocation="http://greeter wsdl/greeter.wsdl" />
+
+ <binding.ws endpoint="http://greeter#wsdl.endpoint(GreeterService/GreeterSoapPort)" location="wsdl/greeter.wsdl" />
+ </reference>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://greeter" xmlns:tns="http://greeter" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="greeter">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://greeter" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="greet">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="greetRequest">
+ <wsdl:part element="tns:greet" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="greet">
+ <wsdl:input message="tns:greetRequest" name="greetRequest" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterSoapBinding" type="tns:Greeter">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="greet">
+ <wsdlsoap:operation soapAction="greet" />
+ <wsdl:input name="greetRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port binding="tns:GreeterSoapBinding" name="GreeterSoapPort">
+ <wsdlsoap:address
+ location="http://localhost:8080/sample-greeterws-oneway-1.0-incubator-SNAPSHOT/services/GreeterWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlResource="META-INF/sca/databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlResource="META-INF/sca/databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.idl.wsdl" scdlResource="META-INF/sca/idl.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlResource="META-INF/sca/binding.axis2.scdl"/>
+
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Web Service Sample</name>
+ <description>A sample HelloWorld Web Service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="helloworldws">
+
+ <service name="HelloWorldWebService">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+
+ <component name="httpserver">
+ <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ <property name="httpPort">8080</property>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-helloworld-wsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany HelloWorld Web Service Client Sample</name>
+ <description>A sample client for a HelloWorld Web Service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>tuscany-sample-helloworld-ws</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="helloworldwsclient">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService"></reference>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent">
+ <interface.java class="helloworld.HelloWorldService" />
+ <!-- interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-loanapplication-ws</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany Loan App Conversation Web Service Sample</name>
+ <description>A sample implementation of a loan application conversation web service.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>webapp-api</artifactId>
+ <version>${scaImplVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.runtime.webapp</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <version>${scaImplVersion}</version>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- Set to true to embed external jars for extensions in the WAR -->
+ <!-- Set to false to leave external jars for extensions to be resolved from maven repository -->
+ <loadExtensionDependencies>false</loadExtensionDependencies>
+
+ <extensions>
+ <!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaImplVersion}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>${scaImplVersion}</version>
+ </dependency>
+ </extensions>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:loanservice="http://www.loanappconversation.com/loanservice"
+ targetNamespace="http://www.loanappconversation.com/loanservice"
+ name="LoanService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.loanappconversation.com/loanservice"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:loanservice="http://www.loanappconversation.com/loanservice"
+ >
+
+
+ <xsd:element name="apply">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerName"
+ type="xsd:string" />
+ <xsd:element name="loanAmount"
+ type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="applyResponse">
+ <xsd:complexType/>
+ </xsd:element>
+<!--
+ <xsd:complexType name="LoanApplication">
+ <xsd:sequence>
+ <xsd:element name="customerName"
+ type="xsd:string" />
+ <xsd:element name="loanAmount"
+ type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+-->
+
+ <xsd:element name="lockCurrentRate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="termInYears" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="lockCurrentRateResponse">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="cancelApplication">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="getLoanStatus">
+ <xsd:complexType/>
+ </xsd:element>
+ <xsd:element name="getLoanStatusResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="getLoanStatusReturn" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="display">
+ <xsd:complexType/>
+ </xsd:element>
+
+
+ <xsd:element name="displayResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="displayReturn"
+ type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="close">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="closeResponse">
+ <xsd:complexType/>
+ </xsd:element>
+
+
+ </xsd:schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="applyRequest">
+ <wsdl:part element="loanservice:apply"
+ name="applyRequest" />
+ </wsdl:message>
+ <wsdl:message name="applyResponse">
+ <wsdl:part element="loanservice:applyResponse"
+ name="applyResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="lockCurrentRateRequest">
+ <wsdl:part element="loanservice:lockCurrentRate"
+ name="lockCurrentRate" />
+ </wsdl:message>
+ <wsdl:message name="lockCurrentRateResponse">
+ <wsdl:part element="loanservice:lockCurrentRateResponse"
+ name="lockCurrentRateResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="cancelApplicationRequest">
+ <wsdl:part element="loanservice:cancelApplication" name="cancelApplicationRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getLoanStatusRequest">
+ <wsdl:part element="loanservice:getLoanStatus" name="getLoanStatusRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getLoanStatusResponse">
+ <wsdl:part element="loanservice:getLoanStatusResponse"
+ name="getLoanStatusResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="displayRequest">
+ <wsdl:part element="loanservice:display"
+ name="displayRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="displayResponse">
+ <wsdl:part element="loanservice:displayResponse"
+ name="displayResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="closeRequest">
+ <wsdl:part element="loanservice:close" name="closeRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="closeResponse">
+ <wsdl:part element="loanservice:close" name="closeResponse" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="LoanService">
+ <wsdl:operation name="apply">
+ <wsdl:input message="loanservice:applyRequest" />
+ <wsdl:output message="loanservice:applyResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="lockCurrentRate">
+ <wsdl:input message="loanservice:lockCurrentRateRequest" />
+ <wsdl:output message="loanservice:lockCurrentRateResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="cancelApplication">
+ <wsdl:input message="loanservice:cancelApplicationRequest" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getLoanStatus">
+ <wsdl:input message="loanservice:getLoanStatusRequest" />
+ <wsdl:output message="loanservice:getLoanStatusResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="display">
+ <wsdl:input message="loanservice:displayRequest" />
+ <wsdl:output message="loanservice:displayResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="close">
+ <wsdl:input message="loanservice:closeRequest" />
+ <wsdl:output message="loanservice:closeResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+ <wsdl:binding name="LoanServiceSOAP" type="loanservice:LoanService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="apply">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/apply" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="lockCurrentRate">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/lockCurrentRate" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="cancelApplication">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/cancelApplication" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="getLoanStatus">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/getLoanStatus" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="display">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/display" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="close">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/close" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+ <wsdl:service name="LoanService">
+ <wsdl:port binding="loanservice:LoanServiceSOAP"
+ name="LoanServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-loanappconversationWS/services/LoanService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="simplecallback">
+
+
+ <service name="LoanService" >
+ <interface.java interface="loanappconversation.LoanService" scope="conversational" />
+ <!--
+ <interface.wsdl interface="http://www.loanappconversation.com/loanservice#wsdl.interface(LoanService)"
+ wsdli:wsdlLocation="http://www.loanappconversation.com/loanservice wsdl/loanappconversation.wsdl" />
+
+-->
+
+ <binding.ws endpoint="http://www.loanappconversation.com/loanservice#wsdl.endpoint(LoanService/LoanServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/loanappconversation.wsdl" />
+
+ <reference>LoanServiceComponent</reference>
+ </service>
+
+ <component name="LoanServiceComponent">
+ <implementation.java class="loanappconversation.LoanServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>A sample implementation of a loan application conversation web service.</display-name>
+
+
+ <context-param>
+ <param-name>tuscany.online</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+
+ </servlet-mapping>
+
+
+</web-app>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.samples.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-sample-loanapplication-wsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Loan App Conversation WS Client</name>
+ <description>A sample implementation conversation WS client.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.bindings</groupId>
+ <artifactId>axis2</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>loanappconversation.LoanAppConversationClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="simplecallback">
+
+ <component name="LoanClientComponent">
+ <implementation.java class="loanappconversation.LoanClientImpl"/>
+ <reference name="loanService">LoanService</reference>
+ </component>
+
+
+ <reference name="LoanService">
+ <interface.java interface="loanappconversation.LoanService" scope="conversational" />
+<!--
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://www.loanappconversation.com/loanservice#wsdl.interface(LoanService)"
+ wsdli:wsdlLocation="http://www.loanappconversation.com/loanservice wsdl/loanappconversation.wsdl" />
+-->
+
+ <binding.ws endpoint="http://www.loanappconversation.com/loanservice#wsdl.endpoint(LoanService/LoanServiceSOAP)"
+ location="wsdl/loanappconversation.wsdl" />
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:loanservice="http://www.loanappconversation.com/loanservice"
+ targetNamespace="http://www.loanappconversation.com/loanservice"
+ name="LoanService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.loanappconversation.com/loanservice"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:loanservice="http://www.loanappconversation.com/loanservice"
+ >
+
+
+ <xsd:element name="apply">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerName"
+ type="xsd:string" />
+ <xsd:element name="loanAmount"
+ type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="applyResponse">
+ <xsd:complexType/>
+ </xsd:element>
+<!--
+ <xsd:complexType name="LoanApplication">
+ <xsd:sequence>
+ <xsd:element name="customerName"
+ type="xsd:string" />
+ <xsd:element name="loanAmount"
+ type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+-->
+
+ <xsd:element name="lockCurrentRate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="termInYears" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="lockCurrentRateResponse">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="cancelApplication">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="getLoanStatus">
+ <xsd:complexType/>
+ </xsd:element>
+ <xsd:element name="getLoanStatusResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="getLoanStatusReturn" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="display">
+ <xsd:complexType/>
+ </xsd:element>
+
+
+ <xsd:element name="displayResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="displayReturn"
+ type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="close">
+ <xsd:complexType/>
+ </xsd:element>
+
+ <xsd:element name="closeResponse">
+ <xsd:complexType/>
+ </xsd:element>
+
+
+ </xsd:schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="applyRequest">
+ <wsdl:part element="loanservice:apply"
+ name="applyRequest" />
+ </wsdl:message>
+ <wsdl:message name="applyResponse">
+ <wsdl:part element="loanservice:applyResponse"
+ name="applyResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="lockCurrentRateRequest">
+ <wsdl:part element="loanservice:lockCurrentRate"
+ name="lockCurrentRate" />
+ </wsdl:message>
+ <wsdl:message name="lockCurrentRateResponse">
+ <wsdl:part element="loanservice:lockCurrentRateResponse"
+ name="lockCurrentRateResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="cancelApplicationRequest">
+ <wsdl:part element="loanservice:cancelApplication" name="cancelApplicationRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getLoanStatusRequest">
+ <wsdl:part element="loanservice:getLoanStatus" name="getLoanStatusRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getLoanStatusResponse">
+ <wsdl:part element="loanservice:getLoanStatusResponse"
+ name="getLoanStatusResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="displayRequest">
+ <wsdl:part element="loanservice:display"
+ name="displayRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="displayResponse">
+ <wsdl:part element="loanservice:displayResponse"
+ name="displayResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="closeRequest">
+ <wsdl:part element="loanservice:close" name="closeRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="closeResponse">
+ <wsdl:part element="loanservice:close" name="closeResponse" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="LoanService">
+ <wsdl:operation name="apply">
+ <wsdl:input message="loanservice:applyRequest" />
+ <wsdl:output message="loanservice:applyResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="lockCurrentRate">
+ <wsdl:input message="loanservice:lockCurrentRateRequest" />
+ <wsdl:output message="loanservice:lockCurrentRateResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="cancelApplication">
+ <wsdl:input message="loanservice:cancelApplicationRequest" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getLoanStatus">
+ <wsdl:input message="loanservice:getLoanStatusRequest" />
+ <wsdl:output message="loanservice:getLoanStatusResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="display">
+ <wsdl:input message="loanservice:displayRequest" />
+ <wsdl:output message="loanservice:displayResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="close">
+ <wsdl:input message="loanservice:closeRequest" />
+ <wsdl:output message="loanservice:closeResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+ <wsdl:binding name="LoanServiceSOAP" type="loanservice:LoanService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="apply">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/apply" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="lockCurrentRate">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/lockCurrentRate" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="cancelApplication">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/cancelApplication" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="getLoanStatus">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/getLoanStatus" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="display">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/display" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="close">
+ <soap:operation
+ soapAction="http://www.loanappconversation.com/loanservice/close" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+ <wsdl:service name="LoanService">
+ <wsdl:port binding="loanservice:LoanServiceSOAP"
+ name="LoanServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-loanappconversationWS/services/LoanService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the Axis2 extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>helloworld-ws</module>
+ <module>helloworld-wsclient</module>
+ <module>helloworld-om-ws</module>
+ <module>helloworld-om-wsclient</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>helloworld-ws</module>
+ <module>helloworld-wsclient</module>
+ <module>helloworld-om-ws</module>
+ <module>helloworld-om-wsclient</module>
+ <module>helloworld-async-ws</module>
+ <module>helloworld-async-wsclient</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>helloworld-ws</module>
+ <module>helloworld-wsclient</module>
+ <module>helloworld-om-ws</module>
+ <module>helloworld-om-wsclient</module>
+ <module>helloworld-async-ws</module>
+ <module>helloworld-async-wsclient</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.tools</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <name>Apache Tuscany Axis2 Java2WSDL Tool</name>
+ <description>Apache Tuscany Axis2 Java2WSDL Tool</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/CreditScoreDocLit.wsdl</schemaFile>
+ <javaPackage>org.example.creditscore.doclit</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 <fully qualified class name> : class file name");
+ System.out.println("-o <output Location> : output file location");
+ System.out.println("-cp <class path uri> : list of classpath entries - (urls)");
+ System.out.println("-tn <target namespace> : target namespace");
+ System.out.println("-tp <target namespace prefix> : target namespace prefix");
+ System.out.println("-stn <schema target namespace> : target namespace for schema");
+ System.out.println("-stp <schema target namespace prefix> : target namespace prefix for schema");
+ System.out.println("-sn <service name> : service name");
+ System.out.println("-of <output file name> : output file name for the WSDL");
+ System.out.println("-st <binding style> : style for the WSDL");
+ System.out.println("-u <binding use> : use for the WSDL");
+ System.out.println("-l <soap address> : address of the port for the WSDL");
+ System.out.println("-ixsd [<schema namespace>, <schema location>] : schemas to be imported (and not generated)");
+ System.out.println("-efd <unqualified> : Setting for elementFormDefault (defaults to qualified)");
+ System.out.println("-afd <unqualified> : Setting for attributeFormDefault (defaults to qualified)");
+ System.out.println("-xc <extra class> : 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<String> generatorClassNames = new Vector<String>();
+
+ /**
+ * @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<WSDLGenListener> genPhaseListeners = new Vector<WSDLGenListener>();
+ private GenerationParameters genParams = null;
+ private Map<String, Java2WSDLCommandLineOption> 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 <String, String> 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. <xs:schema or <xsd:schema. We only know that 'schema' will be used
+ // but not sure what suffix is used. Hence this method to get the actual element name used
+ int i = s.indexOf(SCHEMA_ELEMENT_NAME);
+ int j = s.substring(0,
+ i).lastIndexOf("<");
+ return s.substring(j,
+ i + SCHEMA_ELEMENT_NAME.length());
+ }
+
+ 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/TuscanyJava2OMBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
new file mode 100644
index 0000000000..e58d729981
--- /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/TuscanyJava2OMBuilder.java
@@ -0,0 +1,521 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+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.axiom.om.OMNode;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.codehaus.jam.JMethod;
+
+public class TuscanyJava2OMBuilder implements Java2WSDLConstants {
+
+ private TuscanyTypeTable typeTable = null;
+
+ private static int prefixCount = 1;
+
+ private static final String NAMESPACE_PREFIX = "ns";
+
+ private JMethod method[];
+
+ private Collection schemaCollection;
+
+ private GenerationParameters generationParams;
+
+ private OMNamespace ns1;
+
+ private OMNamespace soap;
+
+ private OMNamespace soap12;
+
+ private OMNamespace tns;
+
+ private OMNamespace wsdl;
+
+ private OMNamespace mime;
+
+ private OMNamespace http;
+
+ public TuscanyJava2OMBuilder(JMethod[] method,
+ Collection schemaCollection,
+ TuscanyTypeTable typeTab,
+ GenerationParameters genParams) {
+ this.method = method;
+ this.schemaCollection = schemaCollection;
+ this.typeTable = typeTab;
+ this.generationParams = genParams;
+ }
+
+ public OMElement generateOM() throws Exception {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
+ DEFAULT_WSDL_NAMESPACE_PREFIX);
+ OMElement ele = fac.createOMElement("definitions",
+ wsdl);
+
+ ele.addAttribute("targetNamespace",
+ generationParams.getTargetNamespace(),
+ null);
+ generateNamespaces(fac,
+ ele);
+ generateTypes(fac,
+ ele);
+ generateMessages(fac,
+ ele);
+ generatePortType(fac,
+ ele);
+ generateBinding(fac,
+ ele);
+ generateService(fac,
+ ele);
+ return ele;
+ }
+
+ private void generateNamespaces(OMFactory fac, OMElement defintions) throws Exception {
+ soap = defintions.declareNamespace(URI_WSDL11_SOAP,
+ SOAP11_PREFIX);
+ tns = defintions.declareNamespace(generationParams.getTargetNamespace(),
+ generationParams.getTargetNamespacePrefix());
+ soap12 = defintions.declareNamespace(URI_WSDL12_SOAP,
+ SOAP12_PREFIX);
+ http = defintions.declareNamespace(HTTP_NAMESPACE,
+ HTTP_PREFIX);
+ mime = defintions.declareNamespace(MIME_NAMESPACE,
+ MIME_PREFIX);
+ }
+
+ private void generateTypes(OMFactory fac, OMElement defintions) throws Exception {
+ OMElement wsdlTypes = fac.createOMElement("types",
+ wsdl);
+ StringWriter writer = new StringWriter();
+
+ // wrap the Schema elements with this start and end tags to create a
+ // document root
+ // under which the schemas can fall into
+ writer.write("<xmlSchemas>");
+ writeSchemas(writer);
+ writer.write("</xmlSchemas>");
+
+ 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<String> 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<String> parseName(String sourceName, char separator) {
+ List<String> result = new ArrayList<String>();
+ 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<typeMappings.size(); i++) {
+ Element param = doc.createElement("param");
+ parameterElementList.add(param);
+
+ String typeMapping = (String)typeMappings.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(message.getElementQName()), param);
+ addAttribute(doc, "type", (typeMapping == null)
+ ? ""
+ : typeMapping, param);
+
+ // add an extra attribute to say whether the type mapping is the default
+ // if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMapping)) {
+ if (typeMapper.getDefaultMappingName().equals(typeMapping)) {
+
+ addAttribute(doc, "default", "yes", param);
+ }
+
+ addAttribute(doc, "value", null, param);
+
+ // add this as a body parameter
+ addAttribute(doc, "location", "body", param);
+
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ public List getParameterElementList(Document doc, List parameters, String location) {
+ List parameterElementList = new ArrayList();
+
+ if ((parameters != null) && !parameters.isEmpty()) {
+ int count = parameters.size();
+
+ for (int i = 0; i < count; i++) {
+ Element param = doc.createElement("param");
+ QName name = (QName) parameters.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(name), param);
+
+ String typeMapping = this.typeMapper.getTypeMappingName(name);
+ String typeMappingStr = (typeMapping == null)
+ ? ""
+ : typeMapping;
+
+ addAttribute(doc, "type", typeMappingStr, param);
+ addAttribute(doc, "location", location, param);
+ parameterElementList.add(param);
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ protected boolean isWrapped(AxisOperation operation) {
+ boolean wrapped = false;
+
+ if (isInputPresentForMEP(operation.getMessageExchangePattern())) {
+ QName qname = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getElementQName();
+ if (qname != null && qname.getLocalPart().equals(operation.getName().getLocalPart())) {
+
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(qname);
+ if (typeMappingEntry.isAnonymous()) {
+ wrapped = true;
+ }
+ }
+ }
+
+ return wrapped;
+ }
+
+ private boolean isInputPresentForMEP(String MEP) {
+
+
+ return
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.endsWith(MEP);
+
+
+
+
+ }
+
+ protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "input", operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getOutputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "output", operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getElement(Document doc, String elementName, AxisMessage message, boolean wrapped, List headerParameterQNameList) {
+ Element element = doc.createElement(elementName);
+
+ List parameterElementList = getParameterElementList(doc, message, wrapped);
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ element.appendChild((Element) parameterElementList.get(i));
+ }
+
+ List outputElementList = getParameterElementList(doc, headerParameterQNameList, "header");
+
+ for (int i = 0; i < outputElementList.size(); i++) {
+ element.appendChild((Element) outputElementList.get(i));
+ }
+
+ return element;
+ }
+
+ protected void writeInterface(boolean writeDatabinders) throws Exception {
+ Document interfaceModel = createDOMDocumentForInterface(writeDatabinders);
+ if (!codegenConfiguration.getOutputLocation().exists()) {
+ codegenConfiguration.getOutputLocation().mkdirs();
+ }
+ InterfaceWriter interfaceWriter = new RemotableInterfaceWritter(this.codegenConfiguration
+ .getOutputLocation(), this.codegenConfiguration.getOutputLanguage());
+
+ String packageName = interfaceModel.getDocumentElement().getAttribute("package");
+ String className = interfaceModel.getDocumentElement().getAttribute("name");
+
+ System.out.println(">> 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<CodeGenConfiguration> codegenConfigurations= new LinkedList<CodeGenConfiguration>();
+
+
+
+
+ public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName,
+ Map<QName, SDODataBindingTypeMappingEntry> 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<QName> donePortTypes= new HashSet<QName>();
+
+ 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<QName, SDODataBindingTypeMappingEntry> 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
+ // <lang-name>.* .template=<write-class>,<template-name>
+
+ //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<String> propertyClassNames;
+ private final String className;
+
+ public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List<String> propertyClassNames) {
+ this.className = className;
+ this.anonymous = anonymous;
+ this.propertyClassNames = propertyClassNames;
+ }
+
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public List<String> 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
+ * <target-root-directory> ] [ -javaPackage <java-package-name> ]
+ * <wsdl-file> 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<QName, SDODataBindingTypeMappingEntry> typeMapping =
+ new HashMap<QName, SDODataBindingTypeMappingEntry>();
+ if (!packageRegistry.values().isEmpty()) {
+ ResourceSet resourceSet = DataObjectUtil.createResourceSet();
+
+ // Populate list of GenPackages and a map of GenClasses keyed by EClass
+ List<GenPackage> genPackages = new ArrayList<GenPackage>();
+ Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
+ 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<GenClass>)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<GenClass>)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<EStructuralFeature>)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<String> propertyClassNames=new ArrayList<String>();
+ for (EStructuralFeature feature : (List<EStructuralFeature>)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 <target-root-directory> ]");
+ System.out.println(" [ -javaPackage <java-package-name> ]");
+ System.out.println(" <wsdl-file>");
+ 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 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+
+ <!-- import the databinding template-->
+ <xsl:include href="databindsupporter"/>
+ <!-- import the other templates for databinding
+ Note - these names would be handled by a special
+ URI resolver during the xslt transformations
+ -->
+ <xsl:include href="externalTemplate"/>
+
+
+ <xsl:template match="/interface">
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+
+ /**
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+ package <xsl:value-of select="$package"/>;
+
+ import org.osoa.sca.annotations.Remotable;
+ import org.apache.tuscany.api.annotation.DataType;
+
+ /*
+ * <xsl:value-of select="@name"/> java interface
+ */
+
+ @Remotable
+ @DataType(name="commonj.sdo.DataObject")
+ public interface <xsl:value-of select="@name"></xsl:value-of> {
+ <xsl:for-each select="method">
+ <!-- Code for in-out mep -->
+ <xsl:if test="@mep='12'">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+ <!-- start of the sync block -->
+ <xsl:if test="$isSync='1'">
+ /**
+ * Auto generated method signatures
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ */
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+ <!-- end of the sync block -->
+ </xsl:if>
+
+ <!-- start of the async block -->
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param"><xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ */
+
+ public void start<xsl:value-of select="@name"/>(
+ <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
+ </xsl:if>
+<!-- end of async block-->
+
+ </xsl:if>
+ <!-- Code for in-only mep -->
+ <xsl:if test="@mep='10'">
+
+ <!-- For in-only meps there would not be any asynchronous methods since there is no output -->
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+ </xsl:text></xsl:if></xsl:for-each>
+ */
+ public void
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:if>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- Apply other templates -->
+ //<xsl:apply-templates/>
+ }
+
+
+ </xsl:template>
+ </xsl:stylesheet> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/Account/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/Account/"
+ targetNamespace="http://www.bigbank.com/Account/"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/Account/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.bigbank.com/Account/"
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="org.apache.tuscany.samples.bigbank.account">
+
+ <xsd:element name="getAccountReportWrapped0">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped0Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrapped1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped1Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrappedN">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="customerID2" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrappedNResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportBare0" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare0Response" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Simple" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare1SimpleResponse" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Complex" type="account:AccountRequest"/>
+ <xsd:element name="getAccountReportBare1ComplexResponse" type="account:AccountReport"/>
+
+ <xsd:complexType name="AccountRequest">
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string"/>
+ <xsd:attribute name="accountType" type="xsd:string"/>
+ <xsd:attribute name="balance" type="xsd:float"/>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportWrapped0Request">
+ <wsdl:part element="account:getAccountReportWrapped0" name="getAccountReportWrapped0Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped0Response">
+ <wsdl:part element="account:getAccountReportWrapped0Response" name="getAccountReportWrapped0Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrapped1Request">
+ <wsdl:part element="account:getAccountReportWrapped1" name="getAccountReportWrapped1Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped1Response">
+ <wsdl:part element="account:getAccountReportWrapped1Response" name="getAccountReportWrapped1Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrappedNRequest">
+ <wsdl:part element="account:getAccountReportWrappedN" name="getAccountReportWrappedNRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrappedNResponse">
+ <wsdl:part element="account:getAccountReportWrappedNResponse" name="getAccountReportWrappedNResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare0Request">
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare0Response">
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1SimpleRequest">
+ <wsdl:part element="account:getAccountReportBare1Simple" name="getAccountReportBare1SimpleRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1SimpleResponse">
+ <wsdl:part element="account:getAccountReportBare1SimpleResponse" name="getAccountReportBare1SimpleResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1ComplexRequest">
+ <wsdl:part element="account:getAccountReportBare1Complex" name="getAccountReportBare1ComplexRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1ComplexResponse">
+ <wsdl:part element="account:getAccountReportBare1ComplexResponse" name="getAccountReportBare1ComplexResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Account_Service">
+ <wsdl:operation name="getAccountReportWrapped0">
+ <wsdl:input message="tns:getAccountReportWrapped0Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <wsdl:input message="tns:getAccountReportWrapped1Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped1Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <wsdl:input message="tns:getAccountReportWrappedNRequest"/>
+ <wsdl:output message="tns:getAccountReportWrappedNResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <wsdl:input message="tns:getAccountReportBare0Request"/>
+ <wsdl:output message="tns:getAccountReportBare0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <wsdl:input message="tns:getAccountReportBare1SimpleRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1SimpleResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <wsdl:input message="tns:getAccountReportBare1ComplexRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1ComplexResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:Account_Service">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReportWrapped0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped1"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrappedN"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Simple"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Complex"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:8080/sample-account/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclit/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
+ <xsd:complexType name="CreditReport">
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScoreRequest"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLit">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitSOAP"
+ name="CreditScoreDocLitSOAP">
+ <soap:address location="http://www.example.org/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ xmlns:hello="http://helloworldaxis.samples.tuscany.apache.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="ComplexGreetings">
+ <sequence>
+ <element name="greet1" type="xsd:string"/>
+ <element name="greet2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ <element name="in1" type="xsd:double"/>
+ <element name="in2" type="hello:ComplexGreetings"/>
+ </sequence>
+ <xsd:attribute name="language" type="xsd:string"/>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service -->
+<!--
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+-->
+ <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ <!-- Axis Web Service -->
+ <!--
+ <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc-incubating-M1/services/helloworld"/>
+ -->
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://soapinterop.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/">
+
+ <xsd:element name="SingleTag">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="SingleTag"/>
+ <xsd:element name="SingleTagResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SimpleDocument">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="SimpleDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ComplexDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ComplexDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/>
+ </xsd:sequence>
+ <xsd:attribute name="AnAttribute" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfSimpleDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ChildDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ComplexDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+
+ </types>
+
+ <message name="SingleTagSoapIn">
+ <part name="parameters" element="tns:SingleTag"/>
+ </message>
+ <message name="SingleTagSoapOut">
+ <part name="outputDoc" element="tns:SingleTagResponse"/>
+ </message>
+ <message name="SimpleDocumentSoapIn">
+ <part name="parameters" element="tns:SimpleDocument"/>
+ </message>
+ <message name="SimpleDocumentSoapOut">
+ <part name="outputDoc" element="tns:SimpleDocumentResponse"/>
+ </message>
+ <message name="ComplexDocumentSoapIn">
+ <part name="parameters" element="tns:ComplexDocument"/>
+ </message>
+ <message name="ComplexDocumentSoapOut">
+ <part name="outputDoc" element="tns:ComplexDocumentResponse"/>
+ </message>
+
+ <portType name="DocTestPortType">
+
+ <operation name="SingleTag">
+ <input message="tns:SingleTagSoapIn"/>
+ <output message="tns:SingleTagSoapOut"/>
+ </operation>
+ <operation name="SimpleDocument">
+ <input message="tns:SimpleDocumentSoapIn"/>
+ <output message="tns:SimpleDocumentSoapOut"/>
+ </operation>
+ <operation name="ComplexDocument">
+ <input message="tns:ComplexDocumentSoapIn"/>
+ <output message="tns:ComplexDocumentSoapOut"/>
+ </operation>
+
+ </portType>
+
+ <binding name="doc_test_binding" type="tns:DocTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="SingleTag">
+ <soap:operation soapAction="http://soapinterop.org/SingleTag"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="SimpleDocument">
+ <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="ComplexDocument">
+ <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="interopDocSvc">
+
+ <port name="interopDocPort" binding="tns:doc_test_binding">
+ <soap:address location="http://www.whitemesa.net/interopdoc"/>
+ </port>
+
+ </service>
+
+</definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<xsd:schema xmlns:seq="http://www.example.com/sequences"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/sequences">
+
+ <xsd:element name="mixedStockQuote" type="seq:MixedQuote" />
+ <xsd:element name="rc" type="seq:RepeatingChoice" />
+ <xsd:element name="mrc" type="seq:MixedRepeatingChoice" />
+ <xsd:element name="rc2" type="seq:TwoRCs" />
+ <xsd:element name="mrc2" type="seq:TwoRCsMixed" />
+
+
+
+ <xsd:complexType mixed="true" name="MixedQuote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string" />
+ <xsd:element name="companyName" type="xsd:string" />
+ <xsd:element name="price" type="xsd:decimal" />
+ <xsd:element name="open1" type="xsd:decimal" />
+ <xsd:element name="high" type="xsd:decimal" />
+ <xsd:element name="low" type="xsd:decimal" />
+ <xsd:element name="volume" type="xsd:double" />
+ <xsd:element name="change1" type="xsd:double" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="quotes" type="seq:MixedQuote" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="RepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType mixed="true" name="MixedRepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="TwoRCs">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType mixed="true" name="TwoRCsMixed">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
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 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.tools</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Axis2 Tools</name>
+ <description>Tools for the Axis2 extension</description>
+
+ <repositories>
+ <repository>
+ <!-- temporarily replace the eclipse repo...id>eclipse.emf</id>
+ <url>http://download.eclipse.org/tools/emf/maven2</url -->
+ <id>osuosl.org</id>
+ <url>http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>java2wsdl</module>
+ <module>wsdl2java</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ <version>2.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.tools</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <name>Apache Tuscany Axis2 WSDL2Java Tool</name>
+ <description>Apache Tuscany Axis2 WSDL2Java Tool</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/CreditScoreDocLit.wsdl</schemaFile>
+ <javaPackage>org.example.creditscore.doclit</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 <fully qualified class name> : class file name");
+ System.out.println("-o <output Location> : output file location");
+ System.out.println("-cp <class path uri> : list of classpath entries - (urls)");
+ System.out.println("-tn <target namespace> : target namespace");
+ System.out.println("-tp <target namespace prefix> : target namespace prefix");
+ System.out.println("-stn <schema target namespace> : target namespace for schema");
+ System.out.println("-stp <schema target namespace prefix> : target namespace prefix for schema");
+ System.out.println("-sn <service name> : service name");
+ System.out.println("-of <output file name> : output file name for the WSDL");
+ System.out.println("-st <binding style> : style for the WSDL");
+ System.out.println("-u <binding use> : use for the WSDL");
+ System.out.println("-l <soap address> : address of the port for the WSDL");
+ System.out.println("-ixsd [<schema namespace>, <schema location>] : schemas to be imported (and not generated)");
+ System.out.println("-efd <unqualified> : Setting for elementFormDefault (defaults to qualified)");
+ System.out.println("-afd <unqualified> : Setting for attributeFormDefault (defaults to qualified)");
+ System.out.println("-xc <extra class> : 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<String> generatorClassNames = new Vector<String>();
+
+ /**
+ * @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<WSDLGenListener> genPhaseListeners = new Vector<WSDLGenListener>();
+ private GenerationParameters genParams = null;
+ private Map<String, Java2WSDLCommandLineOption> 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 <String, String> 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. <xs:schema or <xsd:schema. We only know that 'schema' will be used
+ // but not sure what suffix is used. Hence this method to get the actual element name used
+ int i = s.indexOf(SCHEMA_ELEMENT_NAME);
+ int j = s.substring(0,
+ i).lastIndexOf("<");
+ return s.substring(j,
+ i + SCHEMA_ELEMENT_NAME.length());
+ }
+
+ 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/TuscanyJava2OMBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/extensions/axis2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
new file mode 100644
index 0000000000..e58d729981
--- /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/TuscanyJava2OMBuilder.java
@@ -0,0 +1,521 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+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.axiom.om.OMNode;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.codehaus.jam.JMethod;
+
+public class TuscanyJava2OMBuilder implements Java2WSDLConstants {
+
+ private TuscanyTypeTable typeTable = null;
+
+ private static int prefixCount = 1;
+
+ private static final String NAMESPACE_PREFIX = "ns";
+
+ private JMethod method[];
+
+ private Collection schemaCollection;
+
+ private GenerationParameters generationParams;
+
+ private OMNamespace ns1;
+
+ private OMNamespace soap;
+
+ private OMNamespace soap12;
+
+ private OMNamespace tns;
+
+ private OMNamespace wsdl;
+
+ private OMNamespace mime;
+
+ private OMNamespace http;
+
+ public TuscanyJava2OMBuilder(JMethod[] method,
+ Collection schemaCollection,
+ TuscanyTypeTable typeTab,
+ GenerationParameters genParams) {
+ this.method = method;
+ this.schemaCollection = schemaCollection;
+ this.typeTable = typeTab;
+ this.generationParams = genParams;
+ }
+
+ public OMElement generateOM() throws Exception {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
+ DEFAULT_WSDL_NAMESPACE_PREFIX);
+ OMElement ele = fac.createOMElement("definitions",
+ wsdl);
+
+ ele.addAttribute("targetNamespace",
+ generationParams.getTargetNamespace(),
+ null);
+ generateNamespaces(fac,
+ ele);
+ generateTypes(fac,
+ ele);
+ generateMessages(fac,
+ ele);
+ generatePortType(fac,
+ ele);
+ generateBinding(fac,
+ ele);
+ generateService(fac,
+ ele);
+ return ele;
+ }
+
+ private void generateNamespaces(OMFactory fac, OMElement defintions) throws Exception {
+ soap = defintions.declareNamespace(URI_WSDL11_SOAP,
+ SOAP11_PREFIX);
+ tns = defintions.declareNamespace(generationParams.getTargetNamespace(),
+ generationParams.getTargetNamespacePrefix());
+ soap12 = defintions.declareNamespace(URI_WSDL12_SOAP,
+ SOAP12_PREFIX);
+ http = defintions.declareNamespace(HTTP_NAMESPACE,
+ HTTP_PREFIX);
+ mime = defintions.declareNamespace(MIME_NAMESPACE,
+ MIME_PREFIX);
+ }
+
+ private void generateTypes(OMFactory fac, OMElement defintions) throws Exception {
+ OMElement wsdlTypes = fac.createOMElement("types",
+ wsdl);
+ StringWriter writer = new StringWriter();
+
+ // wrap the Schema elements with this start and end tags to create a
+ // document root
+ // under which the schemas can fall into
+ writer.write("<xmlSchemas>");
+ writeSchemas(writer);
+ writer.write("</xmlSchemas>");
+
+ 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<String> 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<String> parseName(String sourceName, char separator) {
+ List<String> result = new ArrayList<String>();
+ 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<typeMappings.size(); i++) {
+ Element param = doc.createElement("param");
+ parameterElementList.add(param);
+
+ String typeMapping = (String)typeMappings.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(message.getElementQName()), param);
+ addAttribute(doc, "type", (typeMapping == null)
+ ? ""
+ : typeMapping, param);
+
+ // add an extra attribute to say whether the type mapping is the default
+ // if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMapping)) {
+ if (typeMapper.getDefaultMappingName().equals(typeMapping)) {
+
+ addAttribute(doc, "default", "yes", param);
+ }
+
+ addAttribute(doc, "value", null, param);
+
+ // add this as a body parameter
+ addAttribute(doc, "location", "body", param);
+
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ public List getParameterElementList(Document doc, List parameters, String location) {
+ List parameterElementList = new ArrayList();
+
+ if ((parameters != null) && !parameters.isEmpty()) {
+ int count = parameters.size();
+
+ for (int i = 0; i < count; i++) {
+ Element param = doc.createElement("param");
+ QName name = (QName) parameters.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(name), param);
+
+ String typeMapping = this.typeMapper.getTypeMappingName(name);
+ String typeMappingStr = (typeMapping == null)
+ ? ""
+ : typeMapping;
+
+ addAttribute(doc, "type", typeMappingStr, param);
+ addAttribute(doc, "location", location, param);
+ parameterElementList.add(param);
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ protected boolean isWrapped(AxisOperation operation) {
+ boolean wrapped = false;
+
+ if (isInputPresentForMEP(operation.getMessageExchangePattern())) {
+ QName qname = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getElementQName();
+ if (qname != null && qname.getLocalPart().equals(operation.getName().getLocalPart())) {
+
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(qname);
+ if (typeMappingEntry.isAnonymous()) {
+ wrapped = true;
+ }
+ }
+ }
+
+ return wrapped;
+ }
+
+ private boolean isInputPresentForMEP(String MEP) {
+
+
+ return
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2004Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.endsWith(MEP);
+
+
+
+
+ }
+
+ protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "input", operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getOutputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "output", operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getElement(Document doc, String elementName, AxisMessage message, boolean wrapped, List headerParameterQNameList) {
+ Element element = doc.createElement(elementName);
+
+ List parameterElementList = getParameterElementList(doc, message, wrapped);
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ element.appendChild((Element) parameterElementList.get(i));
+ }
+
+ List outputElementList = getParameterElementList(doc, headerParameterQNameList, "header");
+
+ for (int i = 0; i < outputElementList.size(); i++) {
+ element.appendChild((Element) outputElementList.get(i));
+ }
+
+ return element;
+ }
+
+ protected void writeInterface(boolean writeDatabinders) throws Exception {
+ Document interfaceModel = createDOMDocumentForInterface(writeDatabinders);
+ if (!codegenConfiguration.getOutputLocation().exists()) {
+ codegenConfiguration.getOutputLocation().mkdirs();
+ }
+ InterfaceWriter interfaceWriter = new RemotableInterfaceWritter(this.codegenConfiguration
+ .getOutputLocation(), this.codegenConfiguration.getOutputLanguage());
+
+ String packageName = interfaceModel.getDocumentElement().getAttribute("package");
+ String className = interfaceModel.getDocumentElement().getAttribute("name");
+
+ System.out.println(">> 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<CodeGenConfiguration> codegenConfigurations= new LinkedList<CodeGenConfiguration>();
+
+
+
+
+ public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName,
+ Map<QName, SDODataBindingTypeMappingEntry> 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<QName> donePortTypes= new HashSet<QName>();
+
+ 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<QName, SDODataBindingTypeMappingEntry> 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
+ // <lang-name>.* .template=<write-class>,<template-name>
+
+ //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<String> propertyClassNames;
+ private final String className;
+
+ public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List<String> propertyClassNames) {
+ this.className = className;
+ this.anonymous = anonymous;
+ this.propertyClassNames = propertyClassNames;
+ }
+
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public List<String> 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
+ * <target-root-directory> ] [ -javaPackage <java-package-name> ]
+ * <wsdl-file> 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<QName, SDODataBindingTypeMappingEntry> typeMapping =
+ new HashMap<QName, SDODataBindingTypeMappingEntry>();
+ if (!packageRegistry.values().isEmpty()) {
+ ResourceSet resourceSet = DataObjectUtil.createResourceSet();
+
+ // Populate list of GenPackages and a map of GenClasses keyed by EClass
+ List<GenPackage> genPackages = new ArrayList<GenPackage>();
+ Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
+ 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<GenClass>)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<GenClass>)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<EStructuralFeature>)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<String> propertyClassNames=new ArrayList<String>();
+ for (EStructuralFeature feature : (List<EStructuralFeature>)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 <target-root-directory> ]");
+ System.out.println(" [ -javaPackage <java-package-name> ]");
+ System.out.println(" [ -dynamicSDO ]");
+ System.out.println(" <wsdl-file>");
+ 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 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+
+ <!-- import the databinding template-->
+ <xsl:include href="databindsupporter"/>
+ <!-- import the other templates for databinding
+ Note - these names would be handled by a special
+ URI resolver during the xslt transformations
+ -->
+ <xsl:include href="externalTemplate"/>
+
+
+ <xsl:template match="/interface">
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+
+ /**
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+ package <xsl:value-of select="$package"/>;
+
+ import org.osoa.sca.annotations.Remotable;
+ import org.apache.tuscany.api.annotation.DataType;
+
+ /*
+ * <xsl:value-of select="@name"/> java interface
+ */
+
+ @Remotable
+ @DataType(name="commonj.sdo.DataObject")
+ public interface <xsl:value-of select="@name"></xsl:value-of> {
+ <xsl:for-each select="method">
+ <!-- Code for in-out mep -->
+ <xsl:if test="@mep='12'">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+ <!-- start of the sync block -->
+ <xsl:if test="$isSync='1'">
+ /**
+ * Auto generated method signatures
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ */
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+ <!-- end of the sync block -->
+ </xsl:if>
+
+ <!-- start of the async block -->
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param"><xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ */
+
+ public void start<xsl:value-of select="@name"/>(
+ <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
+ </xsl:if>
+<!-- end of async block-->
+
+ </xsl:if>
+ <!-- Code for in-only mep -->
+ <xsl:if test="@mep='10'">
+
+ <!-- For in-only meps there would not be any asynchronous methods since there is no output -->
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+ </xsl:text></xsl:if></xsl:for-each>
+ */
+ public void
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:if>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- Apply other templates -->
+ //<xsl:apply-templates/>
+ }
+
+
+ </xsl:template>
+ </xsl:stylesheet> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/Account/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/Account/"
+ targetNamespace="http://www.bigbank.com/Account/"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/Account/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.bigbank.com/Account/"
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="org.apache.tuscany.samples.bigbank.account">
+
+ <xsd:element name="getAccountReportWrapped0">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped0Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrapped1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrapped1Response">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportWrappedN">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="customerID2" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportWrappedNResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport" type="account:AccountReport"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportBare0" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare0Response" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Simple" type="xsd:string"/>
+ <xsd:element name="getAccountReportBare1SimpleResponse" type="xsd:int"/>
+
+ <xsd:element name="getAccountReportBare1Complex" type="account:AccountRequest"/>
+ <xsd:element name="getAccountReportBare1ComplexResponse" type="account:AccountReport"/>
+
+ <xsd:complexType name="AccountRequest">
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string"/>
+ <xsd:attribute name="accountType" type="xsd:string"/>
+ <xsd:attribute name="balance" type="xsd:float"/>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportWrapped0Request">
+ <wsdl:part element="account:getAccountReportWrapped0" name="getAccountReportWrapped0Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped0Response">
+ <wsdl:part element="account:getAccountReportWrapped0Response" name="getAccountReportWrapped0Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrapped1Request">
+ <wsdl:part element="account:getAccountReportWrapped1" name="getAccountReportWrapped1Request"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrapped1Response">
+ <wsdl:part element="account:getAccountReportWrapped1Response" name="getAccountReportWrapped1Response"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportWrappedNRequest">
+ <wsdl:part element="account:getAccountReportWrappedN" name="getAccountReportWrappedNRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportWrappedNResponse">
+ <wsdl:part element="account:getAccountReportWrappedNResponse" name="getAccountReportWrappedNResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare0Request">
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare0Response">
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1SimpleRequest">
+ <wsdl:part element="account:getAccountReportBare1Simple" name="getAccountReportBare1SimpleRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1SimpleResponse">
+ <wsdl:part element="account:getAccountReportBare1SimpleResponse" name="getAccountReportBare1SimpleResponse"/>
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportBare1ComplexRequest">
+ <wsdl:part element="account:getAccountReportBare1Complex" name="getAccountReportBare1ComplexRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportBare1ComplexResponse">
+ <wsdl:part element="account:getAccountReportBare1ComplexResponse" name="getAccountReportBare1ComplexResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Account_Service">
+ <wsdl:operation name="getAccountReportWrapped0">
+ <wsdl:input message="tns:getAccountReportWrapped0Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <wsdl:input message="tns:getAccountReportWrapped1Request"/>
+ <wsdl:output message="tns:getAccountReportWrapped1Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <wsdl:input message="tns:getAccountReportWrappedNRequest"/>
+ <wsdl:output message="tns:getAccountReportWrappedNResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <wsdl:input message="tns:getAccountReportBare0Request"/>
+ <wsdl:output message="tns:getAccountReportBare0Response"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <wsdl:input message="tns:getAccountReportBare1SimpleRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1SimpleResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <wsdl:input message="tns:getAccountReportBare1ComplexRequest"/>
+ <wsdl:output message="tns:getAccountReportBare1ComplexResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:Account_Service">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReportWrapped0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrapped1">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrapped1"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportWrappedN">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportWrappedN"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare0">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare0"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Simple">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Simple"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getAccountReportBare1Complex">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReportBare1Complex"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:8080/sample-account/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclit/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
+ <xsd:complexType name="CreditReport">
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScoreRequest"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLit">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitSOAP"
+ name="CreditScoreDocLitSOAP">
+ <soap:address location="http://www.example.org/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ xmlns:hello="http://helloworldaxis.samples.tuscany.apache.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="ComplexGreetings">
+ <sequence>
+ <element name="greet1" type="xsd:string"/>
+ <element name="greet2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ <element name="in1" type="xsd:double"/>
+ <element name="in2" type="hello:ComplexGreetings"/>
+ </sequence>
+ <xsd:attribute name="language" type="xsd:string"/>
+ </complexType>
+ </element>
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+
+ <wsdl:part element="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getGreetingsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getGreetingsResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service -->
+<!--
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+-->
+ <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ <!-- Axis Web Service -->
+ <!--
+ <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc-incubating-M1/services/helloworld"/>
+ -->
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://soapinterop.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/">
+
+ <xsd:element name="SingleTag">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="SingleTag"/>
+ <xsd:element name="SingleTagResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SimpleDocument">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="SimpleDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ComplexDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ComplexDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/>
+ </xsd:sequence>
+ <xsd:attribute name="AnAttribute" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfSimpleDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ChildDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ComplexDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+
+ </types>
+
+ <message name="SingleTagSoapIn">
+ <part name="parameters" element="tns:SingleTag"/>
+ </message>
+ <message name="SingleTagSoapOut">
+ <part name="outputDoc" element="tns:SingleTagResponse"/>
+ </message>
+ <message name="SimpleDocumentSoapIn">
+ <part name="parameters" element="tns:SimpleDocument"/>
+ </message>
+ <message name="SimpleDocumentSoapOut">
+ <part name="outputDoc" element="tns:SimpleDocumentResponse"/>
+ </message>
+ <message name="ComplexDocumentSoapIn">
+ <part name="parameters" element="tns:ComplexDocument"/>
+ </message>
+ <message name="ComplexDocumentSoapOut">
+ <part name="outputDoc" element="tns:ComplexDocumentResponse"/>
+ </message>
+
+ <portType name="DocTestPortType">
+
+ <operation name="SingleTag">
+ <input message="tns:SingleTagSoapIn"/>
+ <output message="tns:SingleTagSoapOut"/>
+ </operation>
+ <operation name="SimpleDocument">
+ <input message="tns:SimpleDocumentSoapIn"/>
+ <output message="tns:SimpleDocumentSoapOut"/>
+ </operation>
+ <operation name="ComplexDocument">
+ <input message="tns:ComplexDocumentSoapIn"/>
+ <output message="tns:ComplexDocumentSoapOut"/>
+ </operation>
+
+ </portType>
+
+ <binding name="doc_test_binding" type="tns:DocTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="SingleTag">
+ <soap:operation soapAction="http://soapinterop.org/SingleTag"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="SimpleDocument">
+ <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="ComplexDocument">
+ <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="interopDocSvc">
+
+ <port name="interopDocPort" binding="tns:doc_test_binding">
+ <soap:address location="http://www.whitemesa.net/interopdoc"/>
+ </port>
+
+ </service>
+
+</definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<xsd:schema xmlns:seq="http://www.example.com/sequences"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.com/sequences">
+
+ <xsd:element name="mixedStockQuote" type="seq:MixedQuote" />
+ <xsd:element name="rc" type="seq:RepeatingChoice" />
+ <xsd:element name="mrc" type="seq:MixedRepeatingChoice" />
+ <xsd:element name="rc2" type="seq:TwoRCs" />
+ <xsd:element name="mrc2" type="seq:TwoRCsMixed" />
+
+
+
+ <xsd:complexType mixed="true" name="MixedQuote">
+ <xsd:sequence>
+ <xsd:element name="symbol" type="xsd:string" />
+ <xsd:element name="companyName" type="xsd:string" />
+ <xsd:element name="price" type="xsd:decimal" />
+ <xsd:element name="open1" type="xsd:decimal" />
+ <xsd:element name="high" type="xsd:decimal" />
+ <xsd:element name="low" type="xsd:decimal" />
+ <xsd:element name="volume" type="xsd:double" />
+ <xsd:element name="change1" type="xsd:double" />
+ <xsd:element maxOccurs="unbounded" minOccurs="0"
+ name="quotes" type="seq:MixedQuote" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="RepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType mixed="true" name="MixedRepeatingChoice">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="TwoRCs">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType mixed="true" name="TwoRCsMixed">
+ <xsd:sequence>
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="a" type="xsd:string" />
+ <xsd:element name="b" type="xsd:int" />
+ </xsd:choice>
+
+ <xsd:element name="split" type="xsd:string" />
+
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="y" type="xsd:string" />
+ <xsd:element name="z" type="xsd:int" />
+ </xsd:choice>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jms</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-jms</artifactId>
+ <name>Apache Tuscany Binding for JMS</name>
+ <description>Implementation of the SCA JMS Binding</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-jms</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-j2ee-management</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
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<JMSBindingDefinition> {
+
+ 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<JMSBindingDefinition> 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 <binding.jms> elements based on the 0.96 draft 1 spec.
+ */
+@Scope("COMPOSITE")
+public class JMSBindingLoader extends LoaderExtension<JMSBindingDefinition> {
+
+ public static final QName BINDING_JMS =
+ new QName(SCA_NS, "binding.jms");
+
+ public static final List<String> 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<T> extends TransformerExtension<T, T> implements PullTransformer<T, T> {
+
+ 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<Object[]> {
+
+ 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<Object[]> {
+
+ 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<Object> {
+
+ /**
+ * @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<Object> {
+ /**
+ * @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 @@
+<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
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 @@
+<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jms">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jms</group>
+ <name>tuscany-jms</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="jms.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingLoader" />
+ </component>
+
+ <component name="jms.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.JMSBindingBuilder" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.JmsInput2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsInput2InputTransformer" />
+ </component>
+
+ <component name="transformer.JmsOutput2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.JmsOutput2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Input2JmsInputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Input2JmsInputTransformer" />
+ </component>
+
+ <component name="transformer.Output2JmsOutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.binding.jms.databinding.Output2JmsOutputTransformer" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing pejmsssions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.binding.jms">
+ <include name="org.apache.tuscany.binding.jms.include" scdlLocation="binding.jms.scdl" />
+</composite> \ 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 = "<binding.jms></binding.jms>";
+ XMLStreamReader reader = createReader(xml);
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertNotNull(jmsBinding);
+ }
+
+ public void testCorrelationScheme() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader =
+ createReader("<binding.jms correlationScheme=\"RequestMsgIDToCorrelID\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("RequestMsgIDToCorrelID", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"RequestCorrelIDToCorrelID\"></binding.jms>");
+ jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("RequestCorrelIDToCorrelID", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"none\"></binding.jms>");
+ jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("none", jmsBinding.getCorrelationScheme());
+
+ reader = createReader("<binding.jms correlationScheme=\"xxx\"></binding.jms>");
+ 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("<binding.jms><destination name=\"foo\"/></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("foo", jmsBinding.getDestinationName());
+ }
+
+ public void testInitialContextFactory() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms initialContextFactory=\"myicf\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myicf", jmsBinding.getInitialContextFactoryName());
+ }
+
+ public void testJNDIProviderURL() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms JNDIProviderURL=\"myURL\"></binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myURL", jmsBinding.getJNDIProviderURL());
+ }
+
+ public void testConnectionFactory() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms> <connectionFactory name=\"myfactory\"/> </binding.jms>");
+ JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
+ assertEquals("myfactory", jmsBinding.getConnectionFactoryName());
+ }
+
+ public void testActivationSpec() throws LoaderException, XMLStreamException {
+ XMLStreamReader reader = createReader("<binding.jms> <activationSpec name=\"myas\"/></binding.jms>");
+ 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 = "<xxx xmlns=\"" + SCA_NS + "\">" + xml + "</xxx>";
+ 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 =
+ "<ns:getGreetings xmlns:ns=\"http://helloworld\"><ns:name>petra</ns:name></ns:getGreetings>";
+ protected static final String REPLY_XML =
+ "<ns1:getGreetingsResponse xmlns:ns1=\"http://helloworld\"><ns1:getGreetingsReturn>Hello petra</ns1:getGreetingsReturn></ns1:getGreetingsResponse>";
+
+ 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 @@
+ <!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="jms.sample">
+
+ <service name="GreetingJMSService">
+ <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="greetingServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ <reference>GretingServiceComponent</reference>
+ </service>
+
+ <component name="GretingServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.GreetingServiceImpl"/>
+ </component>
+
+ <component name="IntroServiceComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.IntroServiceImpl"/>
+ <reference name="extService" target="GreetingJMSReference">GreetingJMSReference</reference>
+ </component>
+
+ <reference name="GreetingJMSReference">
+ <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="dynamicQueues/greetingServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ </reference>
+
+ <service name="HelloworldJMSService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="HelloworldServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ <reference>HelloworldComponent</reference>
+ </service>
+
+ <component name="HelloworldComponent">
+ <implementation.java class="org.apache.tuscany.binding.jms.HelloworldServiceImpl"/>
+ </component>
+
+</composite>
+
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsCallback">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsCallback">
+ <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="HelloWorldCallback">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-async-1.0-incubator-SNAPSHOT/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.jms</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany JMS Extension</name>
+
+ <modules>
+ <module>binding</module>
+ <module>samples</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>3.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-jms</artifactId>
+ <version>1.1-rc4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-j2ee-management</artifactId>
+ <version>1.0-rc4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jms.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworld-jmsReference</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany JMS Reference Helloworld Sample</name>
+ <description>A helloworld sample using a JMS Reference</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.jms</groupId>
+ <artifactId>tuscany-jms</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldJmsClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldJmsClientComposite">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ <reference name="extService">HelloWorldJmsService</reference>
+ </component>
+
+ <reference name="HelloWorldJmsService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="dynamicQueues/HelloWorldServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ </reference>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jms.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworld-jmsService</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany JMS Service Helloworld Sample</name>
+ <description>A helloworld sample hosting JMS Service</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.jms</groupId>
+ <artifactId>tuscany-jms</artifactId>
+ <version>${extensionVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldJmsServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldJmsServiceComposite">
+
+ <service name="HelloWorldJmsService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory" JNDIProviderURL="tcp://localhost:61616" >
+ <destination name="HelloWorldServiceQueue" />
+ <connectionFactory name="ConnectionFactory" />
+ </binding.jms>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jms</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.jms.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the JMS extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>helloworld.jmsService</module>
+ <module>helloworld.jmsReference</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jsonrpc</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-jsonrpc</artifactId>
+ <name>Apache Tuscany Binding for JSON-RPC</name>
+ <description>Implementation of the SCA JSON-RPC Binding</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.metaparadigm</groupId>
+ <artifactId>json-rpc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
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<JSONRPCBindingDefinition> {
+
+ 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<JSONRPCBindingDefinition> 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 <binding.jsonrpc> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class JSONRPCBindingLoader extends LoaderExtension<JSONRPCBindingDefinition> {
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jsonrpc.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jsonrpc</group>
+ <name>tuscany-jsonrpc</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="binding.jsonrpc.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jsonrpc.JSONRPCBindingLoader"/>
+ </component>
+
+ <component name="binding.jsonrpc.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jsonrpc.JSONRPCBindingBuilder"/>
+ </component>
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.jsonrpc">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.jsonrpc</group>
+ <name>tuscany-jsonrpc</name>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <component name="binding.jsonrpc.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.jsonrpc.JSONRPCBindingLoader"/>
+ </component>
+
+ <component name="binding.jsonrpc.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.jsonrpc.JSONRPCBindingBuilder"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing pejsonrpcssions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.binding.jsonrpc">
+ <include name="org.apache.tuscany.binding.jsonrpc.include" scdlLocation="binding.jsonrpc.scdl" />
+</composite> \ 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<arguments.length;i++) args.push(arguments[i]);
+ if(typeof args[0] == "function") callback = args.shift();
+ var req = fn.client._makeRequest.call(fn.client, fn.methodName,
+ args, callback);
+ if(callback == null) {
+ return fn.client._sendRequest.call(fn.client, req);
+ } else {
+ JSONRpcClient.async_requests.push(req);
+ JSONRpcClient.kick_async();
+ return req.requestId;
+ }
+ };
+ fn.client = this;
+ fn.methodName = methodName;
+ return fn;
+};
+
+JSONRpcClient.prototype._addMethods =
+function JSONRpcClient_addMethods(methodNames)
+{
+ for(var i=0; i<methodNames.length; i++) {
+ var obj = this;
+ var names = methodNames[i].split(".");
+ for(var n=0; n<names.length-1; n++) {
+ var name = names[n];
+ if(obj[name]) {
+ obj = obj[name];
+ } else {
+ obj[name] = new Object();
+ obj = obj[name];
+ }
+ }
+ var name = names[names.length-1];
+ if(!obj[name]) {
+ var method = this._createMethod(methodNames[i]);
+ obj[name] = method;
+ }
+ }
+};
+
+JSONRpcClient._getCharsetFromHeaders =
+function JSONRpcClient_getCharsetFromHeaders(http)
+{
+ try {
+ var contentType = http.getResponseHeader("Content-type");
+ var parts = contentType.split(/\s*;\s*/);
+ for(var i =0; i < parts.length; i++) {
+ if(parts[i].substring(0, 8) == "charset=")
+ return parts[i].substring(8, parts[i].length);
+ }
+ } catch (e) {}
+ return "UTF-8"; /* default */
+};
+
+/* Async queue globals */
+JSONRpcClient.async_requests = [];
+JSONRpcClient.async_inflight = {};
+JSONRpcClient.async_responses = [];
+JSONRpcClient.async_timeout = null;
+JSONRpcClient.num_req_active = 0;
+
+JSONRpcClient._async_handler =
+function JSONRpcClient_async_handler()
+{
+ JSONRpcClient.async_timeout = null;
+
+ while(JSONRpcClient.async_responses.length > 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<String, JSONObject> hashMethods = new HashMap<String, JSONObject>();
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.jsonrpc</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Extensions for JSONRPC</name>
+
+ <modules>
+ <module>binding</module>
+ <module>samples</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>com.metaparadigm</groupId>
+ <artifactId>json-rpc</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>0.8</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project name="DojoZipInstaller">
+
+
+ <property name="dojo.version" value="0.4.0"/>
+ <property name="dojo.distro" value="ajax"/>
+ <property name="unpack.location" value="${basedir}/src/main/webapp/dojo"/>
+
+
+ <target name="check-dojo-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/dojo/dojo-${dojo.distro}/${dojo.version}/dojo-${dojo.distro}-${dojo.version}.zip"/>
+ </condition>
+ <condition property="maven.suffix" value="">
+ <os family="unix"/>
+ </condition>
+ <condition property="maven.suffix" value=".bat">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+
+ <target name="check-dojo-unpacked">
+ <condition property="already.unpacked" >
+ <available file="${unpack.location}"/>
+ </condition>
+ </target>
+
+ <target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-${dojo.version}-${dojo.distro}.zip"
+ dest="${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo-${dojo.distro} -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"/>
+ </exec>
+ </target>
+
+
+ <target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
+ <fail message="dojo zip file not installed in local repository" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo-${dojo.distro}/${dojo.version}/dojo-${dojo.distro}-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-${dojo.version}-${dojo.distro}/**"/>
+ <exclude name="dojo-${dojo.version}-${dojo.distro}/demos/**"/>
+ <exclude name="dojo-${dojo.version}-${dojo.distro}/tests/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}-${dojo.distro}"
+ tofile="${unpack.location}"
+ verbose="true"/>
+ <delete dir="${basedir}/target/dojo-unpack-temp/"/>
+ </target>
+
+
+ <target name="clean-dojo-files">
+ <delete dir="${unpack.location}"/>
+ </target>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jsonrpc.samples</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>sample-helloworldjsonrpc</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany HelloWorld JSON-RPC Sample</name>
+ <description>A sample HelloWorld Web application using JSON-RPC</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>sample-helloworldjsonrpc</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant target="install-dojo">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-dojo-files</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clean-dojo-files</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<html>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+ <head>
+ <title>Tuscany JSON-RPC HelloWorld Example</TITLE>
+
+ <script type="text/javascript">
+ var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ //djConfig.debugAtAllCosts = true;
+ </script>
+
+ <script type="text/javascript" src="services/SCA/scripts"></script>
+
+ <script language="JavaScript">
+ SCA = new JSONRpcClient("services/HelloWorldJSONService");
+
+ function getGreeting() {
+ var name = document.getElementById("name").value;
+ var result = SCA.HelloWorldJSONService.getGreetings(name);
+ document.getElementById('greeting').innerHTML=result;
+ }
+ </script>
+
+ <script type="text/javascript" src="dojo/dojo.js">
+ </script>
+
+ <script type="text/javascript">
+ dojo.require("dojo.widget.*");
+ dojo.require("dojo.widget.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ </head>
+
+ <body>
+
+ <h2>Tuscany JSON-RPC HelloWorld Examples</h2>
+
+ <table>
+ <tr>
+ <th colspan="2">Non-Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ This example uses the JavaScript served from
+ <a href="services/SCA/scripts">services/SCA/scripts</a>
+ to make JSON-RPC requests to the service located at
+ <a href="services/HelloWorldJSONService">services/HelloWorldJSONService</a>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ Name please: &nbsp;&nbsp;&nbsp;
+ <input type="text" id="name" size="30" value="World" />
+ <input type="button" value="Submit" onclick="getGreeting()" />
+ </p>
+
+ </td>
+ <td>
+ <div id='greeting'>None Yet.</div>
+ </td>
+ </tr>
+ </table>
+
+ <br/>
+
+ <table>
+ <tr>
+ <th colspan="2">Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p>This example uses the <a href="http://dojotoolkit.org/">Dojo Toolkit</a>
+ to create a JavaScript object <code>helloWorldService</code> for the service at
+ <a href="services/HelloWorldJSONService">services/HelloWorldJSONService</a>
+ using <a href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's RPC classes</a>
+ and providing them with <a href="services/HelloWorldJSONService?smd">services/HelloWorldJSONService?smd</a>
+ for <a href="http://dojo.jot.com/SMD">Simple Method Description (SMD)</a> input.</p>
+ <p>It then creates a Dojo button that will envoke the <code>getGreetings</code> method of the <code>helloWorldService</code> object.</p>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td>
+ <br><div id="myecho" dojoType="Button" onClick='helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);'>helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);</div><br>
+ </td>
+ <td>
+ <div id="ReturnedContent">None Yet.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="dojoDebug">Dojo Debug:</div>
+ </td>
+ </tr>
+ </table>
+
+
+
+
+ <script type="text/javascript">
+
+ function contentCallBack(result) {
+ var handlerNode = document.getElementById("ReturnedContent");
+ handlerNode.innerHTML = "<p>" + result + "</p>" ;
+ }
+
+ var helloWorldService = new dojo.rpc.JsonService("services/HelloWorldJSONService?smd");
+
+ </script>
+
+ </body>
+</html>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworldjsonrpc">
+
+ <service name="HelloWorldJSONService">
+ <interface.java interface="helloworldjsonrpc.HelloWorldService"/>
+ <binding.jsonrpc/>
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworldjsonrpc.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+ <display-name>Tuscany sample HelloWorld JSON-RPC</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>HelloWorldJSONRPC.html</welcome-file>
+ </welcome-file-list>
+
+ <context-param>
+ <param-name>tuscany.online</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions.jsonrpc</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.jsonrpc.samples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Samples for the JSONRPC extension</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>standalone</artifactId>
+ <version>${scaImplVersion}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/distribution</outputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Extensions</name>
+
+ <properties>
+ <extensionVersion>0.1-integration-incubating-SNAPSHOT</extensionVersion>
+ <scaKernelVersion>0.1-integration-incubating-SNAPSHOT</scaKernelVersion>
+ <scaImplVersion>0.1-integration-incubating-SNAPSHOT</scaImplVersion>
+ <specVersion>1.0</specVersion>
+ <scaVersion>0.1-integration-incubating-SNAPSHOT</scaVersion>
+ <sdoVersion>1.0-incubator-SNAPSHOT</sdoVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <!-- default profile -->
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>axis2</module>
+ <module>jms</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>axis2</module>
+ <module>script</module>
+ <module>jms</module>
+ <module>jsonrpc</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>axis2</module>
+ <module>script</module>
+ <module>jms</module>
+ <module>jsonrpc</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-bsf</artifactId>
+ <name>Apache Tuscany Script Container</name>
+ <description>Apache Tuscany Script Container using BSF</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>bsf</groupId>
+ <artifactId>bsf</artifactId>
+ <version>2.4.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
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<ScriptImplementation> {
+
+ public ScriptComponentBuilder() {
+ }
+
+ protected Class<ScriptImplementation> getImplementationType() {
+ return ScriptImplementation.class;
+ }
+
+ public Component build(CompositeComponent parent, ComponentDefinition<ScriptImplementation> 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<ScriptImplementation> 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<ServiceDefinition, ReferenceDefinition, Property<?>> {
+
+ public ScriptComponentType() {
+ this.implementationScope = Scope.COMPOSITE;
+ }
+
+ @Override
+ public Property getProperty(String name) {
+ Property p = super.getProperty(name);
+ if (p == null) {
+ p = new Property<Object>(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<ScriptImplementation> {
+
+ public ScriptComponentTypeLoader() {
+ }
+
+ @Override
+ protected Class<ScriptImplementation> 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<ScriptComponentType> {
+
+ 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.
+ * <p/>
+ * <implementation.script script="path/foo.py" class="myclass">
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScriptImplementationLoader extends LoaderExtension<ScriptImplementation> {
+
+ 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<ScriptInstance> {
+ protected String resourceName;
+ protected ClassLoader classLoader;
+ private String className;
+ private String scriptSource;
+ private Map<String, ObjectFactory> contextObjects;
+ private Map<String, Class> 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<String, ObjectFactory>();
+ this.contextTypes = new HashMap<String, Class>();
+ }
+
+ /**
+ * Create a new invokeable instance of the script <p/> objects to add to
+ * scope of the script instance
+ *
+ * @return a RhinoScriptInstance
+ */
+ // public ScriptInstanceImpl createInstance(List<Class<?>> serviceBindings,
+ // Map<String, Object> 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<String, ObjectFactory> 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<String, ObjectFactory> 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<String, Class> getResponseClasses(List<Class> services) {
+ Map<String, Class> responseClasses = new HashMap<String, Class>();
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentBuilder"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing peaxis2ssions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.extension.bsf">
+ <include name="org.apache.tuscany.extensions.bsf.include" scdlLocation="script.system.scdl" />
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.container.script.ScriptImplementation">
+
+ <component name="script.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationLoader"/>
+ </component>
+
+ <component name="script.implementationRubyLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationRubyLoader"/>
+ </component>
+
+ <component name="script.implementationPythonLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationPythonLoader"/>
+ </component>
+
+ <component name="script.implementationJavaScriptLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptImplementationJavaScriptLoader"/>
+ </component>
+
+ <component name="script.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="script.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.script.ScriptComponentBuilder"/>
+ </component>
+
+</composite>
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<ScriptImplementation> impl =
+ new ComponentDefinition<ScriptImplementation>(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<String> pv = new PropertyValue<String>("foo", "", "");
+ ObjectFactory<String> pvFactory = (ObjectFactory<String>) 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<ScriptImplementation> impl =
+ new ComponentDefinition<ScriptImplementation>(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<Type> operation = new Operation<Type>("hashCode", null, null, null, false, null, NO_CONVERSATION);
+ operation.setServiceContract(new Contract<Type>(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<T> extends ServiceContract<T> {
+
+ 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<String, Class> 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<Object> {
+ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="not.used"/>
+ </service>
+
+</componentType>
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 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="not.used"/>
+ </service>
+
+</componentType>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-e4x</artifactId>
+ <name>Apache Tuscany JavaScript E4X DataBinding</name>
+ <description>Apache Tuscany JavaScript E4X DataBinding</description>
+
+ <repositories>
+ <!-- This is for the WSO2 Rhino core build until Rhino cuts a new release -->
+ <repository>
+ <id>wso2-thilina</id>
+ <url>http://www-lk.wso2.com/~thilina/repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <layout>legacy</layout>
+ </repository>
+
+ <!-- This is for the WSO2 E4X impl -->
+ <repository>
+ <id>wso2</id>
+ <url>http://dist.wso2.org/maven</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mozilla.javascript</groupId>
+ <artifactId>js-core</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.wso2.javascript.rhino</groupId>
+ <artifactId>js-axiom</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
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<XML, OMElement> implements PullTransformer<XML, OMElement> {
+
+ 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<XML> {
+
+ 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<XML> {
+
+ 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<Object> elements = new ArrayList<Object>();
+ 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<OMElement, XML> implements PullTransformer<OMElement, XML> {
+
+ 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<XML> {
+
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- This is the copy ot be included by other extensions -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.extensions.script.databinding.e4x.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.script</group>
+ <name>databinding-e4x</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.e4x">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4XDataBinding" />
+ </component>
+
+ <component name="transformer.E4X2OMElement">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.OMElement2E4X" />
+ </component>
+
+ <component name="transformer.Object2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.Object2E4X" />
+ </component>
+
+ <component name="transformer.E4X2Object">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2Object" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- This is the copy ot be included by other extensions -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.extensions.script.databinding.e4x.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.extensions.script</group>
+ <name>databinding-e4x</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.e4x">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4XDataBinding" />
+ </component>
+
+ <component name="transformer.E4X2OMElement">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.OMElement2E4X" />
+ </component>
+
+ <component name="transformer.Object2E4X">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.Object2E4X" />
+ </component>
+
+ <component name="transformer.E4X2Object">
+ <system:implementation.system class="org.apache.tuscany.extensions.script.databinding.e4x.E4X2Object" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.e4x">
+ <include name="org.apache.tuscany.databinding.e4x.include" scdlLocation="databinding.e4x.scdl" />
+</composite> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-bsf-itests</artifactId>
+ <name>Apache Tuscany Script Container ITests</name>
+ <description>Apache Tuscany Script Container Itests</description>
+
+ <repositories>
+ <!-- This is reqquired for Jython as 2.2 Beta1 hasn't made it to the maven repos yet -->
+ <repository>
+ <id>ant</id>
+ <url>http://people.apache.org/~antelder/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>tuscany-bsf</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>tuscany-e4x</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby</artifactId>
+ <version>0.9.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jython</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.2b1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>helloworld.HelloWorldServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+ name="ScriptItests">
+
+ <component name="HelloWorldJSComponent">
+ <implementation.script script="helloworld/helloworld.js"/>
+ </component>
+
+ <component name="HelloWorldRubyComponent">
+ <implementation.script script="helloworld/helloworld.rb"/>
+ </component>
+
+ <component name="HelloWorldPythonComponent">
+ <implementation.script script="helloworld/helloworld.py"/>
+ </component>
+
+ <component name="HelloWorldGroovyComponent">
+ <implementation.script script="helloworld/helloworld.groovy" />
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
+ name="ScriptItests">
+
+ <component name="HelloWorldJSDefaultComponent">
+ <implementation.script script="properties/helloworld.js"/>
+ </component>
+
+ <component name="HelloWorldJSOverrideComponent">
+ <implementation.script script="properties/helloworld.js"/>
+ <property name="GREETING">Namaskaar</property>
+ </component>
+
+ <component name="HelloWorldJSDynDefaultComponent">
+ <implementation.script script="properties/helloworldDyn.js"/>
+ </component>
+
+ <component name="HelloWorldJSDynOverrideComponent">
+ <implementation.script script="properties/helloworldDyn.js"/>
+ <property name="GREETING">Namaste</property>
+ </component>
+
+ <component name="HelloWorldRubyDefaultComponent">
+ <implementation.script script="properties/helloworld.rb"/>
+ </component>
+
+ <component name="HelloWorldRubyOverrideComponent">
+ <implementation.script script="properties/helloworld.rb"/>
+ <property name="GREETING">Namaskaar</property>
+ </component>
+
+ <component name="HelloWorldRubyDynDefaultComponent">
+ <implementation.script script="properties/helloworldDyn.rb"/>
+ </component>
+
+ <component name="HelloWorldRubyDynOverrideComponent">
+ <implementation.script script="properties/helloworldDyn.rb"/>
+ <property name="GREETING">Namaste</property>
+ </component>
+
+ <component name="HelloWorldPythonDefaultComponent">
+ <implementation.script script="properties/helloworld.py"/>
+ </component>
+
+ <component name="HelloWorldPythonOverrideComponent">
+ <implementation.script script="properties/helloworld.py"/>
+ <property name="GREETING">Namaskaar</property>
+ </component>
+
+ <component name="HelloWorldPythonDynDefaultComponent">
+ <implementation.script script="properties/helloworldDyn.py"/>
+ </component>
+
+ <component name="HelloWorldPythonDynOverrideComponent">
+ <implementation.script script="properties/helloworldDyn.py"/>
+ <property name="GREETING">Namaste</property>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+ name="ScriptItests">
+
+ <component name="HelloWorldJSProxyComponent">
+ <implementation.script script="references/helloworldProxy.js"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldRubyProxyComponent">
+ <implementation.script script="references/helloworldProxy.rb"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldPythonProxyComponent">
+ <implementation.script script="references/helloworldProxy.py"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldJSComponent">
+ <implementation.script script="helloworld/helloworld.js"/>
+ </component>
+
+</composite>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+ name="ScriptItests">
+
+ <component name="HelloWorldJSComponent">
+ <implementation.script script="xml/helloworld.js"/>
+ <reference name="ref">HelloWorldXMLJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldXMLJSComponent">
+ <implementation.script script="xml/helloworldXML.js"/>
+ </component>
+
+ <component name="HelloWorldJSViaProxyComponent">
+ <implementation.script script="xml/helloworld.js"/>
+ <reference name="ref">HelloWorldXMLProxyJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldXMLProxyJSComponent">
+ <implementation.script script="xml/helloworldXMLProxy.js"/>
+ <reference name="ref">HelloWorldXMLJSComponent</reference>
+ </component>
+
+
+</composite>
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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="DivideService">
+ <interface.java class="calculator.DivideService" />
+ </service>
+
+ <property name="round" type="xsd:boolean">false</property>
+ <property name="doRounding" type="xsd:boolean">false</property>
+
+</componentType>
+ \ 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:
+# <implementation.python module="DivideImpl" class="DivideClass"/>
+#
+# Or just use the module-level divide function
+# e.g. in CalculatorComposite.composite use the line:
+# <implementation.python module="DivideImpl" />
+#
+
+
+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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="sample.calculator">
+
+ <component name="RubyCalculatorComponent">
+ <implementation.ruby script="calculator/CalculatorImpl.rb" class="CalculatorImpl"/>
+ <reference name="divideService">RubyDivideComponent</reference>
+ </component>
+
+ <component name="RubyDivideComponent">
+ <implementation.ruby script="calculator/DivideImpl.rb" class="DivideImpl"/>
+ <property name="round">true</property>
+ </component>
+
+ <component name="PythonCalculatorComponent">
+ <implementation.python module="calculator/CalculatorImpl.py" scope="composite"/>
+ <reference name="divideService">PythonDivideComponent</reference>
+ </component>
+
+ <component name="PythonDivideComponent">
+ <implementation.python module="calculator/DivideImpl.py" scope="composite"/>
+ <property name="doRounding">false</property>
+ </component>
+
+
+</composite> \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+ <property name="GREETING" type="xsd:string">Kia Ora</property>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+ <reference name="ref">
+ <interface.java class="helloworld.HelloWorldService" />
+ </reference>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+ <reference name="ref">
+ <interface.java class="helloworld.HelloWorldService" />
+ </reference>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+</componentType>
+ \ 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 =
+ <ns1:getGreetingsResponse xmlns:ns1="http://helloworld">
+ <ns1:getGreetingsReturn>{ s }</ns1:getGreetingsReturn>
+ </ns1:getGreetingsResponse>;
+
+ 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 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+ <reference name="ref">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </reference>
+
+</componentType>
+ \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.extensions</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.extensions.script</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Extensions for Scripting</name>
+
+ <modules>
+ <module>container.bsf</module>
+ <module>databinding.e4x</module>
+ <module>itests</module>
+ </modules>
+
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA API</name>
+ <description>Tuscany Application Programming Interfaces.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
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<String>() {
+ 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<String> 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<String> returnContextNames() {
+ if (contextStack == null) {
+ contextStack = new ArrayList<String>();
+ }
+ 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<String>();
+ }
+ 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<String> 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<String> returnContextNames() {
+ if (contextStack == null) {
+ contextStack = new ArrayList<String>();
+ }
+ 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<String>();
+ }
+ 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<String> contexts = new ArrayList<String>();
+ 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<String> contexts = new ArrayList<String>();
+ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<!--<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>-->
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-core</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Core</name>
+ <description>Core Tuscany runtime.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-host-api</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api_r1.1</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>${notice.dir}</directory>
+ <targetPath>META-INF</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+</project>
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<LocalBindingDefinition> {
+
+ protected Class<LocalBindingDefinition> 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<LocalBindingDefinition> {
+
+ /**
+ * 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<Operation<?>, 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: <ul> <li>SystemImplementation</li>
+ * <li>SystemCompositeImplementation</li> </ul> and the following SCDL elements are supported: <ul>
+ * <li>composite</li> <li>component</li> <li>componentType</li> <li>interface.java</li> <li>property</li>
+ * <li>reference</li> <li>service</li> <li>implementation.system</li> </ul> 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<String, Document>());
+ }
+
+ /**
+ * Initialize a runtime with the a set of properties
+ *
+ * @param runtimeProperties Property values for the runtime itself
+ */
+ public DefaultRuntime(Map<String, Document> 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<URL> 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<Class<? extends Implementation<?>>, ComponentBuilder<? extends Implementation<?>>> componentBuilders =
+ new HashMap<Class<? extends Implementation<?>>, ComponentBuilder<? extends Implementation<?>>>();
+ private final Map<Class<? extends BindingDefinition>, BindingBuilder<? extends BindingDefinition>> bindingBuilders =
+ new HashMap<Class<? extends BindingDefinition>, BindingBuilder<? extends BindingDefinition>>();
+ private final Map<Class<? extends ModelObject>, GenericBuilder<? extends SCAObject, ? extends ModelObject>> genericBuilders =
+ new HashMap<Class<? extends ModelObject>, GenericBuilder<? extends SCAObject, ? extends ModelObject>>();
+
+ public BuilderRegistryImpl(@Autowire
+ ScopeRegistry scopeRegistry, @Autowire
+ WireService wireService) {
+ this.scopeRegistry = scopeRegistry;
+ this.wireService = wireService;
+ }
+
+ public <I extends Implementation<?>> void register(Class<I> implClass, ComponentBuilder<I> builder) {
+ componentBuilders.put(implClass, builder);
+ }
+
+ public <I extends Implementation<?>> void unregisterComponentBuilder(Class<I> implClass) {
+ componentBuilders.remove(implClass);
+ }
+
+ public <B extends BindingDefinition> void register(Class<B> implClass, BindingBuilder<B> builder) {
+ bindingBuilders.put(implClass, builder);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <I extends Implementation<?>> Component build(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition,
+ DeploymentContext context) throws BuilderException {
+
+ Class<?> implClass = componentDefinition.getImplementation().getClass();
+ // noinspection SuspiciousMethodCalls
+ ComponentBuilder<I> componentBuilder = (ComponentBuilder<I>)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<ServiceDefinition, ComponentTypeReferenceDefinition, ?> componentType =
+ componentDefinition.getImplementation().getComponentType();
+ Map<String, ServiceDefinition> services = componentType.getServices();
+ for (ServiceDefinition serviceDef : services.values()) {
+ InteractionScope intScope = serviceDef.getServiceContract().getInteractionScope();
+ if (intScope == InteractionScope.CONVERSATIONAL) {
+ hasConversationalContract = true;
+ break;
+ }
+ }
+ if (!hasConversationalContract) {
+ Map<String, ComponentTypeReferenceDefinition> 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 <S extends SCAObject, M extends ModelObject> void register(Class<M> modelClass,
+ GenericBuilder<S, M> builder) {
+ genericBuilders.put(modelClass, builder);
+ }
+
+ public <B extends BindingDefinition> void unregisterBindingBuilder(Class<B> implClass) {
+ bindingBuilders.remove(implClass);
+ }
+
+ public <M extends ModelObject> void unregisterGenericBuilder(Class<M> 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<Operation<?>, 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<Operation<?>, 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<Operation<?>, 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<Operation<?>, 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<OutboundWire> 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 <code>WirePostProcessor</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class WirePostProcessorRegistryImpl implements WirePostProcessorRegistry {
+
+ private final List<WirePostProcessor> processors = new ArrayList<WirePostProcessor>();
+
+ 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 <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ try {
+ return context.locateService(businessInterface, component.getName() + "/" + referenceName);
+ } catch (TuscanyRuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> 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 <code>InheritableThreadLocal</code>
+ *
+ * @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<Map<Object, Object>> workContext = new ThreadLocal<Map<Object, Object>>();
+
+ // [rfeng] Session id requires InheritableThreadLocal
+ private ThreadLocal<Map<Object, Object>> inheritableContext = new InheritableThreadLocal<Map<Object, Object>>();
+
+ public WorkContextImpl() {
+ super();
+ }
+
+ public Object getCurrentCorrelationId() {
+ Map<Object, Object> map = workContext.get();
+ if (map == null) {
+ return null;
+ }
+ return map.get(CORRELATION_ID);
+ }
+
+ public void setCurrentCorrelationId(Object correlationId) {
+ Map<Object, Object> map = getWorkContextMap();
+ map.put(CORRELATION_ID, correlationId);
+ }
+
+ public AtomicComponent getCurrentAtomicComponent() {
+ Map<Object, Object> map = workContext.get();
+ if (map == null) {
+ return null;
+ }
+ return (AtomicComponent) map.get(CURRENT_ATOMIC);
+ }
+
+ public void setCurrentAtomicComponent(AtomicComponent component) {
+ Map<Object, Object> map = getWorkContextMap();
+ map.put(CURRENT_ATOMIC, component);
+ }
+
+ @SuppressWarnings("unchecked")
+ public LinkedList<Object> getCurrentCallbackRoutingChain() {
+ Map<Object, Object> map = workContext.get();
+ if (map == null) {
+ return null;
+ }
+ return (LinkedList<Object>) map.get(CALLBACK_ROUTING_CHAIN);
+ }
+
+ public void setCurrentCallbackRoutingChain(LinkedList<Object> callbackRoutingChain) {
+ Map<Object, Object> map = getWorkContextMap();
+ map.put(CALLBACK_ROUTING_CHAIN, callbackRoutingChain);
+ }
+
+ public CompositeComponent getRemoteComponent() {
+ Map<Object, Object> map = workContext.get();
+ if (map == null) {
+ return null;
+ }
+ return (CompositeComponent) map.get(REMOTE_CONTEXT);
+ }
+
+
+ public void setRemoteComponent(CompositeComponent component) {
+ Map<Object, Object> map = getWorkContextMap();
+ map.put(REMOTE_CONTEXT, component);
+ }
+
+ public Object getIdentifier(Object type) {
+ Map<Object, Object> 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<Object, Object> map = inheritableContext.get();
+ if (map == null) {
+ map = new IdentityHashMap<Object, Object>();
+ 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<Object, Object> map = inheritableContext.get();
+ if (map == null) {
+ return null;
+ }
+ List<String> 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<Object, Object> map = inheritableContext.get();
+ if (map == null) {
+ return null;
+ }
+ List<String> 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<Object, Object> map = inheritableContext.get();
+ List<String> names;
+ if (map == null) {
+ map = new IdentityHashMap<Object, Object>();
+ inheritableContext.set(map);
+ names = new ArrayList<String>();
+ map.put(CURRENT_SERVICE_NAMES, names);
+ } else {
+ names = (List<String>) map.get(CURRENT_SERVICE_NAMES);
+ if (names == null) {
+ names = new ArrayList<String>();
+ map.put(CURRENT_SERVICE_NAMES, names);
+ }
+ }
+ names.add(name);
+ }
+
+ public void clearServiceNames() {
+ Map<Object, Object> map = inheritableContext.get();
+ if (map == null) {
+ return;
+ }
+ map.remove(CURRENT_SERVICE_NAMES);
+ }
+
+ private Map<Object, Object> getWorkContextMap() {
+ Map<Object, Object> map = workContext.get();
+ if (map == null) {
+ map = new IdentityHashMap<Object, Object>();
+ 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<EventFilter, List<RuntimeEventListener>> 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<RuntimeEventListener> 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<RuntimeEventListener> list = getListeners().get(filter);
+ if (list == null) {
+ list = new CopyOnWriteArrayList<RuntimeEventListener>();
+ listeners.put(filter, list);
+ }
+ list.add(listener);
+ }
+ }
+
+ public void publish(Event event) {
+ assert event != null;
+ for (Map.Entry<EventFilter, List<RuntimeEventListener>> 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<EventFilter, List<RuntimeEventListener>> getListeners() {
+ if (listeners == null) {
+ listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
+ }
+ 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<AtomicComponent, InstanceWrapper> instanceWrappers;
+ // the queue of instanceWrappers to destroy, in the order that their instances were created
+ private final List<InstanceWrapper> destroyQueue;
+
+ public CompositeScopeContainer(ScopeContainerMonitor monitor) {
+ super(null, monitor);
+ instanceWrappers = new ConcurrentHashMap<AtomicComponent, InstanceWrapper>();
+ destroyQueue = new ArrayList<InstanceWrapper>();
+ }
+
+ 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<InstanceWrapper> 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<AtomicComponent> componentList = new ArrayList<AtomicComponent>(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<AtomicComponent> {
+ 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<CompositeScopeContainer> {
+ 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<AtomicComponent, AtomicComponent> 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<AtomicComponent, AtomicComponent>();
+ }
+
+ 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<ConversationalScopeContainer> {
+ 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<AtomicComponent, Map<Object, InstanceWrapper>> contexts;
+ private final Map<Object, List<InstanceWrapper>> destroyQueues;
+
+ public HttpSessionScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) {
+ super(workContext, monitor);
+ contexts = new ConcurrentHashMap<AtomicComponent, Map<Object, InstanceWrapper>>();
+ destroyQueues = new ConcurrentHashMap<Object, List<InstanceWrapper>>();
+ }
+
+ 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<Object, InstanceWrapper>());
+ 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<Object, InstanceWrapper> 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<InstanceWrapper> destroyQueue = destroyQueues.get(key);
+ if (destroyQueue == null) {
+ destroyQueue = new ArrayList<InstanceWrapper>();
+ destroyQueues.put(key, destroyQueue);
+ }
+ synchronized (destroyQueue) {
+ destroyQueue.add(ctx);
+ }
+ }
+ return ctx;
+
+ }
+
+ private void shutdownInstances(Object key) {
+ List<InstanceWrapper> destroyQueue = destroyQueues.remove(key);
+ if (destroyQueue != null) {
+ for (Map<Object, InstanceWrapper> map : contexts.values()) {
+ map.remove(key);
+ }
+ ListIterator<InstanceWrapper> 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<HttpSessionScopeContainer> {
+ 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 <code>InstanceWrapper</code>
+ *
+ * @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<AtomicComponent, Map<Thread, InstanceWrapper>> contexts;
+ private final Map<Thread, List<InstanceWrapper>> destroyQueues;
+
+ public RequestScopeContainer(WorkContext workContext, ScopeContainerMonitor monitor) {
+ super(workContext, monitor);
+ contexts = new ConcurrentHashMap<AtomicComponent, Map<Thread, InstanceWrapper>>();
+ destroyQueues = new ConcurrentHashMap<Thread, List<InstanceWrapper>>();
+ }
+
+ 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<Thread, InstanceWrapper>());
+ }
+
+ protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create)
+ throws TargetResolutionException {
+ Map<Thread, InstanceWrapper> 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<InstanceWrapper> destroyQueue = destroyQueues.get(Thread.currentThread());
+ if (destroyQueue == null) {
+ destroyQueue = new ArrayList<InstanceWrapper>();
+ destroyQueues.put(Thread.currentThread(), destroyQueue);
+ }
+ synchronized (destroyQueue) {
+ destroyQueue.add(ctx);
+ }
+ }
+ return ctx;
+ }
+
+ private void shutdownInstances(Thread key) {
+ List<InstanceWrapper> destroyQueue = destroyQueues.remove(key);
+ if (destroyQueue != null && destroyQueue.size() > 0) {
+ Thread thread = Thread.currentThread();
+ for (Map<Thread, InstanceWrapper> map : contexts.values()) {
+ map.remove(thread);
+ }
+ ListIterator<InstanceWrapper> 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<RequestScopeContainer> {
+ 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<Scope, ScopeContainer> scopeCache =
+ new ConcurrentHashMap<Scope, ScopeContainer>();
+ private final Map<Scope, ObjectFactory<? extends ScopeContainer>> factoryCache =
+ new ConcurrentHashMap<Scope, ObjectFactory<? extends ScopeContainer>>();
+
+ public ScopeContainer getScopeContainer(Scope scope) {
+ assert Scope.COMPOSITE != scope;
+ ScopeContainer container = scopeCache.get(scope);
+ if (container == null) {
+ ObjectFactory<? extends ScopeContainer> factory = factoryCache.get(scope);
+ if (factory != null) {
+ container = factory.getInstance();
+ container.start();
+ scopeCache.put(scope, container);
+ }
+ }
+ return container;
+ }
+
+ public <T extends ScopeContainer> void registerFactory(Scope scope, ObjectFactory<T> 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<StatelessScopeContainer> {
+ 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<T>>?
+ DataType<DataType> targetType =
+ new DataType<DataType>(DataBinding.IDL_OUTPUT, Object.class, targetOperation.getOutputType());
+
+ targetType.setOperation(targetOperation.getOutputType().getOperation());
+ DataType<DataType> sourceType =
+ new DataType<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<Class<?>, Object> metadata = new HashMap<Class<?>, 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<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+ metadata.put(CompositeComponent.class, compositeComponent);
+
+ DataType<DataType<?>> eSourceDataType =
+ new DataType<DataType<?>>("idl:fault", sourceExType.getPhysical(), sourceType);
+ DataType<DataType<?>> eTargetDataType =
+ new DataType<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<Class> SIMPLE_TYPE_SET = new HashSet<Class>(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<String, Operation<Type>> operations = contract.getOperations();
+ processInterface(clazz, contract, operations);
+ if (callbackClass != null) {
+ Map<String, Operation<Type>> callbackOperations = contract.getCallbackOperations();
+ processInterface(callbackClass, contract, callbackOperations);
+ }
+ }
+
+ private void processInterface(Class<?> clazz, JavaServiceContract contract,
+ Map<String, Operation<Type>> 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<String, DataBinding> bindings = new HashMap<String, DataBinding>();
+
+ 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<DataBinding> getDataBindings() {
+ return new HashSet<DataBinding>(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<Class>(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<Operation<?>, OutboundInvocationChain> chains = source.getInvocationChains();
+ for (Map.Entry<Operation<?>, 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<Operation<?>, OutboundInvocationChain> callbackChains =
+ target.getSourceCallbackInvocationChains(targetAddress);
+ if (callbackChains == null) {
+ // callback chains could be null
+ return;
+ }
+ for (Map.Entry<Operation<?>, 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<Operation<?>, InboundInvocationChain> chains = source.getInvocationChains();
+ for (Map.Entry<Operation<?>, 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<Operation<?>> 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<DataType> {
+ 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<Class>(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 <V> The type of vertex object
+ * @param <E> The type of edge object
+ */
+public class DirectedGraph<V, E> {
+ private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
+
+ /**
+ * 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<VertexPair, Path> paths = new HashMap<VertexPair, Path>();
+
+ /**
+ * 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<Vertex, Edge> outEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> 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<Node> {
+
+ 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<Vertex, Node> nodes = new HashMap<Vertex, Node>();
+ for (Vertex v : vertices.values()) {
+ Node node = new Node(v);
+ if (v == source) {
+ node.distance = 0;
+ }
+ nodes.put(v, node);
+ }
+
+ Set<Node> otherNodes = new HashSet<Node>(nodes.values());
+ Set<Node> nodesOnPath = new HashSet<Node>();
+ 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<Node> nodes) {
+ Node node = Collections.min(nodes);
+ nodes.remove(node);
+ return node;
+ }
+
+ /**
+ * The path between two vertices
+ */
+ public final class Path {
+ private List<Edge> edges = new LinkedList<Edge>();
+
+ private int weight;
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public List<Edge> 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<V, Vertex> getVertices() {
+ return vertices;
+ }
+
+ public void addGraph(DirectedGraph<V, E> 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<Object[], Object[]> implements
+ PullTransformer<Exception, Exception> {
+
+ 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<DataType> sourceType = context.getSourceDataType();
+
+ DataType<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<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<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ 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<DataType> sourceType = context.getSourceDataType();
+ DataType<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<Object[], Object[]> implements
+ PullTransformer<Object[], Object[]> {
+
+ 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<List<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<List<DataType<XMLType>>> 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<DataType<XMLType>> argTypes = wrapper.getUnwrappedInputType().getLogical();
+
+ for (int i = 0; i < source.length; i++) {
+ ElementInfo argElement = wrapper.getInputChildElements().get(i);
+ DataType<XMLType> 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<ElementInfo> 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<XMLType> targetWrapperType =
+ new DataType<XMLType>(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<XMLType> 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<Class<?>, Object> metadata) {
+ if (sourceDataType == null) {
+ sourceDataType = dataBindingRegistry.introspectType(source);
+ }
+ if (sourceDataType == null) {
+ return source;
+ } else if (sourceDataType.equals(targetDataType)) {
+ return source;
+ }
+
+ List<Transformer> 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<Class<?>, Object> metadata) {
+ DataType sourceType =
+ (index == 0) ? sourceDataType : new DataType<Object>(transformer.getSourceDataBinding(),
+ Object.class, null);
+ DataType targetType =
+ (index == size - 1) ? targetDataType : new DataType<Object>(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<Class<?>, 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<Transformer> 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<Transformer> getTransformerChain(DataType sourceDataType, DataType targetDataType) {
+ String sourceId = sourceDataType.getDataBinding();
+ String targetId = targetDataType.getDataBinding();
+ List<Transformer> 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<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ 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<DataType> sourceType = context.getSourceDataType();
+ Operation<?> sourceOp = (Operation<?>)sourceType.getOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+ WrapperHandler sourceWrapperHandler = null;
+ if (sourceWrapped) {
+ sourceWrapperHandler = getWapperHandler(sourceOp);
+ }
+
+ DataType<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<ElementInfo> childElements = wrapper.getOutputChildElements();
+ if (childElements.isEmpty()) {
+ // void output
+ return targetWrapper;
+ }
+ ElementInfo argElement = childElements.get(0);
+ DataType<XMLType> 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<ElementInfo> 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<XMLType> targetWrapperType =
+ new DataType<XMLType>(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<Object, Object> map = new IdentityHashMap<Object, Object>();
+ 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<Operation<?>, InboundInvocationChain> chains = target.getInvocationChains();
+ for (Map.Entry<Operation<?>, 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<Operation<?>, InboundInvocationChain> callbackChains = source.getTargetCallbackInvocationChains();
+ for (Map.Entry<Operation<?>, 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<Operation<?>> operations, String operationName) {
+ for (Operation<?> op : operations) {
+ if (op.getName().equals(operationName)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private DataBinding[] getParameterDataBindings(Operation operation) {
+ List<DataType<?>> argumentTypes = (List<DataType<?>>)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 <S> Source type
+ * @param <I> Intermidate type
+ * @param <R> Result type
+ */
+public class PipedTransformer<S, I, R> implements PullTransformer<S, R> {
+ private PushTransformer<S, I> pusher;
+
+ private DataPipe<I, R> pipe;
+
+ /**
+ * @param pumper
+ * @param pipe
+ */
+ public PipedTransformer(PushTransformer<S, I> pumper, DataPipe<I, R> 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.
+ * <p/>
+ * The following illustrates how a simple data binding can be registered as a SCA component.
+ * <p/>
+ * <pre>
+ * &lt;component name="databinding.MyDataBinding"&gt;<br>
+ * &nbsp;&nbsp;&lt;system:implementation.java
+ * class="org.apache.tuscany.databinding.impl.SimpleDataBinding"/&gt;<br>
+ * &nbsp;&nbsp;&lt;property name="className"&gt;my.Type&lt;/property&gt;<br>
+ * &lt/component&gt;
+ * </pre>
+ *
+ * @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<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+
+ private WeakReference<ClassLoader> classLoaderRef;
+
+ public TransformationContextImpl() {
+ super();
+ setClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+
+ public TransformationContextImpl(DataType sourceDataType,
+ DataType targetDataType,
+ ClassLoader classLoader,
+ Map<Class<?>, 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>(classLoader);
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoaderRef.get();
+ }
+
+ public Map<Class<?>, 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<Object, Transformer> graph = new DirectedGraph<Object, Transformer>();
+
+ 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<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType);
+ return (edge == null) ? null : edge.getValue();
+ }
+
+ public List<Transformer> getTransformerChain(String sourceType, String resultType) {
+ String source = normalize(sourceType);
+ String result = normalize(resultType);
+ List<Transformer> transformers = new ArrayList<Transformer>();
+ DirectedGraph<Object, Transformer>.Path path = graph.getShortestPath(source, result);
+ if (path == null) {
+ return null;
+ }
+ for (DirectedGraph<Object, Transformer>.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<Node> {
+
+ @Override
+ public Node getRootElement(Node element) throws XML2JavaMapperException {
+ if (element instanceof Document) {
+ return ((Document)element).getDocumentElement();
+ } else {
+ return element;
+ }
+
+ }
+
+ @Override
+ public List<Node> getChildElements(Node parent) throws XML2JavaMapperException {
+ NodeList nodeList = parent.getChildNodes();
+ List<Node> nodeArrayList = new ArrayList<Node>(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<Node> {
+
+ 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<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ 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<T> extends TransformerExtension<Object, T> implements
+ PullTransformer<Object, T> {
+
+ 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<T> extends TransformerExtension<T, Object> implements
+ PullTransformer<T, Object> {
+
+ 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> L createJavaObject(T element, Class<L> javaType, TransformationContext context)
+ throws XML2JavaMapperException {
+ List<T> 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<Field, List<Object>> arrayFields = new Hashtable<Field, List<Object>>();
+ Map<Method, List<Object>> arraySetters = new Hashtable<Method, List<Object>>();
+ 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<Field, List<Object>> arrayFields,
+ TransformationContext context) throws IllegalAccessException {
+ Class<?> javaFieldType = (Class<?>) javaField.getType();
+
+ if (javaFieldType.isArray()) {
+ Class<?> componentType = javaFieldType.getComponentType();
+ List<Object> fldValueArray = arrayFields.get(javaField);
+ if (fldValueArray == null) {
+ fldValueArray = new ArrayList<Object>();
+ 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<Method, List<Object>> 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<Object> setterValueArray = arraySetters.get(aMethod);
+ if (setterValueArray == null) {
+ setterValueArray = new ArrayList<Object>();
+ 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<Field, List<Object>> arrayFields,
+ Map<Method, List<Object>> 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<T> 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<String, PropertyDescriptor> propertMap = new HashMap<String, PropertyDescriptor>();
+ for (int i = 0; i < propDescs.length; i++) {
+ PropertyDescriptor propDesc = propDescs[i];
+ propertMap.put(propDesc.getName(), propDesc);
+ }
+ List<String> properties = new ArrayList<String>(propertMap.keySet());
+ Collections.sort(properties);
+ List<NamedProperty> props = new ArrayList<NamedProperty>();
+ 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<Node> {
+
+ 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<Node> elements = new ArrayList<Node>();
+ 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<NamedProperty> attributeList = new ArrayList<NamedProperty>();
+ 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<QName> nsList = new ArrayList<QName>();
+ 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<NamedProperty> elementList = new ArrayList<NamedProperty>();
+ 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<String> prefixStack = new FastStack<String>();
+
+ // 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<String> uriStack = new FastStack<String>();
+
+ /**
+ * 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<String> tempList = new ArrayList<String>();
+ 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 <code>ArrayList</code> instead of a
+ * <code>Vector</code>, 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.
+ * <p>
+ * The removal order of an <code>ArrayStack</code> is based on insertion order: The most recently added element is
+ * removed first. The iteration order is <i>not</i> 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.
+ * <p>
+ * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
+ */
+ public static class FastStack<T> extends ArrayList<T> {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 2130079159931574599L;
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code>. The initial size is controlled by <code>ArrayList</code>
+ * and is currently 10.
+ */
+ public FastStack() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code> 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 <code>true</code> if this stack is currently empty.
+ * <p>
+ * This method exists for compatibility with <code>java.util.Stack</code>. New users of this class should use
+ * <code>isEmpty</code> 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
+ * <code>add</code>.
+ *
+ * @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<InputSource, Node> implements
+ PullTransformer<InputSource, Node> {
+ 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<InputSource, ContentHandler> implements
+ PushTransformer<InputSource, ContentHandler> {
+
+ 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<InputStream, Node> implements
+ PullTransformer<InputStream, Node> {
+ 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<InputStream, ContentHandler> implements
+ PushTransformer<InputStream, ContentHandler> {
+ 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<QName, Object> {
+ 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<Node, OutputStream> implements
+ PushTransformer<Node, OutputStream> {
+ 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<Node, String> implements PullTransformer<Node, String> {
+ 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<Node, Writer> implements PushTransformer<Node, Writer> {
+ 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<Node, XMLStreamReader> implements
+ PullTransformer<Node, XMLStreamReader> {
+
+ 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<Reader, Node> implements PullTransformer<Reader, Node> {
+ 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<Reader, ContentHandler> implements
+ PushTransformer<Reader, ContentHandler> {
+ 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<Node> nodeStk = new Stack<Node>();
+
+ private List<String> 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<String>(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<ContentHandler, Node> implements
+ DataPipe<ContentHandler, Node> {
+ 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<Source, Result> implements
+ PushTransformer<Source, Result> {
+ 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:
+ * <ul>
+ * <li>ignorableWhitespace</li>
+ * <li>skippedEntity</li>
+ * <ul>
+ * Also the following StAX events are not mapped:
+ * <ul>
+ * <li>CDATA</li>
+ * <li>COMMENT</li>
+ * <li>DTD</li>
+ * <li>ENTITY_DECLARATION</li>
+ * <li>ENTITY_REFERENCE</li>
+ * <li>NOTATION_DECLARATION</li>
+ * <li>SPACE</li>
+ * </ul>
+ * StAX ATTRIBUTE events are ignored but the equivalent attributes (derived from
+ * the START_ELEMENT event) are supplied in the SAX startElement event's
+ * Attributes parameter. If the adaptor is configured to pass namespace prefixes
+ * then namespace information will also be included in the Attributes; StAX
+ * NAMESPACE events are ignored. <p/> Another issue is namespace processing. If
+ * the reader is positioned at a sub-node, we cannot capture all the in-scope
+ * namespace bindings. Therefore we cannot re-create a proper SAX event stream
+ * from a StAX parser. <p/> For example <p/> &lt;a:root xmlns:a="foo"
+ * xmlns:b="bar"&gt;&lt;b:sub&gt;a:foo&lt;/b:sub&gt;&lt;/a:root&gt; <p/> And if
+ * you are handed a parser at &lt;b:sub&gt;, then your SAX events should look
+ * like: <p/> &lt;b:sub xmlns:a="foo" xmlns:b="bar"&gt;a:foo&lt;/b:sub&gt; <p/>
+ * not: <p/> &lt;b:sub&gt;a:foo&lt;/b:sub&gt; <p/> <p/> Proposal: we change the
+ * receiver of SAX events (SDOXMLResourceImpl) so that it uses NamespaceContext
+ * to resolve prefix (as opposed to record start/endPrefixMappings and use it
+ * for resolution.)
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAX2SAXAdapter {
+ private final boolean namespacePrefixes;
+
+ /**
+ * Construct a new StAX to SAX adapter that will convert a StAX event stream
+ * into a SAX event stream.
+ *
+ * @param namespacePrefixes whether xmlns attributes should be included in
+ * startElement events;
+ */
+ public StAX2SAXAdapter(boolean namespacePrefixes) {
+ this.namespacePrefixes = namespacePrefixes;
+ }
+
+ /**
+ * Pull events from the StAX stream and dispatch to the SAX ContentHandler.
+ * The StAX stream would typically be located on a START_DOCUMENT or
+ * START_ELEMENT event and when this method returns it will be located on
+ * the associated END_DOCUMENT or END_ELEMENT event. Behaviour with other
+ * start events is undefined.
+ *
+ * @param reader StAX event source to read
+ * @param handler SAX ContentHandler for processing events
+ * @throws XMLStreamException if there was a problem reading the stream
+ * @throws SAXException passed through from the ContentHandler
+ */
+ public void parse(XMLStreamReader reader, ContentHandler handler) throws XMLStreamException, SAXException {
+ handler.setDocumentLocator(new LocatorAdaptor(reader.getLocation()));
+
+ // remembers the nest level of elements to know when we are done
+ int level = 0;
+ int event = reader.getEventType();
+ while (true) {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement(reader, handler);
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(reader.getPITarget(), reader.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ handler.characters(reader.getTextCharacters(), reader.getTextStart(), reader
+ .getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement(reader, handler);
+ level--;
+ if (level == 0) {
+ return;
+ }
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ return;
+ /*
+ * uncomment to handle all events rather than just mapped
+ * ones // StAX events that are not mapped to SAX case
+ * XMLStreamConstants.COMMENT: case
+ * XMLStreamConstants.SPACE: case
+ * XMLStreamConstants.ENTITY_REFERENCE: case
+ * XMLStreamConstants.DTD: case XMLStreamConstants.CDATA:
+ * case XMLStreamConstants.NOTATION_DECLARATION: case
+ * XMLStreamConstants.ENTITY_DECLARATION: break; // StAX
+ * events handled in START_ELEMENT case
+ * XMLStreamConstants.ATTRIBUTE: case
+ * XMLStreamConstants.NAMESPACE: break; default: throw new
+ * AssertionError("Unknown StAX event: " + event);
+ */
+ }
+ event = reader.next();
+ }
+ }
+
+ private void handleStartElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
+ // send startPrefixMapping events immediately before startElement event
+ int nsCount = reader.getNamespaceCount();
+ for (int i = 0; i < nsCount; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.startPrefixMapping(prefix, reader.getNamespaceURI(i));
+ }
+
+ // fire startElement
+ QName qname = reader.getName();
+ String prefix = qname.getPrefix();
+ String rawname;
+ if (prefix == null || prefix.length() == 0) {
+ rawname = qname.getLocalPart();
+ } else {
+ rawname = prefix + ':' + qname.getLocalPart();
+ }
+ Attributes attrs = getAttributes(reader);
+ handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
+ }
+
+ private static void handleEndElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
+ // fire endElement
+ QName qname = reader.getName();
+ handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString());
+
+ // send endPrefixMapping events immediately after endElement event
+ // we send them in the opposite order to that returned but this is not
+ // actually required by SAX
+ int nsCount = reader.getNamespaceCount();
+ for (int i = nsCount - 1; i >= 0; i--) {
+ String prefix = reader.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.endPrefixMapping(prefix);
+ }
+ }
+
+ /**
+ * Get the attributes associated with the current START_ELEMENT event.
+ *
+ * @return the StAX attributes converted to org.xml.sax.Attributes
+ */
+ private Attributes getAttributes(XMLStreamReader reader) {
+ assert reader.getEventType() == XMLStreamConstants.START_ELEMENT;
+
+ AttributesImpl attrs = new AttributesImpl();
+
+ // add namespace declarations if required
+ if (namespacePrefixes) {
+ for (int i = 0; i < reader.getNamespaceCount(); i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String uri = reader.getNamespaceURI(i);
+ attrs.addAttribute(null, prefix, "xmlns:" + prefix, "CDATA", uri);
+ }
+ }
+
+ // Regular attributes
+ for (int i = 0; i < reader.getAttributeCount(); i++) {
+ String uri = reader.getAttributeNamespace(i);
+ if (uri == null) {
+ uri = "";
+ }
+ String localName = reader.getAttributeLocalName(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname;
+ if (prefix == null || prefix.length() == 0) {
+ qname = localName;
+ } else {
+ qname = prefix + ':' + localName;
+ }
+ String type = reader.getAttributeType(i);
+ String value = reader.getAttributeValue(i);
+
+ attrs.addAttribute(uri, localName, qname, type, value);
+ }
+
+ return attrs;
+ }
+
+ /**
+ * Adaptor for mapping Locator information.
+ */
+ private static final class LocatorAdaptor implements Locator {
+ private final Location location;
+
+ private LocatorAdaptor(Location location) {
+ this.location = location;
+ }
+
+ public int getColumnNumber() {
+ return location == null ? 0 : location.getColumnNumber();
+ }
+
+ public int getLineNumber() {
+ return location == null ? 0 : location.getLineNumber();
+ }
+
+ public String getPublicId() {
+ return location == null ? "" : location.getPublicId();
+ }
+
+ public String getSystemId() {
+ return location == null ? "" : location.getSystemId();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXDataBinding.java
new file mode 100644
index 0000000000..f21e4f3734
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXDataBinding.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 java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * A DataBinding for the StAX
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAXDataBinding extends DataBindingExtension {
+ public static final String NAME = XMLStreamReader.class.getName();
+ public static final String[] ALIASES = new String[] {"stax"};
+
+ public StAXDataBinding() {
+ super(NAME, ALIASES, XMLStreamReader.class);
+ }
+
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (super.introspect(type, annotations)) {
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXHelper.java
new file mode 100755
index 0000000000..3ce9ca1144
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StAXHelper.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.databinding.xml;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+
+
+public final class StAXHelper {
+ private static final XMLInputFactory INPUT_FACTORY = XMLInputFactory.newInstance();
+ private static final XMLOutputFactory OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+ private StAXHelper() {
+ }
+
+ public static XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(inputStream);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(reader);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(source);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(String string) throws XMLStreamException {
+ StringReader reader = new StringReader(string);
+ return createXMLStreamReader(reader);
+ }
+
+ public static String save(XMLStreamReader reader) throws XMLStreamException {
+ StringWriter writer = new StringWriter();
+ save(reader, writer);
+ return writer.toString();
+ }
+
+ public static void save(XMLStreamReader reader, OutputStream outputStream) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(outputStream);
+ serializer.serialize(reader, streamWriter);
+ streamWriter.flush();
+ }
+
+ public static void save(XMLStreamReader reader, Writer writer) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(writer);
+ serializer.serialize(reader, streamWriter);
+ streamWriter.flush();
+ }
+
+ public static void save(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(reader, writer);
+ writer.flush();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StreamDataPipe.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StreamDataPipe.java
new file mode 100755
index 0000000000..d0b6ce07f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/StreamDataPipe.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.databinding.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+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;
+
+@Service(Transformer.class)
+public class StreamDataPipe extends TransformerExtension<OutputStream, InputStream> implements
+ DataPipe<OutputStream, InputStream> {
+
+ private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ public InputStream getResult() {
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+
+ public Class getTargetType() {
+ return InputStream.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+ public OutputStream getSink() {
+ return outputStream;
+ }
+
+ public Class getSourceType() {
+ return OutputStream.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2Node.java
new file mode 100755
index 0000000000..3f878a07b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2Node.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 java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+
+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.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+@Service(Transformer.class)
+public class String2Node extends TransformerExtension<String, Node> implements PullTransformer<String, Node> {
+
+ public Node transform(String source, TransformationContext context) {
+ try {
+ DocumentBuilder builder = DOMHelper.newDocumentBuilder();
+ InputSource inputSource = new InputSource(new StringReader(source));
+ return builder.parse(inputSource);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return Node.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/xml/String2SAX.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2SAX.java
new file mode 100644
index 0000000000..50ea110b17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2SAX.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.StringReader;
+
+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 String2SAX extends TransformerExtension<String, ContentHandler> implements
+ PushTransformer<String, ContentHandler> {
+
+ public void transform(String source, ContentHandler target, TransformationContext context) {
+ try {
+ new InputSource2SAX().transform(new InputSource(new StringReader(source)), target, context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.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/String2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2XMLStreamReader.java
new file mode 100755
index 0000000000..9793cc3f7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/String2XMLStreamReader.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+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;
+
+@Service(Transformer.class)
+public class String2XMLStreamReader extends TransformerExtension<String, XMLStreamReader> implements
+ PullTransformer<String, XMLStreamReader> {
+
+ public XMLStreamReader transform(String source, TransformationContext context) {
+ try {
+ return StAXHelper.createXMLStreamReader(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.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/xml/WrappingXMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/WrappingXMLStreamReader.java
new file mode 100644
index 0000000000..6fa6478bf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/WrappingXMLStreamReader.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.core.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+
+public class WrappingXMLStreamReader implements XMLFragmentStreamReader {
+
+ private XMLStreamReader reader;
+
+ public WrappingXMLStreamReader(XMLStreamReader reader) {
+ this.reader = reader;
+ }
+
+ public boolean isDone() {
+ try {
+ return !hasNext();
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object getProperty(String string) throws IllegalArgumentException {
+ return reader.getProperty(string);
+ }
+
+ public int next() throws XMLStreamException {
+ return reader.next();
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ // nothing to do
+ }
+
+ public String getElementText() throws XMLStreamException {
+ return reader.getElementText();
+ }
+
+ public int nextTag() throws XMLStreamException {
+ return reader.nextTag();
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return reader.hasNext();
+ }
+
+ public void close() throws XMLStreamException {
+ reader.close();
+ }
+
+ public String getNamespaceURI(String string) {
+ return reader.getNamespaceURI(string);
+ }
+
+ public boolean isStartElement() {
+ return reader.isStartElement();
+ }
+
+ public boolean isEndElement() {
+ return reader.isEndElement();
+ }
+
+ public boolean isCharacters() {
+ return reader.isCharacters();
+ }
+
+ public boolean isWhiteSpace() {
+ return reader.isWhiteSpace();
+ }
+
+ public String getAttributeValue(String string, String string1) {
+ return reader.getAttributeValue(string, string1);
+ }
+
+ public int getAttributeCount() {
+ return reader.getAttributeCount();
+ }
+
+ public QName getAttributeName(int i) {
+ return reader.getAttributeName(i);
+ }
+
+ public String getAttributeNamespace(int i) {
+ return reader.getAttributeNamespace(i);
+ }
+
+ public String getAttributeLocalName(int i) {
+ return reader.getAttributeLocalName(i);
+ }
+
+ public String getAttributePrefix(int i) {
+ return reader.getAttributeLocalName(i);
+ }
+
+ public String getAttributeType(int i) {
+ return reader.getAttributeType(i);
+ }
+
+ public String getAttributeValue(int i) {
+ return reader.getAttributeValue(i);
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return reader.isAttributeSpecified(i);
+ }
+
+ public int getNamespaceCount() {
+ return reader.getNamespaceCount();
+ }
+
+ public String getNamespacePrefix(int i) {
+ return reader.getNamespacePrefix(i);
+ }
+
+ public String getNamespaceURI(int i) {
+ return reader.getNamespaceURI(i);
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return reader.getNamespaceContext();
+ }
+
+ public int getEventType() {
+ return reader.getEventType();
+ }
+
+ public String getText() {
+ return reader.getText();
+ }
+
+ public char[] getTextCharacters() {
+ return reader.getTextCharacters();
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ return reader.getTextCharacters(i, chars, i1, i2);
+ }
+
+ public int getTextStart() {
+ return reader.getTextStart();
+ }
+
+ public int getTextLength() {
+ return reader.getTextLength();
+ }
+
+ public String getEncoding() {
+ return reader.getEncoding();
+ }
+
+ public boolean hasText() {
+ return reader.hasText();
+ }
+
+ public Location getLocation() {
+ return reader.getLocation();
+ }
+
+ public QName getName() {
+ return reader.getName();
+ }
+
+ public String getLocalName() {
+ return reader.getLocalName();
+ }
+
+ public boolean hasName() {
+ return reader.hasName();
+ }
+
+ public String getNamespaceURI() {
+ return reader.getNamespaceURI();
+ }
+
+ public String getPrefix() {
+ return reader.getPrefix();
+ }
+
+ public String getVersion() {
+ return reader.getVersion();
+ }
+
+ public boolean isStandalone() {
+ return reader.isStandalone();
+ }
+
+ public boolean standaloneSet() {
+ return reader.standaloneSet();
+ }
+
+ public String getCharacterEncodingScheme() {
+ return reader.getCharacterEncodingScheme();
+ }
+
+ public String getPITarget() {
+ return reader.getPITarget();
+ }
+
+ public String getPIData() {
+ return reader.getPIData();
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // nothing to do here
+ }
+
+ public void init() {
+ // Nothing to do here
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Writer2ReaderDataPipe.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Writer2ReaderDataPipe.java
new file mode 100755
index 0000000000..c66d0fd934
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/Writer2ReaderDataPipe.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.xml;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+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;
+
+@Service(Transformer.class)
+public class Writer2ReaderDataPipe extends TransformerExtension<Writer, Reader> implements DataPipe<Writer, Reader> {
+
+ private StringWriter writer = new StringWriter();
+
+ public Reader getResult() {
+ return new StringReader(writer.toString());
+ }
+
+ public Class getTargetType() {
+ return Reader.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+ public Writer getSink() {
+ return writer;
+ }
+
+ public Class getSourceType() {
+ return Writer.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLDocumentStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLDocumentStreamReader.java
new file mode 100644
index 0000000000..993516fa19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLDocumentStreamReader.java
@@ -0,0 +1,432 @@
+package org.apache.tuscany.core.databinding.xml;
+
+import java.util.NoSuchElementException;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * This class is derived from Apache Axis2 class
+ * org.apache.axis2.util.StreamWrapper</a>. It's used wrap a XMLStreamReader to
+ * create a XMLStreamReader representing a document and it will produce
+ * START_DOCUMENT, END_DOCUMENT events.
+ */
+public class XMLDocumentStreamReader implements XMLStreamReader {
+ private static final int STATE_COMPLETE_AT_NEXT = 2; // The wrapper
+ // will produce
+ // END_DOCUMENT
+
+ private static final int STATE_COMPLETED = 3; // Done
+
+ private static final int STATE_INIT = 0; // The wrapper will produce
+ // START_DOCUMENT
+
+ private static final int STATE_SWITCHED = 1; // The real reader will
+ // produce events
+
+ private XMLStreamReader realReader;
+
+ private int state = STATE_INIT;
+
+ public XMLDocumentStreamReader(XMLStreamReader realReader) {
+ if (realReader == null) {
+ throw new UnsupportedOperationException("Reader cannot be null");
+ }
+
+ this.realReader = realReader;
+
+ if (realReader instanceof XMLFragmentStreamReader) {
+ ((XMLFragmentStreamReader)realReader).init();
+ }
+
+ // If the real reader is positioned at START_DOCUMENT, always use
+ // the real reader
+ if (realReader.getEventType() == START_DOCUMENT) {
+ state = STATE_SWITCHED;
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ realReader.close();
+ }
+
+ public int getAttributeCount() {
+ if (isDelegating()) {
+ return realReader.getAttributeCount();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeLocalName(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public QName getAttributeName(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeName(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeNamespace(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributePrefix(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeType(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeType(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeValue(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeValue(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeValue(String s, String s1) {
+ if (isDelegating()) {
+ return realReader.getAttributeValue(s, s1);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getCharacterEncodingScheme() {
+ return realReader.getCharacterEncodingScheme();
+ }
+
+ public String getElementText() throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.getElementText();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public String getEncoding() {
+ return realReader.getEncoding();
+ }
+
+ public int getEventType() {
+ int event = -1;
+ switch (state) {
+ case STATE_SWITCHED:
+ case STATE_COMPLETE_AT_NEXT:
+ event = realReader.getEventType();
+ break;
+ case STATE_INIT:
+ event = START_DOCUMENT;
+ break;
+ case STATE_COMPLETED:
+ event = END_DOCUMENT;
+ break;
+ }
+ return event;
+ }
+
+ public String getLocalName() {
+ if (isDelegating()) {
+ return realReader.getLocalName();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public Location getLocation() {
+ if (isDelegating()) {
+ return realReader.getLocation();
+ } else {
+ return null;
+ }
+ }
+
+ public QName getName() {
+ if (isDelegating()) {
+ return realReader.getName();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return realReader.getNamespaceContext();
+ }
+
+ public int getNamespaceCount() {
+ if (isDelegating()) {
+ return realReader.getNamespaceCount();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespacePrefix(int i) {
+ if (isDelegating()) {
+ return realReader.getNamespacePrefix(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI() {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI(int i) {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI(String s) {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI(s);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPIData() {
+ if (isDelegating()) {
+ return realReader.getPIData();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPITarget() {
+ if (isDelegating()) {
+ return realReader.getPITarget();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPrefix() {
+ if (isDelegating()) {
+ return realReader.getPrefix();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public Object getProperty(String s) throws IllegalArgumentException {
+ if (isDelegating()) {
+ return realReader.getProperty(s);
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public String getText() {
+ if (isDelegating()) {
+ return realReader.getText();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (isDelegating()) {
+ return realReader.getTextCharacters();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.getTextCharacters(i, chars, i1, i2);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (isDelegating()) {
+ return realReader.getTextLength();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextStart() {
+ if (isDelegating()) {
+ return realReader.getTextStart();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getVersion() {
+ if (isDelegating()) {
+ return realReader.getVersion();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasName() {
+ if (isDelegating()) {
+ return realReader.hasName();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ if (state == STATE_COMPLETE_AT_NEXT) {
+ return true;
+ } else if (state == STATE_COMPLETED) {
+ return false;
+ } else if (state == STATE_SWITCHED) {
+ return realReader.hasNext();
+ } else {
+ return true;
+ }
+ }
+
+ public boolean hasText() {
+ if (isDelegating()) {
+ return realReader.hasText();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ if (isDelegating()) {
+ return realReader.isAttributeSpecified(i);
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isCharacters() {
+ if (isDelegating()) {
+ return realReader.isCharacters();
+ } else {
+ return false;
+ }
+ }
+
+ private boolean isDelegating() {
+ return state == STATE_SWITCHED || state == STATE_COMPLETE_AT_NEXT;
+ }
+
+ public boolean isEndElement() {
+ if (isDelegating()) {
+ return realReader.isEndElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isStandalone() {
+ if (isDelegating()) {
+ return realReader.isStandalone();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isStartElement() {
+ if (isDelegating()) {
+ return realReader.isStartElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isWhiteSpace() {
+ if (isDelegating()) {
+ return realReader.isWhiteSpace();
+ } else {
+ return false;
+ }
+ }
+
+ public int next() throws XMLStreamException {
+ int returnEvent;
+
+ switch (state) {
+ case STATE_SWITCHED:
+ returnEvent = realReader.next();
+ if (returnEvent == END_DOCUMENT) {
+ state = STATE_COMPLETED;
+ } else if (!realReader.hasNext()) {
+ state = STATE_COMPLETE_AT_NEXT;
+ }
+ break;
+ case STATE_INIT:
+ state = STATE_SWITCHED;
+ returnEvent = realReader.getEventType();
+ break;
+ case STATE_COMPLETE_AT_NEXT:
+ state = STATE_COMPLETED;
+ returnEvent = END_DOCUMENT;
+ break;
+ case STATE_COMPLETED:
+ // oops - no way we can go beyond this
+ throw new NoSuchElementException("End of stream has reached.");
+ default:
+ throw new UnsupportedOperationException();
+ }
+
+ return returnEvent;
+ }
+
+ public int nextTag() throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.nextTag();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public void require(int i, String s, String s1) throws XMLStreamException {
+ if (isDelegating()) {
+ realReader.require(i, s, s1);
+ }
+ }
+
+ public boolean standaloneSet() {
+ if (isDelegating()) {
+ return realReader.standaloneSet();
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReader.java
new file mode 100644
index 0000000000..f54a43bb29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReader.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.core.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+public interface XMLFragmentStreamReader extends XMLStreamReader {
+ QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
+ String NIL_VALUE_TRUE = "true";
+
+ /**
+ * this will help to handle Text within the current element. user should
+ * pass the element text to the property list as this ELEMENT_TEXT as the
+ * key. This key deliberately has a space in it so that it is not a valid
+ * XML name
+ */
+ String ELEMENT_TEXT = "Element Text";
+
+ /**
+ * Extra method to query the state of the pullparser
+ */
+ boolean isDone();
+
+ /**
+ * add the parent namespace context to this parser
+ */
+ void setParentNamespaceContext(NamespaceContext nsContext);
+
+ /**
+ * Initiate the parser - this will do whatever the needed tasks to initiate
+ * the parser and must be called before attempting any specific parsing
+ * using this parser
+ */
+ void init();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReaderImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReaderImpl.java
new file mode 100644
index 0000000000..fe67225f81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLFragmentStreamReaderImpl.java
@@ -0,0 +1,857 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * This is the new implementation of the XMLFramentStreamReader. The approach
+ * here is simple When the pull parser needs to generate events for a particular
+ * name-value(s) pair it always handes over (delegates) the task to another pull
+ * parser which knows how to deal with it The common types of name value pairs
+ * we'll come across are
+ * <ul>
+ * <li> String name/QName name - String value
+ * <li> String name/QName name - String[] value
+ * <li> QName name/String name - XMLStreamReader value
+ * <li> QName name/String name - XMLStreamable value
+ * <li> QName name/String name - Java bean
+ * <li> QName name/String name - Datahandler
+ *
+ * </ul>
+ * <p/> As for the attributes, these are the possible combinations in the array
+ * <ul>
+ * <li> String name/QName name - String value
+ * </ul>
+ * Note that certain array methods have been deliberately removed to avoid
+ * complications. The generated code will take the trouble to lay the elements
+ * of the array in the correct order <p/> <p/> Hence there will be a parser impl
+ * that knows how to handle these types, and this parent parser will always
+ * delegate these tasks to the child pullparasers in effect this is one huge
+ * state machine that has only a few states and delegates things down to the
+ * child parsers whenever possible <p/>
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLFragmentStreamReaderImpl implements XMLFragmentStreamReader {
+
+ private static final int DELEGATED_STATE = 2;
+ private static final int END_ELEMENT_STATE = 1;
+ // states for this pullparser - it can only have four states
+ private static final int START_ELEMENT_STATE = 0;
+ private static final int TEXT_STATE = 3;
+
+ protected NamedProperty[] attributes;
+
+ // reference to the child reader
+ protected XMLFragmentStreamReader childReader;
+ // current property index
+ // initialized at zero
+ protected int index;
+ protected Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
+ protected QName elementQName;
+
+ // we always create a new namespace context
+ protected DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
+
+ protected NamedProperty[] elements;
+
+ // integer field that keeps the state of this
+ // parser.
+ protected int state = START_ELEMENT_STATE;
+
+ /*
+ * we need to pass in a namespace context since when delegated, we've no
+ * idea of the current namespace context. So it needs to be passed on here!
+ */
+ public XMLFragmentStreamReaderImpl(QName elementQName, NamedProperty[] elements, NamedProperty[] attributes) {
+ // validate the lengths, since both the arrays are supposed
+ // to have
+ this.elements = elements == null ? new NamedProperty[0] : elements;
+ this.elementQName = elementQName;
+ this.attributes = attributes == null ? new NamedProperty[0] : attributes;
+ }
+
+ protected XMLFragmentStreamReaderImpl(QName elementQName) {
+ this.elementQName = elementQName;
+ }
+
+ /**
+ * add the namespace context
+ */
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // register the namespace context passed in to this
+ this.namespaceContext.setParentNsContext(nsContext);
+
+ }
+
+ protected NamedProperty[] getElements() {
+ return elements;
+ }
+
+ protected NamedProperty[] getAttributes() {
+ return attributes;
+ }
+
+ protected QName[] getNamespaces() {
+ return new QName[0];
+ }
+
+ /**
+ * @param prefix
+ * @param uri
+ */
+ protected void addToNsMap(String prefix, String uri) {
+ if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
+ namespaceContext.pushNamespace(prefix, uri);
+ declaredNamespaceMap.put(prefix, uri);
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ // do nothing here - we have no resources to free
+ }
+
+ public int getAttributeCount() {
+ return (state == DELEGATED_STATE) ? childReader.getAttributeCount() : (state == START_ELEMENT_STATE
+ ? getAttributes().length : 0);
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeLocalName(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getLocalPart();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * @param i
+ */
+ public QName getAttributeName(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeName(i);
+ } else if (state == START_ELEMENT_STATE) {
+ if ((i >= (getAttributes().length)) || i < 0) { // out of range
+ return null;
+ } else {
+ // get the attribute pointer
+ QName attribPointer = getAttributes()[i].getKey();
+ // case one - attrib name is null
+ // this should be the pointer to the OMAttribute then
+ if (attribPointer == null) {
+ throw new UnsupportedOperationException();
+ } else if (attribPointer instanceof QName) {
+ return (QName)attribPointer;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ throw new IllegalStateException(); // as per the api contract
+ }
+
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeNamespace(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getNamespaceURI();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributePrefix(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getPrefix();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeType(int i) {
+ return null; // not supported
+ }
+
+ public String getAttributeValue(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeValue(i);
+ } else if (state == START_ELEMENT_STATE) {
+ if ((i >= (getAttributes().length)) || i < 0) { // out of range
+ return null;
+ } else {
+ // get the attribute pointer
+ QName attribPointer = getAttributes()[i].getKey();
+ Object omAttribObj = getAttributes()[i].getValue();
+ // case one - attrib name is null
+ // this should be the pointer to the OMAttribute then
+ if (attribPointer == null) {
+ throw new UnsupportedOperationException();
+ } else if (attribPointer instanceof QName) {
+ return (String)omAttribObj;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getAttributeValue(String nsUri, String localName) {
+
+ int attribCount = getAttributeCount();
+ String returnValue = null;
+ QName attribQualifiedName;
+ for (int i = 0; i < attribCount; i++) {
+ attribQualifiedName = getAttributeName(i);
+ if (nsUri == null) {
+ if (localName.equals(attribQualifiedName.getLocalPart())) {
+ returnValue = getAttributeValue(i);
+ break;
+ }
+ } else {
+ if (localName.equals(attribQualifiedName.getLocalPart()) && nsUri.equals(attribQualifiedName
+ .getNamespaceURI())) {
+ returnValue = getAttributeValue(i);
+ break;
+ }
+ }
+
+ }
+
+ return returnValue;
+ }
+
+ public String getCharacterEncodingScheme() {
+ return null; // todo - should we return something for this ?
+ }
+
+ /**
+ * todo implement the right contract for this
+ *
+ * @throws XMLStreamException
+ */
+ public String getElementText() throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ return childReader.getElementText();
+ } else {
+ return null;
+ }
+
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // / attribute handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ public String getEncoding() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getEncoding();
+ } else {
+ // we've no idea what the encoding is going to be in this case
+ // perhaps we ought to return some constant here, which the user
+ // might
+ // have access to change!
+ return null;
+ }
+ }
+
+ public int getEventType() {
+ if (state == START_ELEMENT_STATE) {
+ return START_ELEMENT;
+ } else if (state == END_ELEMENT_STATE) {
+ return END_ELEMENT;
+ } else if (state == TEXT_STATE) {
+ return CHARACTERS;
+ } else { // this is the delegated state
+ return childReader.getEventType();
+ }
+ }
+
+ public String getLocalName() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getLocalName();
+ } else if (state != TEXT_STATE) {
+ return elementQName.getLocalPart();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ */
+ public Location getLocation() {
+ // return a default location
+ 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() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getName();
+ } else if (state != TEXT_STATE) {
+ return elementQName;
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceContext();
+ } else {
+ return namespaceContext;
+ }
+
+ }
+
+ public int getNamespaceCount() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceCount();
+ } else {
+ return declaredNamespaceMap.size();
+ }
+ }
+
+ /**
+ * @param i
+ */
+ public String getNamespacePrefix(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespacePrefix(i);
+ } else if (state != TEXT_STATE) {
+ // order the prefixes
+ String[] prefixes = makePrefixArray();
+ if ((i >= prefixes.length) || (i < 0)) {
+ return null;
+ } else {
+ return prefixes[i];
+ }
+
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getNamespaceURI() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceURI();
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else {
+ return elementQName.getNamespaceURI();
+ }
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // //////////// end of attribute handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ // //////////////////////////////////////////////////////////////////////////
+ // //////////// namespace handling
+ // //////////////////////////////////////////////////////////////////////////
+
+ public String getNamespaceURI(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceURI(i);
+ } else if (state != TEXT_STATE) {
+ String namespacePrefix = getNamespacePrefix(i);
+ return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix);
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return namespaceContext.getNamespaceURI(prefix);
+ }
+
+ public String getPIData() {
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPITarget() {
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPrefix() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getPrefix();
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else {
+ String prefix = elementQName.getPrefix();
+ return "".equals(prefix) ? null : prefix;
+ }
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // /////// end of namespace handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public Object getProperty(String key) throws IllegalArgumentException {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return null;
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else if (state == DELEGATED_STATE) {
+ return childReader.getProperty(key);
+ } else {
+ return null;
+ }
+
+ }
+
+ public String getText() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getText();
+ } else if (state == TEXT_STATE) {
+ return (String)getElements()[index - 1].getValue();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextCharacters();
+ } else if (state == TEXT_STATE) {
+ return getElements()[index - 1].getValue() == null ? new char[0] : ((String)getElements()[index - 1]
+ .getValue()).toCharArray();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ private int copy(int sourceStart, char[] target, int targetStart, int length) {
+ char[] source = getTextCharacters();
+ if (sourceStart > source.length) {
+ throw new IndexOutOfBoundsException("source start > source length");
+ }
+ int sourceLen = source.length - sourceStart;
+ if (length > sourceLen) {
+ length = sourceLen;
+ }
+ System.arraycopy(source, sourceStart, target, targetStart, length);
+ return sourceLen;
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextCharacters(i, chars, i1, i2);
+ } else if (state == TEXT_STATE) {
+ return copy(i, chars, i1, i2);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextLength();
+ } else if (state == TEXT_STATE) {
+ return getTextCharacters().length;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextStart() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextStart();
+ } else if (state == TEXT_STATE) {
+ return 0; // assume text always starts at 0
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getVersion() {
+ return null;
+ }
+
+ public boolean hasName() {
+ // since this parser always has a name, the hasname
+ // has to return true if we are still navigating this element
+ // if not we should ask the child reader for it.
+ if (state == DELEGATED_STATE) {
+ return childReader.hasName();
+ } else {
+ return state != TEXT_STATE;
+ }
+ }
+
+ /**
+ * @throws XMLStreamException
+ */
+ public boolean hasNext() throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ if (childReader.isDone()) {
+ // the child reader is done. We shouldn't be getting the
+ // hasnext result from the child pullparser then
+ return true;
+ } else {
+ return childReader.hasNext();
+ }
+ } else {
+ return state == START_ELEMENT_STATE || state == TEXT_STATE;
+
+ }
+ }
+
+ /**
+ * check the validity of this implementation
+ */
+ public boolean hasText() {
+ if (state == DELEGATED_STATE) {
+ return childReader.hasText();
+ } else {
+ return state == TEXT_STATE;
+ }
+
+ }
+
+ /**
+ * we need to split out the calling to the populate namespaces seperately
+ * since this needs to be done *after* setting the parent namespace context.
+ * We cannot assume it will happen at construction!
+ */
+ public void init() {
+ // here we have an extra issue to attend to. we need to look at the
+ // prefixes and uris (the combination) and populate a hashmap of
+ // namespaces. The hashmap of namespaces will be used to serve the
+ // namespace context
+
+ populateNamespaceContext();
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return false; // not supported
+ }
+
+ public boolean isCharacters() {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isCharacters();
+ }
+
+ /**
+ * are we done ?
+ */
+ public boolean isDone() {
+ return state == END_ELEMENT_STATE;
+ }
+
+ public boolean isEndElement() {
+ if (state == START_ELEMENT_STATE) {
+ return false;
+ } else if (state == END_ELEMENT_STATE) {
+ return true;
+ }
+ return childReader.isEndElement();
+ }
+
+ public boolean isStandalone() {
+ return true;
+ }
+
+ public boolean isStartElement() {
+ if (state == START_ELEMENT_STATE) {
+ return true;
+ } else if (state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isStartElement();
+ }
+
+ public boolean isWhiteSpace() {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isWhiteSpace();
+ }
+
+ /**
+ * Get the prefix list from the hastable and take that into an array
+ */
+ private String[] makePrefixArray() {
+ String[] prefixes = (String[])declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
+ Arrays.sort(prefixes);
+ return prefixes;
+ }
+
+ /**
+ * By far this should be the most important method in this class this method
+ * changes the state of the parser
+ */
+ public int next() throws XMLStreamException {
+ int returnEvent = -1; // invalid state is the default state
+ switch (state) {
+ case START_ELEMENT_STATE:
+ // current element is start element. We should be looking at the
+ // property list and making a pullparser for the property value
+ if (getElements() == null || getElements().length == 0) {
+ // no properties - move to the end element state
+ // straightaway
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ // there are properties. now we should delegate this task to
+ // a
+ // child reader depending on the property type
+ returnEvent = processProperties();
+
+ }
+ break;
+ case END_ELEMENT_STATE:
+ // we've reached the end element already. If the user tries to
+ // push
+ // further ahead then it is an exception
+ throw new XMLStreamException("Trying to go beyond the end of the pullparser");
+
+ case DELEGATED_STATE:
+ if (childReader.isDone()) {
+ // we've reached the end!
+ if (index > (getElements().length - 1)) {
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ returnEvent = processProperties();
+ }
+ } else {
+ returnEvent = childReader.next();
+ }
+ break;
+
+ case TEXT_STATE:
+ // if there are any more event we should be delegating to
+ // processProperties. if not we just return an end element
+ if (index > (getElements().length - 1)) {
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ returnEvent = processProperties();
+ }
+ break;
+ }
+ return returnEvent;
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // / Other utility methods
+ // ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * todo implement this
+ *
+ * @throws XMLStreamException
+ */
+ public int nextTag() throws XMLStreamException {
+ return 0;
+ }
+
+ /**
+ * Populates a namespace context
+ */
+ private void populateNamespaceContext() {
+
+ // first add the current element namespace to the namespace context
+ // declare it if not found
+ addToNsMap(elementQName.getPrefix(), elementQName.getNamespaceURI());
+
+ for (QName n : getNamespaces()) {
+ addToNsMap(n.getPrefix(), n.getNamespaceURI());
+ }
+
+ // traverse through the attributes and populate the namespace context
+ // the attrib list can be of many combinations
+ // the valid combinations are
+ // String - String
+ // QName - QName
+ // null - OMAttribute
+
+ for (int i = 0; i < getAttributes().length; i++) { // jump in two
+ QName attrQName = getAttributes()[i].getKey();
+ if (!"".equals(attrQName.getNamespaceURI())) {
+ addToNsMap(attrQName.getPrefix(), attrQName.getNamespaceURI());
+ }
+ }
+ }
+
+ /**
+ * A convenient method to reuse the properties
+ *
+ * @return event to be thrown
+ * @throws XMLStreamException
+ */
+ private int processProperties() throws XMLStreamException {
+ // move to the next property depending on the current property
+ // index
+ QName propertyQName = getElements()[index].getKey();
+ boolean textFound = false;
+ if (propertyQName == null) {
+ throw new XMLStreamException("property key cannot be null!");
+ } else if (ELEMENT_TEXT.equals(propertyQName.getLocalPart())) {
+ // propPointer being a String has a special case
+ // that is it can be a the special constant ELEMENT_TEXT that
+ // says this text event
+ textFound = true;
+ }
+
+ // ok! we got the key. Now look at the value
+ Object propertyValue = getElements()[index].getValue();
+ // cater for the special case now
+ if (textFound) {
+ // no delegation here - make the parser null and immediately
+ // return with the event characters
+ childReader = null;
+ state = TEXT_STATE;
+ ++index;
+ return CHARACTERS;
+ } else if (propertyValue == null) {
+ // if the value is null we delegate the work to a nullable
+ // parser
+ childReader = new NilElementStreamReader(propertyQName);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else if (propertyValue instanceof String) {
+ // strings are handled by the NameValuePairStreamReader
+ childReader = new NameValuePairStreamReader(propertyQName, (String)propertyValue);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else if (propertyValue instanceof String[]) {
+ // string[] are handled by the NameValueArrayStreamReader
+ // if the array is empty - skip it
+ if (((String[])propertyValue).length == 0) {
+ // advance the index
+ ++index;
+ return processProperties();
+ } else {
+ childReader = new NameValueArrayStreamReader(propertyQName, (String[])propertyValue);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ }
+
+ } else if (propertyValue instanceof XMLStreamable) {
+ // ADBbean has it's own method to get a reader
+ XMLStreamReader reader = ((XMLStreamable)propertyValue).getXMLStreamReader(propertyQName);
+ // we know for sure that this is an ADB XMLStreamreader.
+ // However we need to make sure that it is compatible
+ if (reader instanceof XMLFragmentStreamReader) {
+ childReader = (XMLFragmentStreamReader)reader;
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else {
+ // wrap it to make compatible
+ childReader = new WrappingXMLStreamReader(reader);
+ }
+ } else if (propertyValue instanceof XMLStreamReader) {
+ XMLStreamReader reader = (XMLStreamReader)propertyValue;
+ if (reader instanceof XMLFragmentStreamReader) {
+ childReader = (XMLFragmentStreamReader)reader;
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else {
+ // wrap it to make compatible
+ childReader = new WrappingXMLStreamReader(reader);
+ }
+
+ } else {
+ // all special possiblilities has been tried! Let's treat
+ // the thing as a bean and try generating events from it
+ childReader = new WrappingXMLStreamReader(BeanUtil.getXMLStreamReader(propertyValue, propertyQName));
+ // we cannot register the namespace context here
+ }
+
+ // set the state here
+ state = DELEGATED_STATE;
+ // we are done with the delegation
+ // increment the property index
+ ++index;
+ return childReader.getEventType();
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean standaloneSet() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLGroupDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLGroupDataBinding.java
new file mode 100644
index 0000000000..d206ff8b2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLGroupDataBinding.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.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.core.databinding.impl.GroupDataBinding;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * A Group DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLGroupDataBinding extends GroupDataBinding {
+
+ public XMLGroupDataBinding() {
+ super(new Class[] {InputStream.class, OutputStream.class, Reader.class, Writer.class, Source.class,
+ Result.class, InputSource.class, ContentHandler.class, XMLStreamReader.class,
+ XMLStreamWriter.class, XMLEventReader.class, XMLEventWriter.class});
+ }
+
+ @Override
+ protected Object getLogical(Class<?> markerType, Annotation[] annotations) {
+ return XMLType.UNKNOWN;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2Node.java
new file mode 100644
index 0000000000..6ecaa85be4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2Node.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 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 XMLStreamReader2Node extends TransformerExtension<XMLStreamReader, Node> implements
+ PullTransformer<XMLStreamReader, Node> {
+ private SAX2DOMPipe pipe = new SAX2DOMPipe();
+
+ private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
+
+ public Node transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ stax2sax.transform(source, pipe.getSink(), context);
+ return pipe.getResult();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.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/XMLStreamReader2SAX.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2SAX.java
new file mode 100644
index 0000000000..0c6f0b8df7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2SAX.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+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;
+
+/**
+ * XMLStreamReader to SAX events
+ */
+@Service(Transformer.class)
+public class XMLStreamReader2SAX extends TransformerExtension<XMLStreamReader, ContentHandler> implements
+ PushTransformer<XMLStreamReader, ContentHandler> {
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PushTransformer#getSourceType()
+ */
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PushTransformer#getSourceType()
+ */
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PushTransformer#getWeight()
+ */
+ public int getWeight() {
+ return 20;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.PushTransformer#transform(java.lang.Object,
+ * java.lang.Object,
+ * org.apache.tuscany.spi.databinding.TransformationContext)
+ */
+ public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext context) {
+ StAX2SAXAdapter adapter = new StAX2SAXAdapter(false);
+ try {
+ adapter.parse(source, sink);
+ } 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/xml/XMLStreamReader2String.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2String.java
new file mode 100755
index 0000000000..85ac7b5af6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamReader2String.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+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;
+
+@Service(Transformer.class)
+public class XMLStreamReader2String extends TransformerExtension<XMLStreamReader, String> implements
+ PullTransformer<XMLStreamReader, String> {
+
+ public String transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ return StAXHelper.save(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.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/XMLStreamSerializer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamSerializer.java
new file mode 100644
index 0000000000..8b44f526d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamSerializer.java
@@ -0,0 +1,266 @@
+package org.apache.tuscany.core.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * The XMLStreamSerializer pulls events from the XMLStreamReader and dumps into the XMLStreamWriter
+ */
+public class XMLStreamSerializer implements XMLStreamConstants {
+ public static final String NAMESPACE_PREFIX = "ns";
+ private static int namespaceSuffix;
+
+ /*
+ * The behavior of the serializer is such that it returns when it encounters the starting element for the second
+ * time. The depth variable tracks the depth of the serilizer and tells it when to return. Note that it is assumed
+ * that this serialization starts on an Element.
+ */
+
+ /**
+ * Field depth
+ */
+ private int depth;
+
+ /**
+ * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
+ *
+ * @param nsCtxt
+ * @return string
+ */
+ private String generateUniquePrefix(NamespaceContext nsCtxt) {
+ String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ // null should be returned if the prefix is not bound!
+ while (nsCtxt.getNamespaceURI(prefix) != null) {
+ prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Method serialize.
+ *
+ * @param node
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void serialize(XMLStreamReader node, XMLStreamWriter writer) throws XMLStreamException {
+ serializeNode(node, writer);
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeAttributes(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ int count = reader.getAttributeCount();
+ String prefix;
+ String namespaceName;
+ String writerPrefix;
+ for (int i = 0; i < count; i++) {
+ prefix = reader.getAttributePrefix(i);
+ namespaceName = reader.getAttributeNamespace(i);
+ /*
+ * Due to parser implementations returning null as the namespace URI (for the empty namespace) we need to
+ * make sure that we deal with a namespace name that is not null. The best way to work around this issue is
+ * to set the namespace uri to "" if it is null
+ */
+ if (namespaceName == null) {
+ namespaceName = "";
+ }
+
+ writerPrefix = writer.getNamespaceContext().getPrefix(namespaceName);
+
+ if (!"".equals(namespaceName)) {
+ // prefix has already being declared but this particular
+ // attrib has a
+ // no prefix attached. So use the prefix provided by the
+ // writer
+ if (writerPrefix != null && (prefix == null || prefix.equals(""))) {
+ writer.writeAttribute(writerPrefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // writer prefix is available but different from the
+ // current
+ // prefix of the attrib. We should be decalring the new
+ // prefix
+ // as a namespace declaration
+ } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) {
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // prefix is null (or empty), but the namespace name is
+ // valid! it has not
+ // being written previously also. So we need to generate
+ // a prefix
+ // here
+ } else if (prefix == null || prefix.equals("")) {
+ prefix = generateUniquePrefix(writer.getNamespaceContext());
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ } else {
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ }
+ } else {
+ // empty namespace is equal to no namespace!
+ writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i));
+ }
+
+ }
+ }
+
+ /**
+ * Method serializeCData.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeCData(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCData(reader.getText());
+ }
+
+ /**
+ * Method serializeComment.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeComment(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeComment(reader.getText());
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeElement(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix = reader.getPrefix();
+ String nameSpaceName = reader.getNamespaceURI();
+ if (nameSpaceName != null) {
+ String writerPrefix = writer.getPrefix(nameSpaceName);
+ if (writerPrefix != null) {
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ } else {
+ if (prefix != null) {
+ writer.writeStartElement(prefix, reader.getLocalName(), nameSpaceName);
+ writer.writeNamespace(prefix, nameSpaceName);
+ writer.setPrefix(prefix, nameSpaceName);
+ } else {
+ // [rfeng] We need to set default NS 1st before calling writeStateElement
+ writer.setDefaultNamespace(nameSpaceName);
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ writer.writeDefaultNamespace(nameSpaceName);
+ }
+ }
+ } else {
+ writer.writeStartElement(reader.getLocalName());
+ }
+
+ // add the namespaces
+ int count = reader.getNamespaceCount();
+ String namespacePrefix;
+ for (int i = 0; i < count; i++) {
+ namespacePrefix = reader.getNamespacePrefix(i);
+ // [rfeng] The following is commented out to allow to default ns
+ // if (namespacePrefix != null && namespacePrefix.length() == 0) {
+ // continue;
+ // }
+
+ serializeNamespace(namespacePrefix, reader.getNamespaceURI(i), writer);
+ }
+
+ // add attributes
+ serializeAttributes(reader, writer);
+
+ }
+
+ /**
+ * Method serializeEndElement.
+ *
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeEndElement(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ /**
+ * Method serializeNamespace.
+ *
+ * @param prefix
+ * @param uri
+ * @param writer
+ * @throws XMLStreamException
+ */
+ private void serializeNamespace(String prefix, String uri, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix1 = writer.getPrefix(uri);
+ if (prefix1 == null) {
+ writer.writeNamespace(prefix, uri);
+ writer.setPrefix(prefix, uri);
+ }
+ }
+
+ /**
+ * Method serializeNode.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ while (true) {
+ int event = reader.getEventType();
+ if (event == START_ELEMENT) {
+ serializeElement(reader, writer);
+ depth++;
+ } else if (event == ATTRIBUTE) {
+ serializeAttributes(reader, writer);
+ } else if (event == CHARACTERS) {
+ serializeText(reader, writer);
+ } else if (event == COMMENT) {
+ serializeComment(reader, writer);
+ } else if (event == CDATA) {
+ serializeCData(reader, writer);
+ } else if (event == END_ELEMENT) {
+ serializeEndElement(writer);
+ depth--;
+ } else if (event == START_DOCUMENT) {
+ depth++; // if a start document is found then increment
+ writer.writeStartDocument();
+ // the depth
+ } else if (event == END_DOCUMENT) {
+ if (depth != 0) {
+ depth--; // for the end document - reduce the depth
+ }
+ writer.writeEndDocument();
+ }
+ if (depth == 0) {
+ break;
+ }
+ if (reader.hasNext()) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCharacters(reader.getText());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamable.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamable.java
new file mode 100644
index 0000000000..285e5cdf60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStreamable.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.databinding.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * An interface represents data that can be read using StAX streaming
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XMLStreamable {
+ /**
+ * Get the XMLStreamReader for StAX processing
+ *
+ * @param rootElementName the name of the element to be generated
+ * @return Returns a pull parser.
+ */
+ XMLStreamReader getXMLStreamReader(QName rootElementName);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java
new file mode 100644
index 0000000000..4d8925c3b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.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.core.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * A DataBinding for the XML string
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLStringDataBinding extends DataBindingExtension {
+ public static final String NAME = String.class.getName();
+ public static final String[] ALIASES = new String[] {"xml.string"};
+
+ public XMLStringDataBinding() {
+ super(NAME, ALIASES, String.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (registry.getDataBinding(type.getDataBinding()) == this) {
+ type.setDataBinding(getName());
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
new file mode 100644
index 0000000000..c931cccde9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.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.deployer;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * Base class for DeploymentContext implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractDeploymentContext implements DeploymentContext {
+ private final ClassLoader classLoader;
+ private final URL scdlLocation;
+ private final Map<String, Object> properties = new HashMap<String, Object>();
+
+ protected AbstractDeploymentContext(ClassLoader classLoader, URL scdlLocation) {
+ this.classLoader = classLoader;
+ this.scdlLocation = scdlLocation;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public URL getScdlLocation() {
+ return scdlLocation;
+ }
+
+ public Object getExtension(String name) {
+ return properties.get(name);
+ }
+
+ public void putExtension(String name, Object value) {
+ if (value == null) {
+ properties.remove(name);
+ } else {
+ properties.put(name, value);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
new file mode 100644
index 0000000000..c489ba04c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.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.deployer;
+
+import java.net.URL;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * An holder that can be used during the load process to store information that is not part of the logical assembly
+ * model. This should be regarded as transient and references to this context should not be stored inside the model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ChildDeploymentContext extends AbstractDeploymentContext {
+ private final DeploymentContext parent;
+
+ /**
+ * Constructor specifying the loader for application resources.
+ *
+ * @param parent the parent of this context
+ * @param classLoader the loader for application resources
+ * @param scdlLocation the location of the SCDL being deployed
+ */
+ public ChildDeploymentContext(DeploymentContext parent, ClassLoader classLoader, URL scdlLocation) {
+ super(classLoader, scdlLocation);
+ assert parent != null;
+ this.parent = parent;
+ }
+
+ public DeploymentContext getParent() {
+ return parent;
+ }
+
+ public XMLInputFactory getXmlFactory() {
+ return parent.getXmlFactory();
+ }
+
+ public ScopeContainer getCompositeScope() {
+ return parent.getCompositeScope();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
new file mode 100644
index 0000000000..ce5858ae1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.deployer;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.Builder;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.BuilderInstantiationException;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.PrepareException;
+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.deployer.Deployer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.loader.Loader;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+
+import org.apache.tuscany.api.annotation.Monitor;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+
+/**
+ * Default implementation of Deployer.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DeployerImpl implements Deployer {
+ private Loader loader;
+ protected XMLInputFactory xmlFactory;
+ protected Builder builder;
+ protected ScopeContainerMonitor monitor;
+
+ public DeployerImpl(XMLInputFactory xmlFactory, Loader loader, Builder builder) {
+ this.xmlFactory = xmlFactory;
+ this.loader = loader;
+ this.builder = builder;
+ }
+
+ public DeployerImpl() {
+ xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ @Autowire
+ public void setLoader(LoaderRegistry loader) {
+ this.loader = loader;
+ }
+
+ @Autowire
+ public void setBuilder(BuilderRegistry builder) {
+ this.builder = builder;
+ }
+
+ @Monitor
+ public void setMonitor(ScopeContainerMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public <I extends Implementation<?>> Component deploy(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition)
+ throws LoaderException, BuilderException, PrepareException {
+ final ScopeContainer scopeContainer = new CompositeScopeContainer(monitor);
+ scopeContainer.start();
+ DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, scopeContainer, null);
+ try {
+ load(parent, componentDefinition, deploymentContext);
+ } catch (LoaderException e) {
+ e.addContextName(componentDefinition.getName());
+ throw e;
+ }
+ Component component = (Component) build(parent, componentDefinition, deploymentContext);
+ // create a listener so the scope container is shutdown when the top-level composite stops
+ RuntimeEventListener listener = new RuntimeEventListener() {
+ public void onEvent(Event event) {
+ scopeContainer.onEvent(event);
+ if (event instanceof CompositeStop) {
+ scopeContainer.stop();
+ }
+ }
+ };
+ component.addListener(listener);
+ component.prepare();
+ try {
+ parent.register(component);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering component", e);
+ }
+ return component;
+ }
+
+ public <I extends Implementation<?>> Component deployFromContribution(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition) throws BuilderException, PrepareException {
+ final ScopeContainer scopeContainer = new CompositeScopeContainer(monitor);
+ scopeContainer.start();
+ DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, scopeContainer, null);
+// try {
+// load(parent, componentDefinition, deploymentContext);
+// } catch (LoaderException e) {
+// e.addContextName(componentDefinition.getName());
+// throw e;
+// }
+ Component component = (Component) build(parent, componentDefinition, deploymentContext);
+ // create a listener so the scope container is shutdown when the top-level composite stops
+ RuntimeEventListener listener = new RuntimeEventListener() {
+ public void onEvent(Event event) {
+ scopeContainer.onEvent(event);
+ if (event instanceof CompositeStop) {
+ scopeContainer.stop();
+ }
+ }
+ };
+ component.addListener(listener);
+ component.prepare();
+ try {
+ parent.register(component);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering component", e);
+ }
+ return component;
+ }
+
+ /**
+ * Load the componentDefinition type information for the componentDefinition being deployed. For a typical
+ * deployment this will result in the SCDL definition being loaded.
+ *
+ * @param componentDefinition the componentDefinition being deployed
+ * @param deploymentContext the current deployment context
+ */
+ protected <I extends Implementation<?>> void load(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition,
+ DeploymentContext deploymentContext) throws LoaderException {
+ loader.loadComponentType(parent, componentDefinition.getImplementation(), deploymentContext);
+ }
+
+ /**
+ * Build the runtime context for a loaded componentDefinition.
+ *
+ * @param parent the context that will be the parent of the new sub-context
+ * @param componentDefinition the componentDefinition being deployed
+ * @param deploymentContext the current deployment context
+ * @return the new runtime context
+ */
+ protected <I extends Implementation<?>> SCAObject build(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition,
+ DeploymentContext deploymentContext)
+ throws BuilderException {
+ return builder.build(parent, componentDefinition, deploymentContext);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
new file mode 100644
index 0000000000..be5cc56d51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.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.deployer;
+
+import java.net.URL;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * A holder that can be used during the load process to store information that is not part of the logical assembly
+ * model. This should be regarded as transient and references to this context should not be stored inside the model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RootDeploymentContext extends AbstractDeploymentContext {
+ private final XMLInputFactory xmlFactory;
+ private final ScopeContainer scopeContainer;
+
+ /**
+ * Constructor specifying the loader for application resources.
+ *
+ * @param classLoader the loader for application resources
+ * @param xmlFactory a factory that can be used to obtain an StAX XMLStreamReader
+ * @param scopeContainer the scope context representing this deployment's COMPOSITE scope
+ * @param scdlLocation the location of the SCDL being deployed
+ */
+ public RootDeploymentContext(ClassLoader classLoader,
+ XMLInputFactory xmlFactory,
+ ScopeContainer scopeContainer,
+ URL scdlLocation) {
+ super(classLoader, scdlLocation);
+ this.xmlFactory = xmlFactory;
+ this.scopeContainer = scopeContainer;
+ }
+
+ public DeploymentContext getParent() {
+ return null;
+ }
+
+ public XMLInputFactory getXmlFactory() {
+ return xmlFactory;
+ }
+
+ public ScopeContainer getCompositeScope() {
+ return scopeContainer;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
new file mode 100644
index 0000000000..934510df27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/federation/FederatedDeployer.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.deployer.federation;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.deployer.DeployerImpl;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.PrepareException;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.marshaller.MarshalException;
+import org.apache.tuscany.spi.marshaller.ModelMarshaller;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.services.discovery.DiscoveryService;
+import org.apache.tuscany.spi.services.discovery.RequestListener;
+
+/**
+ * Federated deployer that deploys components in response to asynchronous
+ * messages from the federated domain.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class FederatedDeployer extends DeployerImpl implements RequestListener {
+
+ /** QName of the message. */
+ private static final QName MESSAGE_TYPE = new QName("http://www.osoa.org/xmlns/sca/1.0", "composite");
+
+ /** Marshaller. */
+ private ModelMarshaller<ComponentDefinition<?>> marshaller;
+
+ /**
+ * Deploys the component.
+ * @param content SCDL content.
+ * @return Response to the request message.
+ *
+ * TODO Handle response messages.
+ */
+ public XMLStreamReader onRequest(XMLStreamReader content) {
+
+ // TODO get this from somewhere
+ final CompositeComponent parent = null;
+
+ final ScopeContainer scopeContainer = new CompositeScopeContainer(monitor);
+ scopeContainer.start();
+
+ final DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, scopeContainer, null);
+
+ try {
+
+ final ComponentDefinition<?> definition = marshaller.unmarshall(content, false);
+ final Component component = (Component) builder.build(parent, definition, deploymentContext);
+
+ component.prepare();
+ component.start();
+
+ } catch (MarshalException ex) {
+ return null;
+ } catch (BuilderException ex) {
+ return null;
+ } catch (PrepareException ex) {
+ return null;
+ }
+
+ return null;
+ }
+
+ /**
+ * Injects the discovery service.
+ * @param discoveryService Discovery service to be injected.
+ */
+ @Autowire
+ public void setDiscoveryService(DiscoveryService discoveryService) {
+ discoveryService.registerRequestListener(MESSAGE_TYPE, this);
+ }
+
+ /**
+ * Injects the model marshaller.
+ * @param marshaller Marshaller.
+ */
+ @Autowire
+ public void setMarshaller(ModelMarshaller<ComponentDefinition<?>> marshaller) {
+ this.marshaller = marshaller;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/IllegalCallbackException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/IllegalCallbackException.java
new file mode 100644
index 0000000000..f52bd4cfb1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/IllegalCallbackException.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.core.idl.java;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * Denotes an illegal callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class IllegalCallbackException extends InvalidServiceContractException {
+
+ public IllegalCallbackException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/InterfaceJavaLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/InterfaceJavaLoader.java
new file mode 100644
index 0000000000..5ca25bb0e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/InterfaceJavaLoader.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.core.idl.java;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+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.InteractionScope;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+
+/**
+ * Loads a Java interface definition from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class InterfaceJavaLoader extends LoaderExtension<JavaServiceContract> {
+ public static final QName INTERFACE_JAVA = new QName(SCA_NS, "interface.java");
+
+ private final JavaInterfaceProcessorRegistry interfaceRegsitry;
+
+ @Constructor({"registry", "interfaceRegsitry"})
+ public InterfaceJavaLoader(@Autowire LoaderRegistry registry,
+ @Autowire JavaInterfaceProcessorRegistry interfaceRegistry) {
+ super(registry);
+ this.interfaceRegsitry = interfaceRegistry;
+ }
+
+ public QName getXMLType() {
+ return INTERFACE_JAVA;
+ }
+
+ public JavaServiceContract load(CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ assert INTERFACE_JAVA.equals(reader.getName());
+ InteractionScope interactionScope = StaxUtil.interactionScope(reader.getAttributeValue(null, "scope"));
+ String name = reader.getAttributeValue(null, "interface");
+ if (name == null) {
+ // allow "class" as well as seems to be a common mistake
+ name = reader.getAttributeValue(null, "class");
+ }
+ if (name == null) {
+ throw new InvalidValueException("interface name not supplied");
+ }
+ Class<?> interfaceClass = LoaderUtil.loadClass(name, deploymentContext.getClassLoader());
+
+ name = reader.getAttributeValue(null, "callbackInterface");
+ Class<?> callbackClass = (name != null) ? LoaderUtil.loadClass(name, deploymentContext.getClassLoader()) : null;
+
+ Map<Class<?>, ModelObject> extensions = new HashMap<Class<?>, ModelObject>();
+ while (true) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ ModelObject mo = registry.load(parent, null, reader, deploymentContext);
+ if (mo != null) {
+ extensions.put(mo.getClass(), mo);
+ }
+ } else if (event == XMLStreamConstants.END_ELEMENT && reader.getName().equals(INTERFACE_JAVA)) {
+ break;
+ }
+ }
+ JavaServiceContract serviceContract;
+ try {
+ serviceContract = interfaceRegsitry.introspect(interfaceClass, callbackClass, false);
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException(interfaceClass.getName(), e);
+ }
+
+ // Set databinding from the SCDL extension <databinding>
+ DataType<?> dataType = (DataType<?>) extensions.get(DataType.class);
+ if (dataType != null) {
+ serviceContract.setDataBinding(dataType.getDataBinding());
+ }
+ serviceContract.getExtensions().putAll(extensions);
+
+ serviceContract.setInteractionScope(interactionScope);
+ return serviceContract;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java
new file mode 100644
index 0000000000..b10474fb0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.idl.java;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.idl.InvalidConversationalOperationException;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.OverloadedOperationException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessor;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.CONVERSATION_END;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getBaseName;
+
+/**
+ * Default implementation of an InterfaceJavaIntrospector.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessorRegistryImpl implements JavaInterfaceProcessorRegistry {
+ private static final String UNKNOWN_DATABINDING = null;
+
+ private List<JavaInterfaceProcessor> processors = new ArrayList<JavaInterfaceProcessor>();
+
+ public JavaInterfaceProcessorRegistryImpl() {
+ }
+
+ public void registerProcessor(JavaInterfaceProcessor processor) {
+ processors.add(processor);
+ }
+
+ public void unregisterProcessor(JavaInterfaceProcessor processor) {
+ processors.remove(processor);
+ }
+
+ public <T> JavaServiceContract introspect(Class<T> type) throws InvalidServiceContractException {
+ return introspect(type, true);
+ }
+
+ public <T> JavaServiceContract introspect(Class<T> type, boolean deep) throws InvalidServiceContractException {
+ Class<?> callbackClass = null;
+ Callback callback = type.getAnnotation(Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ callbackClass = callback.value();
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new IllegalCallbackException("No callback interface specified on annotation", type.getName());
+ }
+ return introspect(type, callbackClass, deep);
+ }
+ public <I, C> JavaServiceContract introspect(Class<I> type, Class<C> callback, boolean deep)
+ throws InvalidServiceContractException {
+ JavaServiceContract contract = new JavaServiceContract();
+ contract.setInterfaceName(getBaseName(type));
+ contract.setInterfaceClass(type);
+ if (callback != null) {
+ contract.setCallbackName(getBaseName(callback));
+ contract.setCallbackClass(callback);
+ }
+ if (!deep) {
+ return contract;
+ }
+ boolean remotable = type.isAnnotationPresent(Remotable.class);
+ contract.setRemotable(remotable);
+ Scope interactionScope = type.getAnnotation(Scope.class);
+ boolean conversational = false;
+ if (interactionScope != null && "CONVERSATION".equalsIgnoreCase(interactionScope.value())) {
+ contract.setInteractionScope(InteractionScope.CONVERSATIONAL);
+ conversational = true;
+ } else {
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ }
+ contract.setOperations(getOperations(type, remotable, conversational));
+
+ if (callback != null) {
+ contract.setCallbackOperations(getOperations(callback, remotable, conversational));
+ }
+
+ for (JavaInterfaceProcessor processor : processors) {
+ processor.visitInterface(type, callback, contract);
+ }
+ return contract;
+ }
+
+ private <T> Map<String, Operation<Type>> getOperations(Class<T> type, boolean remotable, boolean conversational)
+ throws InvalidServiceContractException {
+ Method[] methods = type.getMethods();
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>(methods.length);
+ for (Method method : methods) {
+ String name = method.getName();
+ if (remotable && operations.containsKey(name)) {
+ throw new OverloadedOperationException(method);
+ }
+
+ Type returnType = method.getGenericReturnType();
+ Type[] paramTypes = method.getGenericParameterTypes();
+ Type[] faultTypes = method.getGenericExceptionTypes();
+ boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
+ int conversationSequence = NO_CONVERSATION;
+ if (method.isAnnotationPresent(EndsConversation.class)) {
+ if (!conversational) {
+ throw new InvalidConversationalOperationException(
+ "Method is marked as end conversation but contract is not conversational",
+ method.getDeclaringClass().getName(),
+ method);
+ }
+ conversationSequence = CONVERSATION_END;
+ } else if (conversational) {
+ conversationSequence = Operation.CONVERSATION_CONTINUE;
+ }
+
+ DataType<Type> returnDataType = new DataType<Type>(UNKNOWN_DATABINDING, returnType, returnType);
+ List<DataType<Type>> paramDataTypes = new ArrayList<DataType<Type>>(paramTypes.length);
+ for (Type paramType : paramTypes) {
+ paramDataTypes.add(new DataType<Type>(UNKNOWN_DATABINDING, paramType, paramType));
+ }
+ List<DataType<Type>> faultDataTypes = new ArrayList<DataType<Type>>(faultTypes.length);
+ for (Type faultType : faultTypes) {
+ faultDataTypes.add(new DataType<Type>(UNKNOWN_DATABINDING, faultType, faultType));
+ }
+
+ DataType<List<DataType<Type>>> inputType =
+ new DataType<List<DataType<Type>>>(DataBinding.IDL_INPUT, Object[].class, paramDataTypes);
+ Operation<Type> operation = new Operation<Type>(name,
+ inputType,
+ returnDataType,
+ faultDataTypes,
+ nonBlocking,
+ UNKNOWN_DATABINDING,
+ conversationSequence);
+ operations.put(name, operation);
+ }
+ return operations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/IntrospectionRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/IntrospectionRegistryImpl.java
new file mode 100644
index 0000000000..3dd1328b6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/IntrospectionRegistryImpl.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.implementation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessor;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+
+/**
+ * Default implementation of the <code>IntrospectionRegistry</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntrospectionRegistryImpl implements IntrospectionRegistry {
+
+ private Monitor monitor;
+ private List<ImplementationProcessor> cache = new ArrayList<ImplementationProcessor>();
+
+ public IntrospectionRegistryImpl() {
+ }
+
+ public IntrospectionRegistryImpl(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ @org.apache.tuscany.api.annotation.Monitor
+ public void setMonitor(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public void registerProcessor(ImplementationProcessor processor) {
+ monitor.register(processor);
+ cache.add(processor);
+ }
+
+ public void unregisterProcessor(ImplementationProcessor processor) {
+ monitor.unregister(processor);
+ cache.remove(processor);
+ }
+
+ public PojoComponentType introspect(CompositeComponent parent, Class<?> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference,
+ JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ for (ImplementationProcessor processor : cache) {
+ processor.visitClass(parent, clazz, type, context);
+ }
+
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ for (ImplementationProcessor processor : cache) {
+ processor.visitConstructor(parent, constructor, type, context);
+ }
+ }
+
+ Set<Method> methods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(clazz);
+ for (Method method : methods) {
+ for (ImplementationProcessor processor : cache) {
+ processor.visitMethod(parent, method, type, context);
+ }
+ }
+
+ Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz);
+ for (Field field : fields) {
+ for (ImplementationProcessor processor : cache) {
+ processor.visitField(parent, field, type, context);
+ }
+ }
+
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null) {
+ visitSuperClass(parent, superClass, type, context);
+ }
+
+ for (ImplementationProcessor processor : cache) {
+ processor.visitEnd(parent, clazz, type, context);
+ }
+ return type;
+ }
+
+ private void visitSuperClass(CompositeComponent parent,
+ Class<?> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ if (!Object.class.equals(clazz)) {
+ for (ImplementationProcessor processor : cache) {
+ processor.visitSuperClass(parent, clazz, type, context);
+ }
+ clazz = clazz.getSuperclass();
+ if (clazz != null) {
+ visitSuperClass(parent, clazz, type, context);
+ }
+ }
+ }
+
+ public static interface Monitor {
+ void register(ImplementationProcessor processor);
+
+ void unregister(ImplementationProcessor processor);
+
+ void processing(ImplementationProcessor processor);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
new file mode 100644
index 0000000000..4ef4dc4d49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
@@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+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.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import org.apache.tuscany.core.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.core.injection.ConversationIDObjectFactory;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.FieldInjector;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.InvalidAccessorException;
+import org.apache.tuscany.core.injection.ListMultiplicityObjectFactory;
+import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.core.injection.NoAccessorException;
+import org.apache.tuscany.core.injection.NoMultiplicityTypeException;
+import org.apache.tuscany.core.injection.ObjectCallbackException;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Base implementation of an {@link org.apache.tuscany.spi.component.AtomicComponent} whose type is a Java class
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class PojoAtomicComponent extends AtomicComponentExtension {
+ protected EventInvoker<Object> initInvoker;
+ protected EventInvoker<Object> destroyInvoker;
+ protected PojoObjectFactory<?> instanceFactory;
+ protected List<String> constructorParamNames;
+ protected Map<String, Member> referenceSites;
+ protected Map<String, Member> resourceSites;
+ protected Map<String, Member> propertySites;
+ protected Map<String, Member> callbackSites;
+ protected List<Injector<Object>> injectors;
+ protected Class implementationClass;
+ private List<Class<?>> constructorParamTypes = new ArrayList<Class<?>>();
+
+ public PojoAtomicComponent(PojoConfiguration configuration) {
+ super(configuration.getName(),
+ configuration.getParent(),
+ configuration.getWireService(),
+ configuration.getWorkContext(),
+ configuration.getScheduler(),
+ configuration.getMonitor(),
+ configuration.getInitLevel(),
+ configuration.getMaxIdleTime(),
+ configuration.getMaxAge());
+ assert configuration.getInstanceFactory() != null : "Object factory was null";
+ initInvoker = configuration.getInitInvoker();
+ destroyInvoker = configuration.getDestroyInvoker();
+ instanceFactory = configuration.getInstanceFactory();
+ constructorParamNames = configuration.getConstructorParamNames();
+ constructorParamTypes = configuration.getConstructorParamTypes();
+ injectors = new ArrayList<Injector<Object>>();
+ referenceSites = configuration.getReferenceSite() != null ? configuration.getReferenceSite()
+ : new HashMap<String, Member>();
+ propertySites = configuration.getPropertySites() != null ? configuration.getPropertySites()
+ : new HashMap<String, Member>();
+ resourceSites = configuration.getResourceSites() != null ? configuration.getResourceSites()
+ : new HashMap<String, Member>();
+ callbackSites = configuration.getCallbackSite() != null ? configuration.getCallbackSite()
+ : new HashMap<String, Member>();
+ implementationClass = configuration.getImplementationClass();
+ }
+
+
+ public boolean isDestroyable() {
+ return destroyInvoker != null;
+ }
+
+ public void init(Object instance) throws TargetInitializationException {
+ if (initInvoker != null) {
+ try {
+ initInvoker.invokeEvent(instance);
+ } catch (ObjectCallbackException e) {
+ throw new TargetInitializationException("Error initializing component instance", getName(), e);
+ }
+ }
+ }
+
+ public void destroy(Object instance) throws TargetDestructionException {
+ if (destroyInvoker != null) {
+ try {
+ destroyInvoker.invokeEvent(instance);
+ } catch (ObjectCallbackException e) {
+ throw new TargetDestructionException("Error destroying component instance", getName(), e);
+ }
+ }
+ }
+
+ public boolean isOptimizable() {
+ // stateless implementations that require a destroy callback cannot be optimized since the callback is
+ // performed by the JavaTargetInvoker
+ return !(getScope() == Scope.STATELESS && isDestroyable());
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return scopeContainer.getInstance(this);
+ }
+
+ public Object getAssociatedTargetInstance() throws TargetResolutionException {
+ return scopeContainer.getAssociatedInstance(this);
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ Object instance = instanceFactory.getInstance();
+ // inject the instance with properties and references
+ for (Injector<Object> injector : injectors) {
+ injector.inject(instance);
+ }
+ return instance;
+ }
+
+ public void addPropertyFactory(String name, ObjectFactory<?> factory) {
+ Member member = propertySites.get(name);
+ if (member instanceof Field) {
+ injectors.add(new FieldInjector<Object>((Field) member, factory));
+ } else if (member instanceof Method) {
+ injectors.add(new MethodInjector<Object>((Method) member, factory));
+ }
+ // cycle through constructor param names as well
+ for (int i = 0; i < constructorParamNames.size(); i++) {
+ if (name.equals(constructorParamNames.get(i))) {
+ ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
+ initializerFactories[i] = factory;
+ break;
+ }
+ }
+ //FIXME throw an error if no injection site found
+ }
+
+ public void addResourceFactory(String name, ObjectFactory<?> factory) {
+ Member member = resourceSites.get(name);
+ if (member instanceof Field) {
+ injectors.add(new FieldInjector<Object>((Field) member, factory));
+ } else if (member instanceof Method) {
+ injectors.add(new MethodInjector<Object>((Method) member, factory));
+ }
+ // cycle through constructor param names as well
+ for (int i = 0; i < constructorParamNames.size(); i++) {
+ if (name.equals(constructorParamNames.get(i))) {
+ ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
+ initializerFactories[i] = factory;
+ break;
+ }
+ }
+ //FIXME throw an error if no injection site found
+ }
+
+ public void addConversationIDFactory(Member member) {
+ ObjectFactory<String> convIDObjectFactory = new ConversationIDObjectFactory(workContext);
+ if (member instanceof Field) {
+ injectors.add(new FieldInjector<Object>((Field) member, convIDObjectFactory));
+ } else if (member instanceof Method) {
+ injectors.add(new MethodInjector<Object>((Method) member, convIDObjectFactory));
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method", member.getName());
+ }
+ }
+
+ protected void onReferenceWire(OutboundWire wire) {
+ String name = wire.getReferenceName();
+ Member member = referenceSites.get(name);
+ if (member != null) {
+ injectors.add(createInjector(member, wire));
+ }
+ // cycle through constructor param names as well
+ for (int i = 0; i < constructorParamNames.size(); i++) {
+ if (name.equals(constructorParamNames.get(i))) {
+ ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
+ initializerFactories[i] = createWireFactory(constructorParamTypes.get(i), wire);
+ break;
+ }
+ }
+ //TODO error if ref not set on constructor or ref site
+ }
+
+ public void onReferenceWires(List<OutboundWire> wires) {
+ assert wires.size() > 0 : "Wires were empty";
+ String referenceName = wires.get(0).getReferenceName();
+ Member member = referenceSites.get(referenceName);
+ if (member == null) {
+ if (constructorParamNames.contains(referenceName)) {
+ // injected on the constructor
+
+ } else {
+ throw new NoAccessorException(referenceName);
+ }
+ }
+ Class<?> type = wires.get(0).getServiceContract().getInterfaceClass();
+ if (type == null) {
+ throw new NoMultiplicityTypeException("Java interface must be specified for multiplicity", referenceName);
+ }
+ injectors.add(createMultiplicityInjector(member, type, wires));
+ //TODO multiplicity for constructor injection
+ }
+
+ public boolean implementsCallback(Class callbackClass) {
+ Class<?>[] implementedInterfaces = implementationClass.getInterfaces();
+ for (Class<?> implementedInterface : implementedInterfaces) {
+ if (implementedInterface.isAssignableFrom(callbackClass)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected Injector<Object> createInjector(Member member, OutboundWire wire) {
+ if (member instanceof Field) {
+ Class<?> type = ((Field) member).getType();
+ ObjectFactory<?> factory = createWireFactory(type, wire);
+ return new FieldInjector<Object>((Field) member, factory);
+ } else if (member instanceof Method) {
+ Class<?> type = ((Method) member).getParameterTypes()[0];
+ ObjectFactory<?> factory = createWireFactory(type, wire);
+ return new MethodInjector<Object>((Method) member, factory);
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method", member.getName());
+ }
+ }
+
+ protected Injector<Object> createMultiplicityInjector(Member member,
+ Class<?> interfaceType,
+ List<OutboundWire> wireFactories) {
+ List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
+ for (OutboundWire wire : wireFactories) {
+ factories.add(createWireFactory(interfaceType, wire));
+ }
+ if (member instanceof Field) {
+ Field field = (Field) member;
+ if (field.getType().isArray()) {
+ return new FieldInjector<Object>(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new FieldInjector<Object>(field, new ListMultiplicityObjectFactory(factories));
+ }
+ } else if (member instanceof Method) {
+ Method method = (Method) member;
+ if (method.getParameterTypes()[0].isArray()) {
+ return new MethodInjector<Object>(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new MethodInjector<Object>(method, new ListMultiplicityObjectFactory(factories));
+ }
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method", member.getName());
+ }
+ }
+
+ protected abstract ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
new file mode 100644
index 0000000000..104b1f647e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Encapsulates confuration for a Java-based atomic component
+ *
+ * @version $Rev$ $Date$
+ */
+public class PojoConfiguration {
+ private String name;
+ private CompositeComponent parent;
+ //private ScopeContainer scopeContainer;
+ private PojoObjectFactory<?> instanceFactory;
+ private List<String> constructorParamNames = new ArrayList<String>();
+ private List<Class<?>> constructorParamTypes = new ArrayList<Class<?>>();
+ private int initLevel;
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+ private List<Injector> propertyInjectors = new ArrayList<Injector>();
+ private Map<String, Member> referenceSites = new HashMap<String, Member>();
+ private Map<String, Member> propertySites = new HashMap<String, Member>();
+ private Map<String, Member> resourceSites = new HashMap<String, Member>();
+ private Map<String, Member> callbackSites = new HashMap<String, Member>();
+ private WireService wireService;
+ private WorkContext workContext;
+ private WorkScheduler scheduler;
+ private ExecutionMonitor monitor;
+ private long maxIdleTime = -1;
+ private long maxAge = -1;
+ private Class implementationClass;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public CompositeComponent getParent() {
+ return parent;
+ }
+
+ public void setParent(CompositeComponent parent) {
+ this.parent = parent;
+ }
+
+ public PojoObjectFactory<?> getInstanceFactory() {
+ return instanceFactory;
+ }
+
+ public void setInstanceFactory(PojoObjectFactory<?> objectFactory) {
+ this.instanceFactory = objectFactory;
+ }
+
+ public List<String> getConstructorParamNames() {
+ return constructorParamNames;
+ }
+
+ public void setConstructorParamNames(List<String> names) {
+ constructorParamNames = names;
+ }
+
+ public void addConstructorParamName(String name) {
+ constructorParamNames.add(name);
+ }
+
+ public List<Class<?>> getConstructorParamTypes() {
+ return constructorParamTypes;
+ }
+
+ public void setConstructorParamTypes(List<Class<?>> constructorParamTypes) {
+ this.constructorParamTypes = constructorParamTypes;
+ }
+
+ public void addConstructorParamType(Class<?> type) {
+ constructorParamTypes.add(type);
+ }
+
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ public void setInitLevel(int initLevel) {
+ this.initLevel = initLevel;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public EventInvoker<Object> getInitInvoker() {
+ return initInvoker;
+ }
+
+ public void setInitInvoker(EventInvoker<Object> initInvoker) {
+ this.initInvoker = initInvoker;
+ }
+
+ public EventInvoker<Object> getDestroyInvoker() {
+ return destroyInvoker;
+ }
+
+ public void setDestroyInvoker(EventInvoker<Object> destroyInvoker) {
+ this.destroyInvoker = destroyInvoker;
+ }
+
+ public List<Injector> getPropertyInjectors() {
+ return propertyInjectors;
+ }
+
+ public void addPropertyInjector(Injector injector) {
+ propertyInjectors.add(injector);
+ }
+
+ public Map<String, Member> getReferenceSite() {
+ return referenceSites;
+ }
+
+ public void addReferenceSite(String name, Member member) {
+ referenceSites.put(name, member);
+ }
+
+ public Map<String, Member> getResourceSites() {
+ return resourceSites;
+ }
+
+ public void addResourceSite(String name, Member member) {
+ resourceSites.put(name, member);
+ }
+
+ public Map<String, Member> getCallbackSite() {
+ return callbackSites;
+ }
+
+ public void addCallbackSite(String name, Member member) {
+ callbackSites.put(name, member);
+ }
+
+ public Map<String, Member> getPropertySites() {
+ return propertySites;
+ }
+
+ public void addPropertySite(String name, Member member) {
+ propertySites.put(name, member);
+ }
+
+ public WireService getWireService() {
+ return wireService;
+ }
+
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ public WorkContext getWorkContext() {
+ return workContext;
+ }
+
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public WorkScheduler getScheduler() {
+ return scheduler;
+ }
+
+ public void setScheduler(WorkScheduler scheduler) {
+ this.scheduler = scheduler;
+ }
+
+ public ExecutionMonitor getMonitor() {
+ return monitor;
+ }
+
+ public void setMonitor(ExecutionMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public Class getImplementationClass() {
+ return implementationClass;
+ }
+
+ public void setImplementationClass(Class implementationClass) {
+ this.implementationClass = implementationClass;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java
new file mode 100644
index 0000000000..293ef81b3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java
@@ -0,0 +1,61 @@
+package org.apache.tuscany.core.implementation.composite;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.BuilderInstantiationException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Abstract builder for composites
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractCompositeBuilder<T extends Implementation<CompositeComponentType>> extends
+ ComponentBuilderExtension<T> {
+
+ public CompositeComponent build(CompositeComponent parent,
+ CompositeComponent component,
+ CompositeComponentType<?, ?, ?> componentType,
+ DeploymentContext deploymentContext) throws BuilderException {
+
+ for (ComponentDefinition<? extends Implementation<?>> definition : componentType.getComponents().values()) {
+ try {
+ Component child = builderRegistry.build(component, definition, deploymentContext);
+ component.register(child);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering component", e);
+ }
+ }
+ for (ServiceDefinition definition : componentType.getServices().values()) {
+ try {
+ Service service = builderRegistry.build(component, definition, deploymentContext);
+ component.register(service);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering service", e);
+ }
+ }
+ for (CompositeReferenceDefinition definition : componentType.getReferences().values()) {
+ try {
+ Reference child = builderRegistry.build(component, definition, deploymentContext);
+ component.register(child);
+ } catch (ComponentRegistrationException e) {
+ throw new BuilderInstantiationException("Error registering reference", e);
+ }
+ }
+ return component;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
new file mode 100644
index 0000000000..0f10703802
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.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.core.implementation.composite;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.extension.CompositeComponentExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+
+/**
+ * The base implementation of a composite context
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractCompositeComponent extends CompositeComponentExtension {
+ public static final int DEFAULT_WAIT = 1000 * 60;
+ // Blocking latch to ensure the composite is initialized exactly once prior to servicing requests
+ protected CountDownLatch initializeLatch = new CountDownLatch(1);
+ protected final Object lock = new Object();
+ // Indicates whether the composite context has been initialized
+ protected boolean initialized;
+
+
+ /**
+ * @param name the name of the SCA composite
+ * @param parent the SCA composite parent
+ * @param connector the connector for fusing wires
+ * @param propertyValues the values of this composite's Properties
+ */
+ public AbstractCompositeComponent(String name,
+ CompositeComponent parent,
+ Connector connector,
+ Map<String, Document> propertyValues) {
+ super(name, parent, connector, propertyValues);
+ }
+
+ public <S, I extends S> void registerJavaObject(String name, Class<S> service, I instance)
+ throws ComponentRegistrationException {
+ register(new SystemSingletonAtomicComponent<S, I>(name, this, service, instance));
+ }
+
+ public <S, I extends S> void registerJavaObject(String name, List<Class<?>> services, I instance)
+ throws ComponentRegistrationException {
+ register(new SystemSingletonAtomicComponent<S, I>(name, this, services, instance));
+ }
+
+ public void start() {
+ synchronized (lock) {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Composite not in UNINITIALIZED state");
+ }
+
+ for (SCAObject child : systemChildren.values()) {
+ child.start();
+ }
+ for (SCAObject child : children.values()) {
+ child.start();
+ }
+ initializeLatch.countDown();
+ initialized = true;
+ lifecycleState = INITIALIZED;
+ }
+ publish(new CompositeStart(this, this));
+ }
+
+ public void stop() {
+ if (lifecycleState == STOPPED) {
+ return;
+ }
+
+ for (SCAObject child : children.values()) {
+ child.stop();
+ }
+ for (SCAObject child : systemChildren.values()) {
+ child.stop();
+ }
+ publish(new CompositeStop(this, this));
+ // need to block a start until reset is complete
+ initializeLatch = new CountDownLatch(2);
+ lifecycleState = STOPPING;
+ initialized = false;
+ // allow initialized to be called
+ initializeLatch.countDown();
+ lifecycleState = STOPPED;
+ }
+
+ public void publish(Event event) {
+ if (lifecycleState == STOPPED) {
+ return;
+ }
+ checkInit();
+ super.publish(event);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ /**
+ * Blocks until the composite context has been initialized
+ */
+ protected void checkInit() throws ComponentTimeoutException {
+ if (!initialized) {
+ try {
+ /* block until the composite has initialized */
+ boolean success = initializeLatch.await(AbstractCompositeComponent.DEFAULT_WAIT,
+ TimeUnit.MILLISECONDS);
+ if (!success) {
+ throw new ComponentTimeoutException("Timeout waiting for context to initialize");
+ }
+ } catch (InterruptedException e) { // should not happen
+ }
+ }
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java
new file mode 100644
index 0000000000..9aaf677be8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeContext.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.ServiceRuntimeException;
+
+import org.apache.tuscany.spi.QualifiedName;
+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.TargetResolutionException;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Base implementation of the {@link org.osoa.sca.CompositeContext}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractCompositeContext implements CompositeContext {
+ protected final CompositeComponent composite;
+ protected final WireService wireService;
+
+ public AbstractCompositeContext(final CompositeComponent composite, final WireService wireService) {
+ this.composite = composite;
+ this.wireService = wireService;
+ }
+
+ public String getName() {
+ return composite.getName();
+ }
+
+ public String getURI() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> T locateService(Class<T> serviceInterface, String serviceName) throws ServiceRuntimeException {
+ QualifiedName qName = new QualifiedName(serviceName);
+ if (qName.getPortName() == null) {
+ String name = serviceInterface.getSimpleName();
+ qName = new QualifiedName(qName.getPartName(), name);
+ }
+ SCAObject child = composite.getChild(qName.getPartName());
+ InboundWire wire = getInboundWire(child, qName);
+ if (wire.isOptimizable()
+ && wire.getServiceContract().getInterfaceClass() != null
+ && serviceInterface.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ try {
+ return serviceInterface.cast(wire.getTargetService());
+ } catch (TargetResolutionException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ return wireService.createProxy(serviceInterface, wire);
+ }
+
+ protected InboundWire getInboundWire(SCAObject child, QualifiedName qName) {
+ InboundWire wire = null;
+ if (child instanceof Component) {
+ wire = ((Component) child).getInboundWire(qName.getPortName());
+ if (wire == null) {
+ throw new ServiceRuntimeException("Service not found [" + qName + "]");
+ }
+ } else if (child instanceof Service) {
+ Service service = (Service) child;
+ for (ServiceBinding binding : service.getServiceBindings()) {
+ if (Wire.LOCAL_BINDING.equals(binding.getInboundWire().getBindingType())) {
+ wire = binding.getInboundWire();
+ break;
+ }
+ }
+ if (wire == null) {
+ throw new ServiceRuntimeException("Local binding for service not found [" + qName + "]");
+ }
+ } else if (child instanceof Reference) {
+ Reference service = (Reference) child;
+ if (service.getReferenceBindings().isEmpty()) {
+ throw new ServiceRuntimeException("No binding for reference [" + qName + "]");
+ }
+ for (ReferenceBinding binding : service.getReferenceBindings()) {
+ if (Wire.LOCAL_BINDING.equals(binding.getInboundWire().getBindingType())) {
+ wire = binding.getInboundWire();
+ break;
+ }
+ }
+ if (wire == null) {
+ // pick the first one
+ wire = service.getReferenceBindings().get(0).getInboundWire();
+ }
+ } else if (child == null) {
+ throw new ServiceRuntimeException("Service not found [" + qName + "]");
+ } else {
+ throw new ServiceRuntimeException("Invalid service type [" + child.getClass().getName() + "]");
+ }
+ return wire;
+ }
+
+ public CompositeComponent getComposite() {
+ return composite;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java
new file mode 100644
index 0000000000..ed64cb1236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.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.implementation.composite;
+
+import org.apache.tuscany.spi.component.ComponentRuntimeException;
+
+/**
+ * Denotes a condition where a component times out waiting to perform an operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTimeoutException extends ComponentRuntimeException {
+
+ public ComponentTimeoutException(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/implementation/composite/CompositeBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
new file mode 100644
index 0000000000..008c99db8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.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.implementation.composite;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+
+/**
+ * Instantiates a composite component from an assembly definition
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilder extends AbstractCompositeBuilder<CompositeImplementation> {
+
+ public Component build(CompositeComponent parent,
+ ComponentDefinition<CompositeImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderException {
+ CompositeImplementation implementation = componentDefinition.getImplementation();
+ CompositeComponentType<?, ?, ?> componentType = implementation.getComponentType();
+ String name = componentDefinition.getName();
+ CompositeComponentImpl component = new CompositeComponentImpl(name, parent, connector, null);
+
+ return build(parent, component, componentType, deploymentContext);
+ }
+
+ protected Class<CompositeImplementation> getImplementationType() {
+ return CompositeImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java
new file mode 100644
index 0000000000..75bc2d8c78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.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.core.implementation.composite;
+
+import java.util.Map;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+/**
+ * The standard implementation of a composite component. Autowiring is performed by delegating to the parent composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentImpl extends AbstractCompositeComponent {
+ private String uri;
+ private boolean systemComposite;
+
+ /**
+ * Constructor specifying property values
+ *
+ * @param name the name of this Component
+ * @param parent this component's parent
+ * @param connector the connector to use for wires
+ * @param propertyValues this composite's Property values
+ */
+ public CompositeComponentImpl(String name,
+ CompositeComponent parent,
+ Connector connector,
+ Map<String, Document> propertyValues) {
+ this(name, null, parent, connector, propertyValues);
+ }
+
+ /**
+ * Constructor specifying if the composite is a system composite
+ *
+ * @param name the name of this Component
+ * @param parent this component's parent
+ * @param connector the connector to use for wires
+ * @param systemComposite true if the composite is a system composite
+ */
+ public CompositeComponentImpl(String name,
+ CompositeComponent parent,
+ Connector connector,
+ boolean systemComposite) {
+ this(name, null, parent, connector, null, systemComposite);
+ }
+
+ /**
+ * Constructor specifying name and URI.
+ *
+ * @param name the name of this Component
+ * @param uri the unique identifier for this component
+ * @param parent this component's parent
+ * @param connector the connector to use for wires
+ * @param propertyValues this composite's Property values
+ */
+ public CompositeComponentImpl(String name,
+ String uri,
+ CompositeComponent parent,
+ Connector connector,
+ Map<String, Document> propertyValues) {
+ super(name, parent, connector, propertyValues);
+ this.uri = uri;
+ }
+
+ /**
+ * Constructor specifying name and URI.
+ *
+ * @param name the name of this Component
+ * @param uri the unique identifier for this component
+ * @param parent this component's parent
+ * @param connector the connector to use for wires
+ * @param propertyValues this composite's Property values
+ * @param systemComposite true if the composite is a system composite
+ */
+ public CompositeComponentImpl(String name,
+ String uri,
+ CompositeComponent parent,
+ Connector connector,
+ Map<String, Document> propertyValues,
+ boolean systemComposite) {
+ super(name, parent, connector, propertyValues);
+ this.uri = uri;
+ this.systemComposite = systemComposite;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public boolean isSystem() {
+ return systemComposite;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java
new file mode 100644
index 0000000000..c55f1b8ffa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.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.implementation.composite;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+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.LoaderRegistry;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+
+import org.apache.tuscany.core.deployer.ChildDeploymentContext;
+
+/**
+ * Loads a composite component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentTypeLoader extends ComponentTypeLoaderExtension<CompositeImplementation> {
+ public CompositeComponentTypeLoader() {
+ }
+
+ public CompositeComponentTypeLoader(LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ protected Class<CompositeImplementation> getImplementationClass() {
+ return CompositeImplementation.class;
+ }
+
+ public void load(CompositeComponent parent, CompositeImplementation implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ URL scdlLocation = implementation.getScdlLocation();
+ ClassLoader cl = new CompositeClassLoader(implementation.getClassLoader());
+ deploymentContext = new ChildDeploymentContext(deploymentContext, cl, scdlLocation);
+ CompositeComponentType componentType = loadFromSidefile(parent, scdlLocation, deploymentContext);
+ implementation.setComponentType(componentType);
+ }
+
+ protected CompositeComponentType loadFromSidefile(CompositeComponent parent,
+ URL url,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ return loaderRegistry.load(parent, null, url, CompositeComponentType.class, deploymentContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java
new file mode 100644
index 0000000000..c268d342b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java
@@ -0,0 +1,426 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+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.net.URI;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.property.PropertyHelper;
+import org.apache.tuscany.core.util.ReferenceLoaderHelper;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.loader.InvalidPromotedReferenceException;
+import org.apache.tuscany.spi.loader.InvalidServiceException;
+import org.apache.tuscany.spi.loader.InvalidWireException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityOverridingException;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Include;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.model.WireDefinition;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+
+/**
+ * Loads a composite component definition from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeLoader extends LoaderExtension<CompositeComponentType> {
+ public static final QName COMPOSITE = new QName(SCA_NS, "composite");
+ public static final String URI_DELIMITER = "/";
+
+ @Autowire
+ protected JavaInterfaceProcessorRegistry processorRegistry;
+
+ private final ArtifactRepository artifactRepository;
+
+ public CompositeLoader(@Autowire
+ LoaderRegistry registry, @Autowire
+ ArtifactRepository artifactRepository) {
+ super(registry);
+ this.artifactRepository = artifactRepository;
+ }
+
+ public QName getXMLType() {
+ return COMPOSITE;
+ }
+
+ public CompositeComponentType load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite =
+ new CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>>();
+ composite.setName(reader.getAttributeValue(null, "name"));
+ boolean done = false;
+ while (!done) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject o = registry.load(parent, composite, reader, deploymentContext);
+ if (o instanceof ServiceDefinition) {
+ composite.add((ServiceDefinition)o);
+ } else if (o instanceof CompositeReferenceDefinition) {
+ composite.add((CompositeReferenceDefinition)o);
+ } else if (o instanceof Property<?>) {
+ composite.add((Property<?>)o);
+ } else if (o instanceof ComponentDefinition<?>) {
+ composite.add((ComponentDefinition<?>)o);
+ } else if (o instanceof Include) {
+ composite.add((Include)o);
+ } else if (o instanceof Dependency) {
+ Artifact artifact = ((Dependency)o).getArtifact();
+ if (artifactRepository != null) {
+ // default to jar type if not specified
+ if (artifact.getType() == null) {
+ artifact.setType("jar");
+ }
+ artifactRepository.resolve(artifact);
+ }
+ if (artifact.getUrl() != null) {
+ ClassLoader classLoader = deploymentContext.getClassLoader();
+ if (classLoader instanceof CompositeClassLoader) {
+ CompositeClassLoader ccl = (CompositeClassLoader)classLoader;
+ for (URL dep : artifact.getUrls()) {
+ ccl.addURL(dep);
+ }
+ }
+ }
+ } else if (o instanceof WireDefinition) {
+ composite.add((WireDefinition)o);
+ } else {
+ // add as an unknown model extension
+ if (o != null) {
+ composite.getDeclaredExtensions().put(o.getClass(), o);
+ }
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ if (COMPOSITE.equals(reader.getName())) {
+ // if there are wire defintions then link them up to the
+ // relevant components
+ resolveWires(composite);
+ validateCompositeDefintion(composite);
+ //verifyCompositeCompleteness(composite);
+ done = true;
+ break;
+ }
+ }
+ }
+ processJavaInterfaces(composite);
+ for (ComponentDefinition<? extends Implementation<?>> c : composite.getComponents()
+ .values()) {
+ processJavaInterfaces(c.getImplementation().getComponentType());
+ PropertyHelper.processProperties(composite, c, deploymentContext);
+ }
+ return composite;
+ }
+
+ protected void processJavaInterfaces(ComponentType componentType) throws LoaderException {
+ if (processorRegistry == null) {
+ return;
+ }
+ try {
+ for (Object s : componentType.getServices().values()) {
+ ServiceContract<?> contract = ((ServiceDefinition)s).getServiceContract();
+ if (JavaServiceContract.class.isInstance(contract)) {
+ contract =
+ processorRegistry.introspect(contract.getInterfaceClass(), contract
+ .getCallbackClass(), true);
+ ((ServiceDefinition)s).setServiceContract(contract);
+ }
+ }
+ for (Object r : componentType.getReferences().values()) {
+ ServiceContract<?> contract = ((AbstractReferenceDefinition)r).getServiceContract();
+ if (JavaServiceContract.class.isInstance(contract)) {
+ contract =
+ processorRegistry.introspect(contract.getInterfaceClass(), contract
+ .getCallbackClass(), true);
+ ((AbstractReferenceDefinition)r).setServiceContract(contract);
+ }
+ }
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException(e);
+ }
+
+ }
+
+ protected void resolveWires(CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws InvalidWireException,
+ InvalidPromotedReferenceException {
+ QualifiedName sourceName;
+ ComponentDefinition componentDefinition;
+ ServiceDefinition serviceDefinition;
+ List<WireDefinition> wireDefns = composite.getDeclaredWires();
+ for (WireDefinition wire : wireDefns) {
+ URI targetUri = wire.getTarget();
+ // validate the target before finding the source
+ validateTarget(targetUri, composite);
+
+ sourceName = new QualifiedName(wire.getSource().getPath());
+ serviceDefinition = composite.getDeclaredServices().get(sourceName.getPartName());
+ if (serviceDefinition != null) {
+ serviceDefinition.setTarget(wire.getTarget());
+ } else {
+ componentDefinition =
+ composite.getDeclaredComponents().get(sourceName.getPartName());
+ if (componentDefinition != null) {
+ if (sourceName.getPortName() == null || sourceName.getPortName().length() == 0) {
+ if (componentDefinition.getReferences().size() > 1 || componentDefinition
+ .getReferences().isEmpty()) {
+ throw new InvalidWireException("Unable to determine unique source reference");
+ } else {
+ ComponentReferenceDefinition ref =
+ (ComponentReferenceDefinition)componentDefinition.getReferences()
+ .values().iterator().next();
+ ref.addTarget(targetUri);
+ }
+ } else {
+ ((ComponentReferenceDefinition)componentDefinition.getReferences()
+ .get(sourceName.getPortName())).addTarget(targetUri);
+ }
+
+ } else {
+ throw new InvalidWireException("Source not found", sourceName.toString());
+ }
+ }
+ }
+
+ QualifiedName targetName = null;
+ ComponentReferenceDefinition promotedComponentRef = null;
+ for (CompositeReferenceDefinition compositeRefDef : composite.getDeclaredReferences()
+ .values()) {
+ for (URI promotedComponentRefUri : compositeRefDef.getPromotedReferences()) {
+ targetName = new QualifiedName(promotedComponentRefUri.toString());
+ componentDefinition = composite.getComponents().get(targetName.getPartName());
+ if (componentDefinition != null) {
+ if (targetName.getPortName() != null) {
+ promotedComponentRef =
+ (ComponentReferenceDefinition)componentDefinition.getReferences()
+ .get(targetName.getPortName());
+ } else {
+ promotedComponentRef =
+ (ComponentReferenceDefinition)componentDefinition.getReferences()
+ .values().iterator().next();
+ }
+ if (promotedComponentRef != null) {
+ promotedComponentRef.addTarget(URI.create(compositeRefDef.getName()));
+ } else {
+ throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+ targetName.toString());
+ }
+ } else {
+ throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+ targetName.toString());
+ }
+
+ }
+ }
+ }
+
+ protected void validateCompositeDefintion(
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite)
+ throws LoaderException {
+ verifyCompositeCompleteness(composite);
+ validateCompositeReferenceDefinition(composite);
+ }
+
+ protected void verifyCompositeCompleteness(
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite)
+ throws InvalidServiceException {
+ // check if all of the composite services have been wired
+ for (ServiceDefinition svcDefn : composite.getDeclaredServices().values()) {
+ if (svcDefn.getTarget() == null) {
+ throw new InvalidServiceException("Composite service not wired to a target",
+ svcDefn.getName());
+ }
+ }
+ }
+
+ protected void verifyReferenceInterfaceCompatibility(CompositeReferenceDefinition compositeRefDefn,
+ ComponentReferenceDefinition componentRefDefn)
+ throws LoaderException {
+ if (compositeRefDefn.getServiceContract() != null) {
+ //TODO : Since the JavaInterfaceProcessorRegistryImpl does not do a deep introspection
+ //this comparison is not possible. This will be uncommented once that is fixed.
+ /*ReferenceLoaderHelper.checkInterfaceCompatibility(componentRefDefn.getServiceContract(),
+ compositeRefDefn.getServiceContract(),
+ false);*/
+ } else {
+ //FIXME : the wireservice needs a service contract in the composite ref. def
+ //so filling up with one of the promoted component ref. defn's service contract
+ compositeRefDefn.setServiceContract(componentRefDefn.getServiceContract());
+ }
+ }
+
+ protected Multiplicity deriveReferenceMultiplicity(CompositeReferenceDefinition compositeRefDefn,
+ ComponentReferenceDefinition componentRefDefn,
+ Multiplicity leastMultiplicity)
+ throws LoaderException
+ {
+ if (compositeRefDefn.getMultiplicity() != null) {
+ if (!ReferenceLoaderHelper.
+ isValidMultiplicityOverride(componentRefDefn.getMultiplicity(),
+ compositeRefDefn.getMultiplicity())) {
+ throw new ReferenceMultiplicityOverridingException(compositeRefDefn.getName(),
+ componentRefDefn.getMultiplicity(),
+ compositeRefDefn.getMultiplicity());
+ }
+ } else {
+ if (leastMultiplicity != null) {
+ if (!ReferenceLoaderHelper.isCompatibleMultiplicity(componentRefDefn.getMultiplicity(),
+ leastMultiplicity)) {
+ throw new ReferenceMultiplicityOverridingException(compositeRefDefn.getName(),
+ componentRefDefn.getMultiplicity(),
+ leastMultiplicity);
+ } else {
+ if (!ReferenceLoaderHelper.
+ isValidMultiplicityOverride(componentRefDefn.getMultiplicity(),
+ leastMultiplicity)) {
+ leastMultiplicity = componentRefDefn.getMultiplicity();
+ }
+ }
+ }
+ else {
+ leastMultiplicity = componentRefDefn.getMultiplicity();
+ }
+ }
+ return leastMultiplicity;
+ }
+
+ protected void validateCompositeReferenceDefinition(CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws LoaderException {
+ QualifiedName promotedName = null;
+ ComponentDefinition promotedComponentDefinition = null;
+ ComponentReferenceDefinition promotedComponentReference = null;
+
+ for (CompositeReferenceDefinition compositeRefDefn : composite.getDeclaredReferences().values()) {
+ // ensure if there is a service contract defined, then it is
+ // compatible with all
+ // promoted component reference interfaces
+ Multiplicity leastMultiplicity = null;
+ boolean bindingsOverriden = compositeRefDefn.getBindings().size() > 0;
+ for (URI promotedRef : compositeRefDefn.getPromotedReferences()) {
+ // check for valid promotions
+ promotedName = new QualifiedName(promotedRef.toString());
+ promotedComponentDefinition =
+ composite.getComponents().get(promotedName.getPartName());
+ if (promotedComponentDefinition != null) {
+ if (promotedName.getPortName() != null) {
+ promotedComponentReference =
+ (ComponentReferenceDefinition)promotedComponentDefinition
+ .getReferences().get(promotedName.getPortName());
+ } else {
+ promotedComponentReference =
+ (ComponentReferenceDefinition)promotedComponentDefinition
+ .getReferences().values().iterator().next();
+ }
+ // check for service contract compatibility
+ if (promotedComponentReference != null) {
+ verifyReferenceInterfaceCompatibility(compositeRefDefn,
+ promotedComponentReference);
+ leastMultiplicity =
+ deriveReferenceMultiplicity(compositeRefDefn,
+ promotedComponentReference,
+ leastMultiplicity);
+
+ // if bindings have not been overridden int the composite then copy them
+ // over for convenience so that when accessed, traversing of all promoted
+ // references can be avoided
+ if (!bindingsOverriden) {
+ for (BindingDefinition refBinding : promotedComponentReference
+ .getBindings()) {
+ compositeRefDefn.addBinding((BindingDefinition)refBinding.clone());
+ }
+ }
+ } else {
+ throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+ promotedRef.toString());
+ }
+ } else {
+ throw new InvalidPromotedReferenceException("Invalid promoted reference ",
+ promotedRef.toString());
+ }
+
+ }
+ if (compositeRefDefn.getMultiplicity() == null) {
+ compositeRefDefn.setMultiplicity(leastMultiplicity);
+ }
+
+ }
+ }
+
+ private void validateTarget(URI target,
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite) throws InvalidWireException {
+ QualifiedName targetName = new QualifiedName(target.getPath());
+ // if target is not a reference of the composite
+ if (composite.getReferences().get(targetName.getPartName()) == null) {
+ ComponentDefinition<?> targetDefinition =
+ composite.getDeclaredComponents().get(targetName.getPartName());
+ // if a target component exists in this composite
+ if (targetDefinition != null) {
+ Implementation<?> implementation = targetDefinition.getImplementation();
+ ComponentType<?, ?, ?> componentType = implementation.getComponentType();
+ Map<String, ? extends ServiceDefinition> services = componentType.getServices();
+ if (targetName.getPortName() == null) {
+ if (services.size() > 1 || services.isEmpty()) {
+ throw new InvalidWireException("Ambiguous target", targetName.toString());
+ }
+ } else {
+ if (services.get(targetName.getPortName()) == null) {
+ throw new InvalidWireException("Invalid target service", targetName
+ .toString());
+ }
+ }
+ } else {
+ throw new InvalidWireException("Target not found", targetName.toString());
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/Dependency.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/Dependency.java
new file mode 100644
index 0000000000..808f36072f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/Dependency.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.implementation.composite;
+
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+
+/**
+ * A model object that represents a dependency on an external artifact.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Dependency extends ModelObject {
+ private Artifact artifact;
+
+ public Artifact getArtifact() {
+ return artifact;
+ }
+
+ public void setArtifact(Artifact artifact) {
+ this.artifact = artifact;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoader.java
new file mode 100644
index 0000000000..ac744d5905
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoader.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.implementation.composite;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.Constants;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+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.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+
+/**
+ * Loader that handles an &lt;implementation.composite&gt; element.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImplementationCompositeLoader extends LoaderExtension<CompositeImplementation> {
+ private static final QName IMPLEMENTATION_COMPOSITE =
+ new QName(Constants.SCA_NS, "implementation.composite");
+
+ private final ArtifactRepository artifactRepository;
+
+ public ImplementationCompositeLoader(@Autowire LoaderRegistry registry,
+ @Autowire ArtifactRepository artifactRepository) {
+ super(registry);
+ this.artifactRepository = artifactRepository;
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_COMPOSITE;
+ }
+
+ public CompositeImplementation load(CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ assert IMPLEMENTATION_COMPOSITE.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ String group = reader.getAttributeValue(null, "group");
+ String version = reader.getAttributeValue(null, "version");
+ String scdlLocation = reader.getAttributeValue(null, "scdlLocation");
+ String jarLocation = reader.getAttributeValue(null, "jarLocation");
+ LoaderUtil.skipToEndElement(reader);
+
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setName(name);
+ if (scdlLocation != null) {
+ try {
+ impl.setScdlLocation(new URL(deploymentContext.getScdlLocation(), scdlLocation));
+ } catch (MalformedURLException e) {
+ throw new InvalidValueException(scdlLocation, name, e);
+ }
+ impl.setClassLoader(deploymentContext.getClassLoader());
+ } else if (jarLocation != null) {
+ URL jarUrl;
+ try {
+ jarUrl = new URL(deploymentContext.getScdlLocation(), jarLocation);
+ } catch (MalformedURLException e) {
+ throw new InvalidValueException(jarLocation, name, e);
+ }
+ try {
+ impl.setScdlLocation(new URL("jar:" + jarUrl.toExternalForm() + "!/META-INF/sca/default.scdl"));
+ } catch (MalformedURLException e) {
+ throw new AssertionError("Could not convert URL to a jar: url");
+ }
+ impl.setClassLoader(new CompositeClassLoader(new URL[]{jarUrl}, deploymentContext.getClassLoader()));
+ } else if (artifactRepository != null && group != null && version != null) {
+ Artifact artifact = new Artifact();
+ artifact.setGroup(group);
+ artifact.setName(name);
+ artifact.setVersion(version);
+ artifact.setType("jar");
+ artifactRepository.resolve(artifact);
+ if (artifact.getUrl() == null) {
+ throw new MissingResourceException(artifact.toString(), name);
+ }
+ try {
+ impl.setScdlLocation(new URL("jar:" + artifact.getUrl() + "!/META-INF/sca/default.scdl"));
+ } catch (MalformedURLException e) {
+ throw new AssertionError(e);
+ }
+ Set<URL> artifactURLs = artifact.getUrls();
+ URL[] urls = new URL[artifactURLs.size()];
+ int i = 0;
+ for (URL artifactURL : artifactURLs) {
+ urls[i++] = artifactURL;
+ }
+ impl.setClassLoader(new CompositeClassLoader(urls, deploymentContext.getClassLoader()));
+ }
+ return impl;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java
new file mode 100644
index 0000000000..f2a8109ee3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.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.implementation.composite;
+
+import javax.security.auth.Subject;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.CallableReference;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ManagedRequestContext implements RequestContext {
+ private WorkContext workContext;
+
+ public ManagedRequestContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public Subject getSecuritySubject() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getServiceName() {
+ return workContext.getCurrentServiceName();
+ }
+
+ public <B> ServiceReference<B> getServiceReference() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CB getCallback() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CallableReference<CB> getCallbackReference() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java
new file mode 100644
index 0000000000..3fcba7b054
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+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.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * The default implementation of a {@link org.apache.tuscany.spi.component.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceImpl extends AbstractSCAObject implements Reference {
+ private ServiceContract<?> serviceContract;
+ private List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ private boolean system;
+
+ public ReferenceImpl(String name, CompositeComponent parent, ServiceContract<?> contract) {
+ this(name, parent, contract, false);
+ }
+
+ public ReferenceImpl(String name,
+ CompositeComponent parent,
+ ServiceContract<?> contract,
+ boolean system) {
+ super(name, parent);
+ this.serviceContract = contract;
+ this.system = system;
+ }
+
+ public Scope getScope() {
+ return Scope.SYSTEM;
+ }
+
+ public ServiceContract<?> getServiceContract() {
+ return serviceContract;
+ }
+
+ public List<ReferenceBinding> getReferenceBindings() {
+ return Collections.unmodifiableList(bindings);
+ }
+
+ public void addReferenceBinding(ReferenceBinding binding) {
+ binding.setReference(this);
+ bindings.add(binding);
+ }
+
+ public void start() {
+ super.start();
+ for (ReferenceBinding binding : bindings) {
+ binding.start();
+ }
+ }
+
+ public void stop() {
+ super.stop();
+ for (ReferenceBinding binding : bindings) {
+ binding.stop();
+ }
+ }
+
+ @Override
+ public boolean isSystem() {
+ return system;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java
new file mode 100644
index 0000000000..2db8519ccc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.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.core.implementation.composite;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * The default implementation of a {@link Service}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceImpl extends AbstractSCAObject implements Service {
+ private ServiceContract<?> serviceContract;
+ private List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ private boolean system;
+ private URI targetUri;
+
+ public ServiceImpl(String name, CompositeComponent parent, ServiceContract<?> contract) {
+ this(name, parent, contract, null, false);
+ }
+
+ public ServiceImpl(String name,
+ CompositeComponent parent,
+ ServiceContract<?> contract,
+ URI targetUri,
+ boolean system) {
+ super(name, parent);
+ this.serviceContract = contract;
+ this.system = system;
+ this.targetUri = targetUri;
+ }
+
+ public Scope getScope() {
+ return Scope.SYSTEM;
+ }
+
+ public ServiceContract<?> getServiceContract() {
+ return serviceContract;
+ }
+
+ public URI getTargetUri() {
+ return targetUri;
+ }
+
+ public List<ServiceBinding> getServiceBindings() {
+ return Collections.unmodifiableList(bindings);
+ }
+
+ public void addServiceBinding(ServiceBinding binding) {
+ binding.setService(this);
+ bindings.add(binding);
+ }
+
+ public void start() {
+ super.start();
+ for (ServiceBinding binding : bindings) {
+ binding.start();
+ }
+ }
+
+ public void stop() {
+ super.stop();
+ for (ServiceBinding binding : bindings) {
+ binding.stop();
+ }
+ }
+
+ @Override
+ public boolean isSystem() {
+ return system;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemCompositeBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemCompositeBuilder.java
new file mode 100644
index 0000000000..82fb5bf62e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemCompositeBuilder.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.implementation.composite;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+
+/**
+ * Produces system composite components by evaluating an assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemCompositeBuilder extends AbstractCompositeBuilder<SystemCompositeImplementation> {
+ private TuscanyManagementService managementService;
+
+ public SystemCompositeBuilder() {
+ }
+
+ public SystemCompositeBuilder(BuilderRegistry builderRegistry,
+ Connector connector,
+ TuscanyManagementService managementService) {
+ this.builderRegistry = builderRegistry;
+ this.connector = connector;
+ this.managementService = managementService;
+ }
+
+ public CompositeComponent build(CompositeComponent parent,
+ ComponentDefinition<SystemCompositeImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderException {
+ SystemCompositeImplementation impl = componentDefinition.getImplementation();
+ CompositeComponentType<?, ?, ?> componentType = impl.getComponentType();
+ String name = componentDefinition.getName();
+ CompositeComponent component = new CompositeComponentImpl(name, parent, connector, true);
+ component.setManagementService(managementService);
+ build(parent, component, componentType, deploymentContext);
+ return component;
+ }
+
+ protected Class<SystemCompositeImplementation> getImplementationType() {
+ return SystemCompositeImplementation.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java
new file mode 100644
index 0000000000..952533e476
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.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.core.implementation.composite;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.extension.AbstractComponentExtension;
+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.ServiceDefinition;
+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.WireService;
+
+/**
+ * An {@link org.apache.tuscany.spi.component.AtomicComponent} used when registering objects directly into a composite
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SystemSingletonAtomicComponent<S, T extends S> extends AbstractComponentExtension
+ implements AtomicComponent {
+ private T instance;
+ private Map<String, InboundWire> inboundWires;
+ private WireService wireService = new JDKWireService();
+
+ public SystemSingletonAtomicComponent(String name, CompositeComponent parent, Class<S> interfaze, T instance) {
+ super(name, parent);
+ this.instance = instance;
+ inboundWires = new HashMap<String, InboundWire>();
+ initWire(interfaze);
+ }
+
+
+ public SystemSingletonAtomicComponent(String name,
+ CompositeComponent parent,
+ List<Class<?>> services,
+ T instance) {
+ super(name, parent);
+ this.instance = instance;
+ inboundWires = new HashMap<String, InboundWire>();
+ for (Class<?> interfaze : services) {
+ initWire(interfaze);
+ }
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ public boolean isEagerInit() {
+ return false;
+ }
+
+ public boolean isDestroyable() {
+ return false;
+ }
+
+ public int getInitLevel() {
+ return 0;
+ }
+
+ public long getMaxIdleTime() {
+ return -1;
+ }
+
+ public long getMaxAge() {
+ return -1;
+ }
+
+ public T getTargetInstance() throws TargetResolutionException {
+ return instance;
+ }
+
+ public void init(Object instance) throws TargetInitializationException {
+
+ }
+
+ public void destroy(Object instance) throws TargetDestructionException {
+
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeInstance() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addInboundWire(InboundWire wire) {
+ inboundWires.put(wire.getServiceName(), wire);
+ }
+
+ public Collection<InboundWire> getInboundWires() {
+ return Collections.unmodifiableCollection(inboundWires.values());
+ }
+
+ public InboundWire getInboundWire(String serviceName) {
+ return inboundWires.get(serviceName);
+ }
+
+ public void addOutboundWire(OutboundWire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addOutboundWires(List<OutboundWire> wires) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, List<OutboundWire>> getOutboundWires() {
+ return Collections.emptyMap();
+ }
+
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return null;
+ }
+
+ public boolean isSystem() {
+ return true;
+ }
+
+ private void initWire(Class<?> interfaze) {
+ JavaServiceContract serviceContract = new JavaServiceContract(interfaze);
+ ServiceDefinition def = new ServiceDefinition(interfaze.getName(), serviceContract, false);
+ InboundWire wire = wireService.createWire(def);
+ wire.setContainer(this);
+ inboundWires.put(wire.getServiceName(), wire);
+ }
+
+ @Override
+ 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/implementation/java/JavaAtomicComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
new file mode 100644
index 0000000000..bc087dd4c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.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.core.implementation.java;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+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.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.core.wire.WireObjectFactory;
+
+import org.apache.tuscany.core.implementation.PojoAtomicComponent;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.CallbackWireObjectFactory;
+import org.apache.tuscany.core.injection.FieldInjector;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.InvalidAccessorException;
+import org.apache.tuscany.core.injection.MethodInjector;
+
+/**
+ * The runtime instantiation of Java component implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaAtomicComponent extends PojoAtomicComponent {
+
+ public JavaAtomicComponent(PojoConfiguration configuration) {
+ super(configuration);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ Method[] methods;
+ Class callbackClass = null;
+ if (operation.isCallback()) {
+ callbackClass = operation.getServiceContract().getCallbackClass();
+ methods = callbackClass.getMethods();
+
+ } else {
+ methods = operation.getServiceContract().getInterfaceClass().getMethods();
+ }
+ Method method = findMethod(operation, methods);
+ return new JavaTargetInvoker(method, this, callbackWire, callbackClass, workContext, monitor);
+ }
+
+ protected void onServiceWire(InboundWire wire) {
+ String name = wire.getCallbackReferenceName();
+ if (name == null) {
+ // It's ok not to have one, we just do nothing
+ return;
+ }
+ Member member = callbackSites.get(name);
+ if (member != null) {
+ injectors.add(createCallbackInjector(member, wire.getServiceContract(), wire));
+ }
+ }
+
+ protected Injector<Object> createCallbackInjector(Member member,
+ ServiceContract<?> contract,
+ InboundWire inboundWire) {
+ if (member instanceof Field) {
+ Field field = (Field) member;
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(field.getType(), wireService, inboundWire);
+ return new FieldInjector<Object>(field, factory);
+ } else if (member instanceof Method) {
+ Method method = (Method) member;
+ Class<?> type = method.getParameterTypes()[0];
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(type, wireService, inboundWire);
+ return new MethodInjector<Object>(method, factory);
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method", member.getName());
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
+ return new WireObjectFactory(interfaze, wire, wireService);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
new file mode 100644
index 0000000000..7d11dc9e78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+/**
+ * Builds a Java-based atomic context from a component definition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaComponentBuilder extends ComponentBuilderExtension<JavaImplementation> {
+
+ private ResourceHost host;
+
+ @Autowire
+ public void setHost(ResourceHost host) {
+ this.host = host;
+ }
+
+ @SuppressWarnings("unchecked")
+ public AtomicComponent build(CompositeComponent parent,
+ ComponentDefinition<JavaImplementation> definition,
+ DeploymentContext deployment) throws BuilderConfigException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ definition.getImplementation().getComponentType();
+
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setParent(parent);
+ if (definition.getInitLevel() != null) {
+ configuration.setInitLevel(definition.getInitLevel());
+ } else {
+ configuration.setInitLevel(componentType.getInitLevel());
+ }
+ if (componentType.getMaxAge() > 0) {
+ configuration.setMaxAge(componentType.getMaxAge());
+ } else if (componentType.getMaxIdleTime() > 0) {
+ configuration.setMaxIdleTime(componentType.getMaxIdleTime());
+ }
+ Method initMethod = componentType.getInitMethod();
+ if (initMethod != null) {
+ configuration.setInitInvoker(new MethodEventInvoker(initMethod));
+ }
+ Method destroyMethod = componentType.getDestroyMethod();
+ if (destroyMethod != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker(destroyMethod));
+ }
+
+ configuration.setWireService(wireService);
+ configuration.setWorkContext(workContext);
+ configuration.setScheduler(workScheduler);
+ configuration.setImplementationClass(definition.getImplementation().getImplementationClass());
+
+ // setup property injection sites
+ for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
+ configuration.addPropertySite(property.getName(), property.getMember());
+ }
+
+ // setup reference injection sites
+ try {
+
+ for (JavaMappedReference reference : componentType.getReferences().values()) {
+ Member member = reference.getMember();
+ if (member != null) {
+ // could be null if the reference is mapped to a constructor
+ configuration.addReferenceSite(reference.getName(), member);
+ }
+ }
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+
+ for (Resource resource : componentType.getResources().values()) {
+ Member member = resource.getMember();
+ if (member != null) {
+ // could be null if the resource is mapped to a constructor
+ configuration.addResourceSite(resource.getName(), member);
+ }
+ }
+
+ // setup constructor injection
+ ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
+ Constructor<?> constr = ctorDef.getConstructor();
+ PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
+ configuration.setInstanceFactory(instanceFactory);
+ configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
+ for (Class<?> clazz : constr.getParameterTypes()) {
+ configuration.addConstructorParamType(clazz);
+ }
+ configuration.setMonitor(monitor);
+ configuration.setName(definition.getName());
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+
+ // handle properties
+ handleProperties(definition, component);
+
+ // handle resources
+ handleResources(componentType, component, parent);
+
+ handleCallbackSites(componentType, configuration);
+
+ // FIXME JFM this should be refactored to be by operation
+ // as per the Java C&I @AllowsPassByReference can be at the class level (applying to all methods in
+ //...the class or at the method level applying only to the specific method
+ component.setAllowsPassByReference(componentType.isAllowsPassByReference());
+ component.setPassByReferenceMethods(componentType.getPassByReferenceMethods());
+
+ if (componentType.getConversationIDMember() != null) {
+ component.addConversationIDFactory(componentType.getConversationIDMember());
+ }
+
+ return component;
+ }
+
+ private void handleCallbackSites(ComponentType componentType, PojoConfiguration configuration) {
+ for (Object sd : componentType.getServices().values()) {
+ // TODO: TUSCANY-1111, if using componentType side file with wsdl idl then may not get JavaMappedService
+ if (sd instanceof JavaMappedService) {
+ JavaMappedService service = (JavaMappedService) sd;
+ // setup callback injection sites
+ if (service.getCallbackReferenceName() != null) {
+ // Only if there is a callback reference in the service
+ configuration.addCallbackSite(service.getCallbackReferenceName(), service.getCallbackMember());
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings({"unchecked"})
+ private void handleResources(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType,
+ JavaAtomicComponent component,
+ CompositeComponent parent) {
+ for (Resource resource : componentType.getResources().values()) {
+ ObjectFactory<?> objectFactory = resource.getObjectFactory();
+ if (objectFactory != null) {
+ component.addResourceFactory(resource.getName(), objectFactory);
+ } else {
+ String name = resource.getName();
+ boolean optional = resource.isOptional();
+ Class<Object> type = (Class<Object>) resource.getType();
+ ResourceObjectFactory<Object> factory;
+ String mappedName = resource.getMappedName();
+ if (mappedName == null) {
+ // by type
+ factory = new ResourceObjectFactory<Object>(type, optional, parent, host);
+ } else {
+ factory = new ResourceObjectFactory<Object>(type, mappedName, optional, parent, host);
+ }
+ component.addResourceFactory(name, factory);
+ }
+ }
+ }
+
+ private void handleProperties(ComponentDefinition<JavaImplementation> definition, JavaAtomicComponent component) {
+ for (PropertyValue<?> property : definition.getPropertyValues().values()) {
+ ObjectFactory<?> factory = property.getValueFactory();
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ }
+
+ protected Class<JavaImplementation> getImplementationType() {
+ return JavaImplementation.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.java
new file mode 100644
index 0000000000..6eaba3bf2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoader.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.core.implementation.java;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+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.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentTypeLoader extends ComponentTypeLoaderExtension<JavaImplementation> {
+ @Autowire
+ protected JavaInterfaceProcessorRegistry processorRegistry;
+
+ private Introspector introspector;
+
+ @Constructor( {"registry", "introspector"})
+ public JavaComponentTypeLoader(@Autowire
+ LoaderRegistry loaderRegistry, @Autowire
+ IntrospectionRegistry introspector) {
+ super(loaderRegistry);
+ this.introspector = introspector;
+ }
+
+ @Override
+ protected Class<JavaImplementation> getImplementationClass() {
+ return JavaImplementation.class;
+ }
+
+ public void load(CompositeComponent parent, JavaImplementation implementation, DeploymentContext deploymentContext)
+ throws LoaderException {
+ Class<?> implClass = implementation.getImplementationClass();
+ PojoComponentType<JavaMappedService, ComponentTypeReferenceDefinition, JavaMappedProperty<?>> componentType = loadByIntrospection(parent, implementation, deploymentContext);
+ URL resource = implClass.getResource(JavaIntrospectionHelper.getBaseName(implClass) + ".componentType");
+ if (resource != null) {
+ // TODO: TUSCANY-1111, How to merge the component type loaded from the file into the PojoComponentType
+ PojoComponentType<?, ComponentTypeReferenceDefinition, ?> sideFileCT = loadFromSidefile(parent, resource, deploymentContext);
+
+ // TODO: TUSCANY-1111, hack to get the sidefile defined WSDLServiceContract used
+ // only works with a single service
+ Iterator it = componentType.getServices().values().iterator();
+ for (Object o : sideFileCT.getServices().values()) {
+ ServiceDefinition sideFileSD = (ServiceDefinition)o;
+ ServiceDefinition actualSD = (ServiceDefinition)it.next();
+ ServiceContract<?> newServiceContract = sideFileSD.getServiceContract();
+ ServiceContract<?> contract = actualSD.getServiceContract();
+ if (JavaServiceContract.class.isInstance(contract)) {
+ try {
+ // [rfeng] AS we now defer the java interface processing for TUSCANY-1165
+ // We need to do the full introspection now
+ contract =
+ processorRegistry.introspect(contract.getInterfaceClass(),
+ contract.getCallbackClass(),
+ true);
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException(e);
+ }
+ }
+ // TODO: TUSCANY-1111, runtime requires interfaceClass
+ // but currently there's no way of gen'ing that from WSDL
+ newServiceContract.setInterfaceClass(contract.getInterfaceClass());
+ newServiceContract.setDataBinding(contract.getDataBinding());
+ actualSD.setServiceContract(newServiceContract);
+ }
+
+ //TODO: if introspection has not yeilded any info, then atleast pick up things in the sidefile
+ //[svkrish] needed this for references overriding verification
+ ComponentTypeReferenceDefinition ctRefSideFile = null;
+ for (ComponentTypeReferenceDefinition ctRefIntrospection : componentType.getReferences().values()) {
+ if(ctRefIntrospection.getTargets() == null | ctRefIntrospection.getTargets().size() == 0) {
+ ctRefSideFile = sideFileCT.getReferences().get(ctRefIntrospection.getName());
+ if (ctRefSideFile != null) {
+ for(URI uri : ctRefSideFile.getTargets()) {
+ ctRefIntrospection.addTarget(uri);
+ }
+ }
+ }
+ }
+ }
+ implementation.setComponentType(componentType);
+ }
+
+ protected PojoComponentType loadByIntrospection(CompositeComponent parent,
+ JavaImplementation implementation,
+ DeploymentContext deploymentContext) throws ProcessingException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Class<?> implClass = implementation.getImplementationClass();
+ introspector.introspect(parent, implClass, componentType, deploymentContext);
+ return componentType;
+ }
+
+ protected PojoComponentType loadFromSidefile(CompositeComponent parent, URL url, DeploymentContext deploymentContext)
+ throws LoaderException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ return loaderRegistry.load(parent, componentType, url, PojoComponentType.class, deploymentContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.java
new file mode 100644
index 0000000000..432bf31d63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementation.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.implementation.java;
+
+import org.apache.tuscany.spi.model.AtomicImplementation;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaImplementation extends AtomicImplementation<PojoComponentType> {
+ private String className;
+ private Class<?> implementationClass;
+
+ public JavaImplementation() {
+ }
+
+ public JavaImplementation(Class<?> implementationClass) {
+ this.implementationClass = implementationClass;
+ this.className = implementationClass.getName();
+ }
+
+ public JavaImplementation(Class<?> implementationClass, PojoComponentType componentType) {
+ super(componentType);
+ this.implementationClass = implementationClass;
+ this.className = implementationClass == null ? null : implementationClass.getName();
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ this.implementationClass = null;
+ }
+
+ public Class<?> getImplementationClass() {
+ return implementationClass;
+ }
+
+ public void setImplementationClass(Class<?> implementationClass) {
+ this.implementationClass = implementationClass;
+ this.className = implementationClass.getName();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.java
new file mode 100644
index 0000000000..0f458c7ab4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaImplementationLoader.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.implementation.java;
+
+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.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderUtil;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.annotation.Autowire;
+
+public class JavaImplementationLoader extends LoaderExtension {
+ public static final QName IMPLEMENTATION_JAVA = new QName(SCA_NS, "implementation.java");
+
+ @Constructor({"registry"})
+ public JavaImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ @Override
+ public QName getXMLType() {
+ return IMPLEMENTATION_JAVA;
+ }
+
+ public ModelObject load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ assert IMPLEMENTATION_JAVA.equals(reader.getName());
+ String implClass = reader.getAttributeValue(null, "class");
+ Class<?> implementationClass = LoaderUtil.loadClass(implClass, deploymentContext.getClassLoader());
+
+ JavaImplementation implementation = new JavaImplementation();
+ implementation.setClassName(implClass);
+ implementation.setImplementationClass(implementationClass);
+ registry.loadComponentType(parent, implementation, deploymentContext);
+ LoaderUtil.skipToEndElement(reader);
+ return implementation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java
new file mode 100644
index 0000000000..6da60304fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java
@@ -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.
+ */
+package org.apache.tuscany.core.implementation.java;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.InvalidConversationSequenceException;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.findClosestMatchingMethod;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
+
+/**
+ * Responsible for synchronously dispatching an invocation to a Java component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaTargetInvoker extends TargetInvokerExtension {
+ protected Method operation;
+ protected JavaAtomicComponent component;
+ protected Object target;
+ protected Class callbackClass;
+ protected boolean stateless;
+
+ public JavaTargetInvoker(Method operation,
+ JavaAtomicComponent component,
+ InboundWire wire,
+ Class callbackClass,
+ WorkContext context,
+ ExecutionMonitor monitor) {
+ super(wire, context, monitor);
+ assert operation != null : "Operation method cannot be null";
+ this.operation = operation;
+ this.component = component;
+ stateless = Scope.STATELESS == component.getScope();
+ this.callbackClass = callbackClass;
+ }
+
+ public JavaTargetInvoker(Method operation,
+ JavaAtomicComponent component,
+ InboundWire callbackWire,
+ WorkContext context,
+ ExecutionMonitor monitor) {
+ this(operation, component, callbackWire, null, context, monitor);
+ }
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ Object instance = getInstance(sequence);
+ if (callbackClass != null && !callbackClass.isInstance(instance)) {
+ throw new InvocationTargetException(
+ new NoRegisteredCallbackException("Instance is does not implement callback ["
+ + callbackClass.toString() + "]"));
+ }
+ if (!operation.getDeclaringClass().isInstance(instance)) {
+ Set<Method> methods = getAllUniquePublicProtectedMethods(instance.getClass());
+ Method newOperation = findClosestMatchingMethod(operation.getName(),
+ operation.getParameterTypes(), methods);
+ if (newOperation != null) {
+ operation = newOperation;
+ }
+ }
+ Object ret;
+ if (payload != null && !payload.getClass().isArray()) {
+ ret = operation.invoke(instance, payload);
+ } else {
+ ret = operation.invoke(instance, (Object[]) payload);
+ }
+ if (stateless) {
+ // notify a stateless instance of a destruction event after the invoke
+ component.destroy(instance);
+ } else if (sequence == END) {
+ component.destroy(instance);
+ // if end conversation, remove resource
+ component.removeInstance();
+ }
+ return ret;
+ } catch (IllegalAccessException e) {
+ throw new InvocationTargetException(e);
+ } catch (ComponentException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ @Override
+ public JavaTargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ JavaTargetInvoker invoker = (JavaTargetInvoker) super.clone();
+ invoker.target = null;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+
+ /**
+ * Resolves the target service instance or returns a cached one
+ */
+ protected Object getInstance(short sequence) throws TargetException {
+ if (!cacheable) {
+ if (sequence == START || sequence == NONE) {
+ return component.getTargetInstance();
+ } else if (sequence == CONTINUE || sequence == END) {
+ return component.getAssociatedTargetInstance();
+ } else {
+ throw new InvalidConversationSequenceException("Unknown sequence type", String.valueOf(sequence));
+ }
+ } else {
+ assert sequence == NONE; // conversations are not cacheable
+ if (target == null) {
+ target = component.getTargetInstance();
+ }
+ return target;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessor.java
new file mode 100644
index 0000000000..19244810fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessor.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.implementation.processor;
+
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Processes {@link AllowsPassByReference} on an implementation
+ *
+ * @version $Rev: 479093 $ $Date: 2006-11-25 12:34:41 +0530 (Sat, 25 Nov 2006) $
+ */
+public class AllowsPassByReferenceProcessor extends ImplementationProcessorExtension {
+
+ public <T> void visitClass(CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ AllowsPassByReference annotation = clazz.getAnnotation(AllowsPassByReference.class);
+ if (annotation != null) {
+ type.setAllowsPassByReference(true);
+ } else {
+ type.setAllowsPassByReference(false);
+ }
+
+ }
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)throws ProcessingException {
+
+ AllowsPassByReference annotation = method.getAnnotation(AllowsPassByReference.class);
+ if (annotation != null) {
+ type.getPassByReferenceMethods().add(method.getName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AmbiguousConstructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AmbiguousConstructorException.java
new file mode 100644
index 0000000000..03d092880d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/AmbiguousConstructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when constructor parameters cannot be unambiguously resolved to a property or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AmbiguousConstructorException extends ProcessingException {
+
+ public AmbiguousConstructorException(String message) {
+ super(message);
+ }
+
+ public AmbiguousConstructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public AmbiguousConstructorException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessor.java
new file mode 100644
index 0000000000..50f60147ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessor.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+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.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+
+/**
+ * Handles processing of a constructor decorated with {@link org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unchecked")
+public class ConstructorProcessor extends ImplementationProcessorExtension {
+
+ private ImplementationProcessorService service;
+
+ public ConstructorProcessor(@Autowire ImplementationProcessorService service) {
+ this.service = service;
+ }
+
+ public <T> void visitClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ Constructor[] ctors = clazz.getConstructors();
+ boolean found = false;
+ for (Constructor constructor : ctors) {
+ if (constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
+ if (found) {
+ String name = constructor.getDeclaringClass().getName();
+ throw new DuplicateConstructorException("Multiple constructors marked with @Constructor", name);
+ }
+ found = true;
+ }
+ }
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent, Constructor<T> constructor,
+ PojoComponentType<JavaMappedService, JavaMappedReference,
+ JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ org.osoa.sca.annotations.Constructor annotation =
+ constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class);
+ if (annotation == null) {
+ return;
+ }
+ ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ if (definition != null && !definition.getConstructor().equals(constructor)) {
+ String name = constructor.getDeclaringClass().getName();
+ throw new DuplicateConstructorException("Multiple constructor definitions found", name);
+ } else if (definition == null) {
+ definition = new ConstructorDefinition(constructor);
+ }
+ Class<?>[] params = constructor.getParameterTypes();
+ String[] names = annotation.value();
+ Annotation[][] annotations = constructor.getParameterAnnotations();
+ List<String> injectionNames = definition.getInjectionNames();
+ for (int i = 0; i < params.length; i++) {
+ Class<?> param = params[i];
+ Annotation[] paramAnnotations = annotations[i];
+ try {
+ if (!service.processParam(param,
+ constructor.getGenericParameterTypes()[i],
+ paramAnnotations,
+ names,
+ i,
+ type,
+ injectionNames)) {
+ String name = (i < names.length) ? names[i] : "";
+ service.addName(injectionNames, i, name);
+ }
+ } catch (ProcessingException e) {
+ e.setMember(constructor);
+ throw e;
+ }
+ }
+ if (names.length != 0 && names[0].length() != 0 && names.length != params.length) {
+ throw new InvalidConstructorException("Names in @Constructor do not match number of parameters");
+ }
+ type.setConstructorDefinition(definition);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java
new file mode 100644
index 0000000000..c207fdb5c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.core.injection.CompositeContextObjectFactory;
+import org.apache.tuscany.core.injection.RequestContextObjectFactory;
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+
+/**
+ * Processes {@link @Context} annotations on a component implementation and adds a {@link JavaMappedProperty} to the
+ * component type which will be used to inject the appropriate context
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessor extends ImplementationProcessorExtension {
+ private WireService wireService;
+ private WorkContext workContext;
+
+ @Autowire
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ @Autowire
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public void visitMethod(CompositeComponent parent,
+ Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ if (method.getAnnotation(Context.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("Context setter must have one parameter", method.toString());
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ if (ComponentContext.class.equals(paramType)) {
+ // FIXME: handle injection of ComponentContext
+ throw new UnsupportedOperationException();
+/*
+ String name = method.getName();
+ name = JavaIntrospectionHelper.toPropertyName(name);
+ Resource resource = new Resource();
+ resource.setName(name);
+ resource.setMember(method);
+ resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
+ type.getResources().put(name, resource);
+*/
+ } else if (RequestContext.class.equals(paramType)) {
+ String name = method.getName();
+ name = JavaIntrospectionHelper.toPropertyName(name);
+ Resource resource = new Resource();
+ resource.setName(name);
+ resource.setMember(method);
+ resource.setObjectFactory(new RequestContextObjectFactory(workContext));
+ type.getResources().put(name, resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+
+ public void visitField(CompositeComponent parent, Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ if (field.getAnnotation(Context.class) == null) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (ComponentContext.class.equals(paramType)) {
+ // FIXME: handle injection of ComponentContext
+ throw new UnsupportedOperationException();
+/*
+ String name = field.getName();
+ Resource resource = new Resource();
+ resource.setName(name);
+ resource.setMember(field);
+ resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
+ type.getResources().put(name, resource);
+*/
+ } else if (CompositeContext.class.equals(paramType)) {
+ String name = field.getName();
+ Resource resource = new Resource();
+ resource.setName(name);
+ resource.setMember(field);
+ resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
+ type.getResources().put(name, resource);
+ } else if (RequestContext.class.equals(paramType)) {
+ String name = field.getName();
+ name = JavaIntrospectionHelper.toPropertyName(name);
+ Resource resource = new Resource();
+ resource.setName(name);
+ resource.setMember(field);
+ resource.setObjectFactory(new RequestContextObjectFactory(workContext));
+ type.getResources().put(name, resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.java
new file mode 100644
index 0000000000..fa369f72c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ConversationProcessor.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.core.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationProcessor extends ImplementationProcessorExtension {
+ private static final String SECONDS = " SECONDS";
+ private static final String MINUTES = " MINUTES";
+ private static final String HOURS = " HOURS";
+ private static final String DAYS = " DAYS";
+ private static final String YEARS = " YEARS";
+
+ public <T> void visitClass(CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ ConversationAttributes conversation = clazz.getAnnotation(ConversationAttributes.class);
+ if (conversation == null) {
+ return;
+ }
+ Scope scope = clazz.getAnnotation(Scope.class);
+ if (scope == null) {
+ // implicitly assume conversation
+ type.setImplementationScope(org.apache.tuscany.spi.model.Scope.CONVERSATION);
+ } else if (scope != null && !"CONVERSATION".equals(scope.value().toUpperCase())) {
+ throw new InvalidConversationalImplementation(
+ "Service is marked with @ConversationAttributes but the scope is not @Scope(\"CONVERSATION\")",
+ clazz.getName());
+ } else if (conversation != null) {
+ long maxAge;
+ long maxIdleTime;
+ String maxAgeVal = conversation.maxAge();
+ String maxIdleTimeVal = conversation.maxIdleTime();
+ if (maxAgeVal.length() > 0 && maxIdleTimeVal.length() > 0) {
+ throw new InvalidConversationalImplementation("Max idle time and age both specified", clazz.getName());
+ }
+ try {
+ if (maxAgeVal.length() > 0) {
+ maxAge = convertTimeMillis(maxAgeVal);
+ type.setMaxAge(maxAge);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum age", clazz.getName(), e);
+ }
+ try {
+ if (maxIdleTimeVal.length() > 0) {
+ maxIdleTime = convertTimeMillis(maxIdleTimeVal);
+ type.setMaxIdleTime(maxIdleTime);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum idle time", clazz.getName(), e);
+ }
+ }
+
+ }
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ ConversationID conversationID = method.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.setConversationIDMember(method);
+ }
+
+ public void visitField(CompositeComponent parent, Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ ConversationID conversationID = field.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.setConversationIDMember(field);
+ }
+
+ protected long convertTimeMillis(String expr) throws NumberFormatException {
+ expr = expr.trim().toUpperCase();
+ int i = expr.lastIndexOf(SECONDS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 1000;
+ }
+ i = expr.lastIndexOf(MINUTES);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 60000;
+ }
+
+ i = expr.lastIndexOf(HOURS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 3600000;
+ }
+ i = expr.lastIndexOf(DAYS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 86400000;
+ }
+ i = expr.lastIndexOf(YEARS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 31556926000L;
+ }
+ return Long.parseLong(expr) * 1000; // assume seconds if no suffix specified
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DestroyProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DestroyProcessor.java
new file mode 100644
index 0000000000..7ef540432f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DestroyProcessor.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.implementation.processor;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.osoa.sca.annotations.Destroy;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Processes the {@link @Destroy} annotation on a component implementation and updates the component type with the
+ * decorated destructor method
+ *
+ * @version $Rev$ $Date$
+ */
+public class DestroyProcessor extends ImplementationProcessorExtension {
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ Destroy annotation = method.getAnnotation(Destroy.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalDestructorException("Destructor must not have argments", method.toString());
+ }
+ if (type.getDestroyMethod() != null) {
+ throw new DuplicateDestructorException("More than one destructor found on implementation");
+ }
+ if (Modifier.isProtected(method.getModifiers())) {
+ method.setAccessible(true);
+ }
+ type.setDestroyMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateConstructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateConstructorException.java
new file mode 100644
index 0000000000..88db7ebb79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateConstructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when more than one component implementation constructor is annotated with {@link
+ * org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateConstructorException extends ProcessingException {
+
+ public DuplicateConstructorException(String message) {
+ super(message);
+ }
+
+ public DuplicateConstructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateDestructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateDestructorException.java
new file mode 100644
index 0000000000..6225bd6219
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateDestructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateDestructorException extends ProcessingException {
+
+ public DuplicateDestructorException(String message) {
+ super(message);
+ }
+
+ public DuplicateDestructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateInitException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateInitException.java
new file mode 100644
index 0000000000..105edee1a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateInitException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateInitException extends ProcessingException {
+
+ public DuplicateInitException(String message) {
+ super(message);
+ }
+
+ public DuplicateInitException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateReferenceException.java
new file mode 100644
index 0000000000..5eae1461c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateReferenceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when an implementation has more than one reference injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateReferenceException extends ProcessingException {
+
+ public DuplicateReferenceException(String message) {
+ super(message);
+ }
+
+
+ public DuplicateReferenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateResourceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateResourceException.java
new file mode 100644
index 0000000000..9dd718c03e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/DuplicateResourceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when an implementation has more than one resource injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateResourceException extends ProcessingException {
+
+ public DuplicateResourceException(String message) {
+ super(message);
+ }
+
+ public DuplicateResourceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessor.java
new file mode 100644
index 0000000000..a2431dc5b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessor.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.implementation.processor;
+
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Handles processing of {@link org.osoa.sca.annotations.EagerInit}
+ *
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessor extends ImplementationProcessorExtension {
+
+ public <T> void visitClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ super.visitClass(parent, clazz, type, context);
+ EagerInit annotation = clazz.getAnnotation(EagerInit.class);
+ if (annotation == null) {
+ Class<?> superClass = clazz.getSuperclass();
+ while (!Object.class.equals(superClass)) {
+ annotation = superClass.getAnnotation(EagerInit.class);
+ if (annotation != null) {
+ break;
+ }
+ superClass = superClass.getSuperclass();
+ }
+ if (annotation == null) {
+ return;
+ }
+ }
+ type.setInitLevel(50);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessor.java
new file mode 100644
index 0000000000..e00c96664b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessor.java
@@ -0,0 +1,550 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllInterfaces;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllPublicAndProtectedFields;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getBaseName;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.toPropertyName;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+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.CompositeComponent;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Heuristically evaluates an un-annotated Java implementation type to determine services, references, and properties
+ * according to the algorithm described in the SCA Java Client and Implementation Model Specification <p/> TODO
+ * Implement:
+ * <p/>
+ * When no service inteface is annotated, need to calculate a single service comprising all public methods that are not
+ * reference or property injection sites. If that service can be exactly mapped to an interface implemented by the class
+ * then the service interface will be defined in terms of that interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeuristicPojoProcessor extends ImplementationProcessorExtension {
+ private SimpleTypeMapperExtension typeMapper = new SimpleTypeMapperExtension();
+ private ImplementationProcessorService implService;
+
+ public HeuristicPojoProcessor(@Autowire ImplementationProcessorService service) {
+ this.implService = service;
+ }
+
+ public <T> void visitEnd(
+ CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ Map<String, JavaMappedService> services = type.getServices();
+ if (services.isEmpty()) {
+ // heuristically determine the service
+ // TODO finish algorithm
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ if (interfaces.size() == 0) {
+ // class is the interface
+ JavaMappedService service;
+ try {
+ service = implService.createService(clazz);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getServices().put(service.getName(), service);
+ } else if (interfaces.size() == 1) {
+ JavaMappedService service;
+ try {
+ service = implService.createService(interfaces.iterator().next());
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getServices().put(service.getName(), service);
+ }
+ }
+ Set<Method> methods = getAllUniquePublicProtectedMethods(clazz);
+ if (!type.getReferences().isEmpty() || !type.getProperties().isEmpty()) {
+ // references and properties have been explicitly defined
+ if (type.getServices().isEmpty()) {
+ calculateServiceInterface(clazz, type, methods);
+ if (type.getServices().isEmpty()) {
+ throw new ServiceTypeNotFoundException(clazz.getName());
+ }
+ }
+ evaluateConstructor(type, clazz);
+ return;
+ }
+ calcPropRefs(methods, services, type, clazz);
+ evaluateConstructor(type, clazz);
+ }
+
+ private <T> void calcPropRefs(Set<Method> methods,
+ Map<String, JavaMappedService> services,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Class<T> clazz) throws ProcessingException {
+ // heuristically determine the properties references
+ // make a first pass through all public methods with one param
+ for (Method method : methods) {
+ if (method.getParameterTypes().length != 1 || !Modifier.isPublic(method.getModifiers())
+ || !method.getName().startsWith("set")
+ || method.getReturnType() != void.class) {
+ continue;
+ }
+ if (!isInServiceInterface(method, services)) {
+ String name = toPropertyName(method.getName());
+ // avoid duplicate property or ref names
+ if (!type.getProperties().containsKey(name) && !type.getReferences().containsKey(name)) {
+ Class<?> param = method.getParameterTypes()[0];
+ Type genericType = method.getGenericParameterTypes()[0];
+ if (isReferenceType(genericType)) {
+ type.add(createReference(name, method, param));
+ } else {
+ type.add(createProperty(name, method, param));
+ }
+ }
+ }
+ }
+ // second pass for protected methods with one param
+ for (Method method : methods) {
+ if (method.getParameterTypes().length != 1 || !Modifier.isProtected(method.getModifiers())
+ || !method.getName().startsWith("set")
+ || method.getReturnType() != void.class) {
+ continue;
+ }
+ Class<?> param = method.getParameterTypes()[0];
+ String name = toPropertyName(method.getName());
+ // avoid duplicate property or ref names
+ if (!type.getProperties().containsKey(name) && !type.getReferences().containsKey(name)) {
+ if (isReferenceType(param)) {
+ type.add(createReference(name, method, param));
+ } else {
+ type.add(createProperty(name, method, param));
+ }
+ }
+ }
+ Set<Field> fields = getAllPublicAndProtectedFields(clazz);
+ for (Field field : fields) {
+ Class<?> paramType = field.getType();
+ if (isReferenceType(paramType)) {
+ type.add(createReference(field.getName(), field, paramType));
+ } else {
+ type.add(createProperty(field.getName(), field, paramType));
+ }
+ }
+ }
+
+ /**
+ * Determines the constructor to use based on the component type's references and properties
+ *
+ * @param type the component type
+ * @param clazz the implementation class corresponding to the component type
+ * @throws NoConstructorException if no suitable constructor is found
+ * @throws AmbiguousConstructorException if the parameters of a constructor cannot be unambiguously mapped to
+ * references and properties
+ */
+ @SuppressWarnings("unchecked")
+ private <T> void evaluateConstructor(
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Class<T> clazz) throws ProcessingException {
+ // determine constructor if one is not annotated
+ ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ Constructor constructor;
+ boolean explict = false;
+ if (definition != null
+ && definition.getConstructor().getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
+ // the constructor was already defined explicitly
+ return;
+ } else if (definition != null) {
+ explict = true;
+ constructor = definition.getConstructor();
+ } else {
+ // no definition, heuristically determine constructor
+ Constructor[] constructors = clazz.getConstructors();
+ if (constructors.length == 0) {
+ throw new NoConstructorException("No public constructor for class", clazz.getName());
+ } else if (constructors.length == 1) {
+ constructor = constructors[0];
+ } else {
+ // FIXME multiple constructors, none yet done
+ Constructor<T> selected = null;
+ int sites = type.getProperties().size() + type.getReferences().size();
+ for (Constructor<T> ctor : constructors) {
+ if (ctor.getParameterTypes().length == 0) {
+ selected = ctor;
+ }
+ if (ctor.getParameterTypes().length == sites) {
+ // TODO finish
+ // selected = constructor;
+ // select constructor
+ // break;
+ }
+ }
+ if (selected == null) {
+ throw new NoConstructorException();
+ }
+ constructor = selected;
+ definition = new ConstructorDefinition<T>(selected);
+ type.setConstructorDefinition(definition);
+ // return;
+ }
+ definition = new ConstructorDefinition<T>(constructor);
+ type.setConstructorDefinition(definition);
+ }
+ Class[] params = constructor.getParameterTypes();
+ if (params.length == 0) {
+ return;
+ }
+ List<String> paramNames = definition.getInjectionNames();
+ Map<String, JavaMappedProperty<?>> props = type.getProperties();
+ Map<String, JavaMappedReference> refs = type.getReferences();
+ Annotation[][] annotations = constructor.getParameterAnnotations();
+ if (!explict) {
+ // the constructor wasn't defined by an annotation, so check to see if any of the params have an annotation
+ // which we can impute as explicitly defining the constructor, e.g. @Property, @Reference, or @Autowire
+ explict = implService.injectionAnnotationsPresent(annotations);
+ }
+ if (explict) {
+ for (int i = 0; i < params.length; i++) {
+ Class param = params[i];
+ implService.processParam(param,
+ constructor.getGenericParameterTypes()[i],
+ annotations[i],
+ new String[0],
+ i,
+ type,
+ paramNames);
+ }
+ } else {
+ if (!implService.areUnique(params)) {
+ throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
+ }
+ if (!calcPropRefUniqueness(props.values(), refs.values())) {
+ throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
+ }
+ boolean empty = props.size() + refs.size() == 0;
+ if (!empty) {
+ calcParamNames(params, props, refs, paramNames);
+ } else {
+ heuristicParamNames(params, refs, props, paramNames);
+
+ }
+ }
+ }
+
+ private void calcParamNames(Class[] params,
+ Map<String, JavaMappedProperty<?>> props,
+ Map<String, JavaMappedReference> refs,
+ List<String> paramNames)
+ throws AmbiguousConstructorException {
+ // the constructor param types must unambiguously match defined reference or property types
+ for (Class param : params) {
+ String name = findReferenceOrProperty(param, props, refs);
+ if (name == null) {
+ throw new AmbiguousConstructorException(param.getName());
+ }
+ paramNames.add(name);
+ }
+ }
+
+ private void heuristicParamNames(Class[] params,
+ Map<String, JavaMappedReference> refs,
+ Map<String, JavaMappedProperty<?>> props,
+ List<String> paramNames)
+ throws ProcessingException {
+ // heuristically determine refs and props from the parameter types
+ for (Class<?> param : params) {
+ String name = getBaseName(param).toLowerCase();
+ if (isReferenceType(param)) {
+ refs.put(name, createReference(name, null, param));
+ } else {
+ props.put(name, createProperty(name, null, param));
+ }
+ paramNames.add(name);
+ }
+ }
+
+ /**
+ * Returns true if the union of the given collections of properties and references have unique Java types
+ */
+ private boolean calcPropRefUniqueness(
+ Collection<JavaMappedProperty<?>> props,
+ Collection<JavaMappedReference> refs) {
+
+ Class[] classes = new Class[props.size() + refs.size()];
+ int i = 0;
+ for (JavaMappedProperty<?> property : props) {
+ classes[i] = property.getJavaType();
+ i++;
+ }
+ for (JavaMappedReference reference : refs) {
+ classes[i] = reference.getServiceContract().getInterfaceClass();
+ i++;
+ }
+ return implService.areUnique(classes);
+ }
+
+ /**
+ * Unambiguously finds the reference or property associated with the given type
+ *
+ * @return the name of the reference or property if found, null if not
+ * @throws AmbiguousConstructorException if the constructor parameter cannot be resolved to a property or reference
+ */
+ private String findReferenceOrProperty(
+ Class<?> type,
+ Map<String, JavaMappedProperty<?>> props,
+ Map<String, JavaMappedReference> refs) throws AmbiguousConstructorException {
+
+ String name = null;
+ for (JavaMappedProperty<?> property : props.values()) {
+ if (property.getJavaType().equals(type)) {
+ if (name != null) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ type.getName());
+ }
+ name = property.getName();
+ // do not break since ambiguities must be checked, i.e. more than one prop or ref of the same type
+ }
+ }
+ for (JavaMappedReference reference : refs.values()) {
+ if (reference.getServiceContract().getInterfaceClass().equals(type)) {
+ if (name != null) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ type.getName());
+ }
+ name = reference.getName();
+ // do not break since ambiguities must be checked, i.e. more than one prop or ref of the same type
+ }
+ }
+ return name;
+ }
+
+ /**
+ * Returns true if a given type is reference according to the SCA specification rules for determining reference
+ * types
+ */
+ private boolean isReferenceType(Type operationType) {
+ Class<?> rawType;
+ Class<?> referenceType = null;
+ if (operationType instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) operationType;
+ rawType = (Class<?>) parameterizedType.getRawType();
+ Type[] typeArgs = parameterizedType.getActualTypeArguments();
+ if (typeArgs.length == 1) {
+ referenceType = (Class<?>) typeArgs[0];
+ }
+ } else {
+ rawType = (Class<?>) operationType;
+ }
+ if (rawType.isArray()) {
+ referenceType = rawType.getComponentType();
+ } else if (Collection.class.isAssignableFrom(rawType) && referenceType == null) {
+ return true;
+ }
+ if (referenceType != null) {
+ return referenceType.getAnnotation(Remotable.class) != null
+ || referenceType.getAnnotation(Service.class) != null;
+ } else {
+ return rawType.getAnnotation(Remotable.class) != null || rawType.getAnnotation(Service.class) != null;
+ }
+ }
+
+ /**
+ * Returns true if the given operation is defined in the collection of service interfaces
+ */
+ private boolean isInServiceInterface(Method operation, Map<String, JavaMappedService> services) {
+ for (JavaMappedService service : services.values()) {
+ Class<?> clazz = service.getServiceContract().getInterfaceClass();
+ if (operation.getDeclaringClass().equals(clazz)) {
+ return true;
+ }
+ Method[] methods = service.getServiceContract().getInterfaceClass().getMethods();
+ for (Method method : methods) {
+ if (operation.getName().equals(method.getName())
+ && operation.getParameterTypes().length == method.getParameterTypes().length) {
+ Class<?>[] methodTypes = method.getParameterTypes();
+ for (int i = 0; i < operation.getParameterTypes().length; i++) {
+ Class<?> paramType = operation.getParameterTypes()[i];
+ if (!paramType.equals(methodTypes[i])) {
+ break;
+ } else if (i == operation.getParameterTypes().length - 1) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Creates a mapped reference
+ *
+ * @param name the reference name
+ * @param member the injection site the reference maps to
+ * @param paramType the service interface of the reference
+ */
+ private JavaMappedReference createReference(String name, Member member, Class<?> paramType)
+ throws ProcessingException {
+ return implService.createReference(name, member, paramType);
+ }
+
+ /**
+ * Creates a mapped property
+ *
+ * @param name the property name
+ * @param member the injection site the reference maps to
+ * @param paramType the property type
+ */
+ private <T> JavaMappedProperty<T> createProperty(String name, Member member, Class<T> paramType) {
+ JavaMappedProperty<T> property = new JavaMappedProperty<T>();
+ property.setName(name);
+ property.setMember(member);
+ property.setMustSupply(false);
+ property.setJavaType(paramType);
+ TypeInfo xmlType = typeMapper.getXMLType(paramType);
+ if (xmlType != null) {
+ property.setXmlType(xmlType.getQName());
+ }
+
+ return property;
+ }
+
+ /**
+ * Populates a component type with a service whose interface type is determined by examining all implemented
+ * interfaces of the given class and chosing one whose operations match all of the class's non-property and
+ * non-reference methods
+ *
+ * @param clazz the class to examine
+ * @param type the component type
+ * @param methods all methods in the class to examine
+ */
+ private void calculateServiceInterface(
+ Class<?> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Set<Method> methods) throws ProcessingException {
+ List<Method> nonPropRefMethods = new ArrayList<Method>();
+ // Map<String, JavaMappedService> services = type.getServices();
+ Map<String, JavaMappedReference> references = type.getReferences();
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ // calculate methods that are not properties or references
+ for (Method method : methods) {
+ String name = toPropertyName(method.getName());
+ if (!references.containsKey(name) && !properties.containsKey(name)) {
+ nonPropRefMethods.add(method);
+ }
+ }
+ // determine if an implemented interface matches all of the non-property and non-reference methods
+ Class[] interfaces = clazz.getInterfaces();
+ if (interfaces.length == 0) {
+ return;
+ }
+ for (Class interfaze : interfaces) {
+ if (analyzeInterface(interfaze, nonPropRefMethods)) {
+ JavaMappedService service;
+ try {
+ service = implService.createService(interfaze);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getServices().put(service.getName(), service);
+ }
+ }
+ }
+
+ /**
+ * Determines if the methods of a given interface match the given list of methods
+ *
+ * @param interfaze the interface to examine
+ * @param nonPropRefMethods the list of methods to match against
+ * @return true if the interface matches
+ */
+ private boolean analyzeInterface(Class<?> interfaze, List<Method> nonPropRefMethods) {
+ Method[] interfaceMethods = interfaze.getMethods();
+ if (nonPropRefMethods.size() != interfaceMethods.length) {
+ return false;
+ }
+ for (Method method : nonPropRefMethods) {
+ boolean found = false;
+ for (Method interfaceMethod : interfaceMethods) {
+ if (interfaceMethod.getName().equals(method.getName())) {
+ Class<?>[] interfaceParamTypes = interfaceMethod.getParameterTypes();
+ Class<?>[] methodParamTypes = method.getParameterTypes();
+ if (interfaceParamTypes.length == methodParamTypes.length) {
+ if (interfaceParamTypes.length == 0) {
+ found = true;
+ } else {
+ for (int i = 0; i < methodParamTypes.length; i++) {
+ Class<?> param = methodParamTypes[i];
+ if (!param.equals(interfaceParamTypes[i])) {
+ break;
+ }
+ if (i == methodParamTypes.length - 1) {
+ found = true;
+ }
+ }
+ }
+ }
+ if (found) {
+ break;
+ }
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+}
+
+/*
+ * 1) public setter methods that are not included in any service interface 2) protected setter methods 3) public or
+ * protected fields unless there is a setter method for the same name If the type associated with the member is an array
+ * or a java.util.Collection, then the basetype will be the element type of the array or the parameterized type of the
+ * Collection, otherwise the basetype will be the member type. If the basetype is an interface with an @Remotable or
+ * @Service annotation then the member will be defined as a reference, otherwise it will be defined as a property.
+ *
+ *
+ */
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalCallbackReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalCallbackReferenceException.java
new file mode 100644
index 0000000000..4581faa872
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalCallbackReferenceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegcal use of {@link org.osoa.sca.annotations.Callback} on a reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalCallbackReferenceException extends ProcessingException {
+
+ public IllegalCallbackReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalCallbackReferenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalContextException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalContextException.java
new file mode 100644
index 0000000000..8c56cade83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalContextException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Context}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalContextException extends ProcessingException {
+
+ public IllegalContextException(String message) {
+ super(message);
+ }
+
+ public IllegalContextException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalDestructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalDestructorException.java
new file mode 100644
index 0000000000..fee42ea5c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalDestructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalDestructorException extends ProcessingException {
+
+ public IllegalDestructorException(String message) {
+ super(message);
+ }
+
+ public IllegalDestructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalInitException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalInitException.java
new file mode 100644
index 0000000000..219074b785
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalInitException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalInitException extends ProcessingException {
+ public IllegalInitException(String message) {
+ super(message);
+ }
+
+ public IllegalInitException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalReferenceException.java
new file mode 100644
index 0000000000..11137bcaba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalReferenceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal reference definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalReferenceException extends ProcessingException {
+
+ public IllegalReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalReferenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalResourceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalResourceException.java
new file mode 100644
index 0000000000..e25c1174e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalResourceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal resource definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalResourceException extends ProcessingException {
+
+ public IllegalResourceException(String message) {
+ super(message);
+ }
+
+ public IllegalResourceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalServiceDefinitionException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalServiceDefinitionException.java
new file mode 100644
index 0000000000..1d9079636a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/IllegalServiceDefinitionException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an illegal use of the {@link @org.osoa.sca.annotations.Service} annotation
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalServiceDefinitionException extends ProcessingException {
+
+ public IllegalServiceDefinitionException(String message) {
+ super(message);
+ }
+
+ public IllegalServiceDefinitionException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java
new file mode 100644
index 0000000000..44e35fab14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceImpl.java
@@ -0,0 +1,469 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getBaseName;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.core.idl.java.IllegalCallbackException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.implementation.java.DuplicatePropertyException;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+import org.apache.tuscany.api.annotation.Resource;
+
+/**
+ * The default implementation of an <code>ImplementationProcessorService</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImplementationProcessorServiceImpl implements ImplementationProcessorService {
+ private JavaInterfaceProcessorRegistry registry;
+ private SimpleTypeMapperExtension typeMapper = new SimpleTypeMapperExtension();
+
+ public ImplementationProcessorServiceImpl(@Autowire JavaInterfaceProcessorRegistry registry) {
+ this.registry = registry;
+ }
+
+ public JavaMappedService createService(Class<?> interfaze) throws InvalidServiceContractException {
+ JavaMappedService service = new JavaMappedService();
+ service.setName(interfaze.getSimpleName());
+ service.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
+ ServiceContract<?> contract = registry.introspect(interfaze, false);
+ service.setServiceContract(contract);
+ return service;
+ }
+
+ public void processCallback(Class<?> interfaze, ServiceContract<?> contract) throws IllegalCallbackException {
+ Callback callback = interfaze.getAnnotation(Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ Class<?> callbackClass = callback.value();
+ contract.setCallbackClass(callbackClass);
+ contract.setCallbackName(getBaseName(callbackClass));
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new IllegalCallbackException("No callback interface specified on annotation", interfaze.getName());
+ }
+ }
+
+ public boolean areUnique(Class[] collection) {
+ if (collection.length == 0) {
+ return true;
+ }
+ return areUnique(collection, 0);
+ }
+
+ public void addName(List<String> names, int pos, String name) {
+ if (names.size() < pos) {
+ for (int i = 0; i < pos; i++) {
+ names.add(i, "");
+ }
+ names.add(name);
+ } else if (names.size() > pos) {
+ names.remove(pos);
+ names.add(pos, name);
+ } else {
+ names.add(pos, name);
+ }
+ }
+
+ public boolean processParam(
+ Class<?> param,
+ Type genericParam,
+ Annotation[] paramAnnotations,
+ String[] constructorNames,
+ int pos,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ List<String> injectionNames) throws ProcessingException {
+ boolean processed = false;
+ for (Annotation annot : paramAnnotations) {
+ if (Autowire.class.equals(annot.annotationType())) {
+ processed = true;
+ processAutowire(annot, constructorNames, pos, param, genericParam, type, injectionNames);
+ } else if (Property.class.equals(annot.annotationType())) {
+ processed = true;
+ processProperty(annot, constructorNames, pos, type, param, genericParam, injectionNames);
+ } else if (Reference.class.equals(annot.annotationType())) {
+ processed = true;
+ processReference(annot, constructorNames, pos, type, param, genericParam, injectionNames);
+ } else if (Resource.class.equals(annot.annotationType())) {
+ processed = true;
+ processResource((Resource) annot, constructorNames, pos, type, param, injectionNames);
+ }
+ }
+ return processed;
+ }
+
+ public boolean injectionAnnotationsPresent(Annotation[][] annots) {
+ for (Annotation[] annotations : annots) {
+ for (Annotation annotation : annotations) {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+ if (annotType.equals(Autowire.class) || annotType.equals(Property.class)
+ || annotType.equals(Reference.class)
+ || annotType.equals(Resource.class)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public JavaMappedReference createReference(String name, Member member, Class<?> paramType)
+ throws ProcessingException {
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setName(name);
+ reference.setMember(member);
+ //reference.setRequired(false);
+ ServiceContract contract;
+ try {
+ contract = registry.introspect(paramType, false);
+ } catch (InvalidServiceContractException e1) {
+ throw new ProcessingException(e1);
+ }
+ try {
+ processCallback(paramType, contract);
+ } catch (IllegalCallbackException e) {
+ throw new ProcessingException(e);
+ }
+ reference.setServiceContract(contract);
+ return reference;
+ }
+
+ /**
+ * Determines if all the members of a collection have unique types
+ *
+ * @param collection the collection to analyze
+ * @param start the position in the collection to start
+ * @return true if the types are unique
+ */
+ private boolean areUnique(Class[] collection, int start) {
+ Object compare = collection[start];
+ for (int i = start + 1; i < collection.length; i++) {
+ if (compare.equals(collection[i])) {
+ return false;
+ }
+ }
+ if (start + 1 < collection.length) {
+ return areUnique(collection, start + 1);
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Processes autowire metadata for a constructor parameter
+ *
+ * @param annot the autowire annotation
+ * @param constructorNames the parameter names as specified in an {@link org.osoa.sca.annotations.Constructor}
+ * annotation
+ * @param pos the position of the parameter in the constructor's parameter list
+ * @param param the parameter type
+ * @param type the component type associated with the implementation being processed
+ * @param injectionNames the collection of injection names to update
+ * @throws InvalidAutowireException
+ * @throws InvalidConstructorException
+ */
+ private void processAutowire(
+ Annotation annot,
+ String[] constructorNames,
+ int pos,
+ Class<?> param,
+ Type genericParam,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ List<String> injectionNames) throws ProcessingException {
+ // the param is marked as an autowire
+ Autowire autowireAnnot = (Autowire) annot;
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setAutowire(true);
+ String name = autowireAnnot.name();
+ if (name == null || name.length() == 0) {
+ if (constructorNames.length > 1 && (constructorNames.length < pos + 1 || constructorNames[pos] == null)) {
+ throw new InvalidAutowireException("Names in @Constructor and autowire parameter do not match at "
+ + (pos + 1));
+ } else if (constructorNames.length == 1 && constructorNames[0].length() == 0) {
+ // special case when @Constructor present with all autowire params not specifying any name
+ name = param.getName() + String.valueOf(pos);
+ } else if (constructorNames.length == 1
+ && (constructorNames.length < pos + 1 || constructorNames[pos] == null)) {
+ throw new InvalidAutowireException("Names in @Constructor and autowire parameter do not match at "
+ + (pos + 1));
+ } else if (constructorNames.length == 1 && constructorNames[0].length() > 0) {
+ name = constructorNames[pos];
+ } else if (constructorNames.length == 0 || constructorNames[pos].length() == 0) {
+ name = param.getName() + String.valueOf(pos);
+ } else {
+ name = constructorNames[pos];
+ }
+ } else if (pos < constructorNames.length && constructorNames[pos] != null
+ && constructorNames[pos].length() != 0 && !name.equals(constructorNames[pos])) {
+ String paramNum = String.valueOf(pos + 1);
+ throw new InvalidConstructorException("Name specified by @Constructor does not match autowire name",
+ paramNum);
+ }
+ reference.setName(name);
+ boolean required = autowireAnnot.required();
+ //reference.setRequired(required);
+ try {
+ Class<?> rawType = param;
+ if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ } else {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ }
+ Class<?> baseType = getBaseType(rawType, genericParam);
+ ServiceContract<?> contract = registry.introspect(baseType, false);
+ reference.setServiceContract(contract);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getReferences().put(name, reference);
+ addName(injectionNames, pos, name);
+ }
+
+ /**
+ * Processes parameter metadata for a constructor parameter
+ *
+ * @param annot the parameter annotation
+ * @param constructorNames the parameter names as specified in an {@link org.osoa.sca.annotations.Constructor}
+ * annotation
+ * @param pos the position of the parameter in the constructor's parameter list
+ * @param type the component type associated with the implementation being processed
+ * @param param the parameter type
+ * @param explicitNames the collection of injection names to update
+ * @throws ProcessingException
+ */
+ @SuppressWarnings("unchecked")
+ private void processProperty(
+ Annotation annot,
+ String[] constructorNames,
+ int pos,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Class<?> param,
+ Type genericParam,
+ List<String> explicitNames) throws ProcessingException {
+ // the param is marked as a property
+ Property propAnnot = (Property) annot;
+ JavaMappedProperty property = new JavaMappedProperty();
+ Class<?> baseType = getBaseType(param, genericParam);
+ if (param.isArray() || Collection.class.isAssignableFrom(param)) {
+ property.setMany(true);
+ }
+ property.setJavaType(baseType);
+ String name = propAnnot.name();
+ if (name == null || name.length() == 0) {
+ if (constructorNames.length < pos + 1 || constructorNames[pos] == null
+ || constructorNames[pos].length() == 0) {
+ throw new InvalidPropertyException("No name specified for property parameter " + (pos + 1));
+ }
+ name = constructorNames[pos];
+ } else if (pos < constructorNames.length && constructorNames[pos] != null
+ && constructorNames[pos].length() != 0 && !name.equals(constructorNames[pos])) {
+ String paramNum = String.valueOf(pos + 1);
+ throw new InvalidConstructorException("Name specified by @Constructor does not match property name",
+ paramNum);
+ }
+ if (type.getProperties().get(name) != null) {
+ throw new DuplicatePropertyException(name);
+ }
+ property.setName(name);
+ property.setMustSupply(propAnnot.required());
+
+ String xmlType = propAnnot.xmlType();
+ if (xmlType != null && xmlType.length() != 0) {
+ property.setXmlType(QName.valueOf(xmlType));
+ } else {
+ TypeInfo typeInfo = typeMapper.getXMLType(property.getJavaType());
+ if (typeInfo != null) {
+ property.setXmlType(typeInfo.getQName());
+ }
+ }
+ type.getProperties().put(name, property);
+ addName(explicitNames, pos, name);
+ }
+
+ /**
+ * Processes reference metadata for a constructor parameter
+ *
+ * @param annot the parameter annotation
+ * @param constructorNames the parameter names as specified in an {@link org.osoa.sca.annotations.Constructor}
+ * annotation
+ * @param pos the position of the parameter in the constructor's parameter list
+ * @param type the component type associated with the implementation being processed
+ * @param param the parameter type
+ * @param explicitNames the collection of injection names to update
+ * @throws ProcessingException
+ */
+ private void processReference(
+ Annotation annot,
+ String[] constructorNames,
+ int pos,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Class<?> param,
+ Type genericParam,
+ List<String> explicitNames) throws ProcessingException {
+
+ // TODO multiplicity
+ // the param is marked as a reference
+ Reference refAnnotation = (Reference) annot;
+ JavaMappedReference reference = new JavaMappedReference();
+ String name = refAnnotation.name();
+ if (name == null || name.length() == 0) {
+ if (constructorNames.length < pos + 1 || constructorNames[pos] == null
+ || constructorNames[pos].length() == 0) {
+ throw new InvalidReferenceException("No name specified for reference parameter " + (pos + 1));
+ }
+ name = constructorNames[pos];
+ } else if (pos < constructorNames.length && constructorNames[pos] != null
+ && constructorNames[pos].length() != 0 && !name.equals(constructorNames[pos])) {
+ String paramNum = String.valueOf(pos + 1);
+ throw new InvalidConstructorException("Name specified by @Constructor does not match reference name",
+ paramNum);
+ }
+ if (type.getReferences().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+ reference.setName(name);
+ boolean required = refAnnotation.required();
+ //reference.setRequired(required);
+ try {
+ Class<?> rawType = param;
+ if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ } else {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ }
+ Class<?> baseType = getBaseType(rawType, genericParam);
+ ServiceContract<?> contract = registry.introspect(baseType, false);
+ reference.setServiceContract(contract);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getReferences().put(name, reference);
+ addName(explicitNames, pos, name);
+ }
+
+ /**
+ * Processes resource metadata for a constructor parameter
+ *
+ * @param resourceAnnot the resource annotation
+ * @param constructorNames the parameter names as specified in an {@link org.osoa.sca.annotations.Constructor}
+ * annotation
+ * @param pos the position of the parameter in the constructor's parameter list
+ * @param type the component type associated with the implementation being processed
+ * @param param the parameter type
+ * @param explicitNames the collection of injection names to update
+ * @throws ProcessingException
+ */
+ private <T> void processResource(
+ Resource resourceAnnot,
+ String[] constructorNames,
+ int pos,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ Class<T> param,
+ List<String> explicitNames) throws ProcessingException {
+
+ org.apache.tuscany.spi.implementation.java.Resource resource =
+ new org.apache.tuscany.spi.implementation.java.Resource();
+ String name = resourceAnnot.name();
+ if (name == null || name.length() == 0) {
+ if (constructorNames.length < pos + 1 || constructorNames[pos] == null
+ || constructorNames[pos].length() == 0) {
+ String paramNum = String.valueOf(pos + 1);
+ throw new InvalidResourceException("No name specified for resource parameter", paramNum);
+ }
+ name = constructorNames[pos];
+ } else if (pos < constructorNames.length && constructorNames[pos] != null
+ && constructorNames[pos].length() != 0 && !name.equals(constructorNames[pos])) {
+ String paramNum = String.valueOf(pos + 1);
+ throw new InvalidConstructorException("Name specified by @Constructor does not match resource name",
+ paramNum);
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+ resource.setName(name);
+ resource.setOptional(resourceAnnot.optional());
+ resource.setType(param);
+ String mappedName = resourceAnnot.mappedName();
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.add(resource);
+ addName(explicitNames, pos, name);
+ }
+
+ protected static Class<?> getBaseType(Class<?> cls, Type genericType) {
+ if (cls.isArray()) {
+ return cls.getComponentType();
+ } else if (Collection.class.isAssignableFrom(cls)) {
+ if (genericType == cls) {
+ return Object.class;
+ } else {
+ ParameterizedType parameterizedType = (ParameterizedType) genericType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof Class) {
+ return (Class<?>) baseType;
+ } else if (baseType instanceof ParameterizedType) {
+ return (Class<?>) ((ParameterizedType) baseType).getRawType();
+ } else {
+ return null;
+ }
+ }
+ } else {
+ return cls;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InitProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InitProcessor.java
new file mode 100644
index 0000000000..be5ac78008
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InitProcessor.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.implementation.processor;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Processes the {@link @Init} annotation on a component implementation and updates the component type with the
+ * decorated initializer method
+ *
+ * @version $Rev$ $Date$
+ */
+public class InitProcessor extends ImplementationProcessorExtension {
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ Init annotation = method.getAnnotation(Init.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalInitException("Initializer must not have argments", method.toString());
+ }
+ if (type.getInitMethod() != null) {
+ throw new DuplicateInitException("More than one initializer found on implementaton");
+ }
+ if (Modifier.isProtected(method.getModifiers())) {
+ method.setAccessible(true);
+ }
+ type.setInitMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidAutowireException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidAutowireException.java
new file mode 100644
index 0000000000..92a2a0923d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidAutowireException.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.core.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an invalid usage of {@link org.apache.tuscany.spi.annotation.Autowire}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidAutowireException extends ProcessingException {
+
+ public InvalidAutowireException(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/implementation/processor/InvalidConstructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConstructorException.java
new file mode 100644
index 0000000000..a2dd3f09c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConstructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an invalid constructor definition, e.g. when the number of injection names specified in {@link
+ * org.osoa.sca.annotations.Constructor} do not match the number of actual constructor parameters
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConstructorException extends ProcessingException {
+
+ public InvalidConstructorException(String message) {
+ super(message);
+ }
+
+ public InvalidConstructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConversationalImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConversationalImplementation.java
new file mode 100644
index 0000000000..28bd65200e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidConversationalImplementation.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Raised when an implementation specifies improper conversational metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationalImplementation extends ProcessingException {
+
+ public InvalidConversationalImplementation(String message) {
+ super(message);
+ }
+
+ public InvalidConversationalImplementation(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvalidConversationalImplementation(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidConversationalImplementation(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidPropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidPropertyException.java
new file mode 100644
index 0000000000..5d4c245764
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidPropertyException.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.core.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Property}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidPropertyException extends ProcessingException {
+
+ public InvalidPropertyException(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/implementation/processor/InvalidReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidReferenceException.java
new file mode 100644
index 0000000000..8fbc07aa1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidReferenceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidReferenceException extends ProcessingException {
+
+ public InvalidReferenceException(String message) {
+ super(message);
+ }
+
+ public InvalidReferenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidReferenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidResourceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidResourceException.java
new file mode 100644
index 0000000000..4ed6d93994
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidResourceException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Denotes an invalid usage of {@link @org.apache.tuscany.api.annotation.Resource}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourceException extends ProcessingException {
+
+ public InvalidResourceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidServiceType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidServiceType.java
new file mode 100644
index 0000000000..f3d0367661
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/InvalidServiceType.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.core.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when a service type specified by an {@link org.osoa.sca.annotations.Service} annotation is invalid, e.g. it is
+ * not an interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidServiceType extends ProcessingException {
+
+ public InvalidServiceType(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/MonitorProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/MonitorProcessor.java
new file mode 100644
index 0000000000..e7acce2973
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/MonitorProcessor.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.implementation.processor;
+
+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.implementation.java.AbstractPropertyProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+
+import org.apache.tuscany.api.annotation.Monitor;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.host.MonitorFactory;
+
+/**
+ * Processes an {@link @Monitor} annotation, updating the component type with corresponding {@link
+ * org.apache.tuscany.spi.implementation.java.JavaMappedProperty}
+ *
+ * @version $Rev$ $Date$
+ */
+public class MonitorProcessor extends AbstractPropertyProcessor<Monitor> {
+ private MonitorFactory monitorFactory;
+
+ public MonitorProcessor(@Autowire MonitorFactory monitorFactory, @Autowire ImplementationProcessorService service) {
+ super(Monitor.class, service);
+ this.monitorFactory = monitorFactory;
+ }
+
+ protected String getName(Monitor annotation) {
+ return null;
+ }
+
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ Monitor annotation,
+ CompositeComponent parent,
+ DeploymentContext context) {
+ Class<T> javaType = property.getJavaType();
+ property.setDefaultValueFactory(new SingletonObjectFactory<T>(monitorFactory.getMonitor(javaType)));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/NoConstructorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/NoConstructorException.java
new file mode 100644
index 0000000000..f36b7900a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/NoConstructorException.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when a suitable constructor for a component implementation cannot be found
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoConstructorException extends ProcessingException {
+
+ public NoConstructorException() {
+ }
+
+ public NoConstructorException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/PropertyProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/PropertyProcessor.java
new file mode 100644
index 0000000000..000422ee6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/PropertyProcessor.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.core.implementation.processor;
+
+import java.lang.reflect.Constructor;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.implementation.java.AbstractPropertyProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Processes an {@link @Property} annotation, updating the component type with
+ * corresponding {@link JavaMappedProperty}
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyProcessor extends AbstractPropertyProcessor<Property> {
+ private SimpleTypeMapperExtension typeMapper = new SimpleTypeMapperExtension();
+
+ public PropertyProcessor(@Autowire
+ ImplementationProcessorService service) {
+ super(Property.class, service);
+ }
+
+ protected String getName(Property annotation) {
+ return annotation.name();
+ }
+
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ Property annotation,
+ CompositeComponent parent,
+ DeploymentContext context) {
+ String xmlType = annotation.xmlType();
+ if (xmlType != null && xmlType.length() != 0) {
+ property.setXmlType(QName.valueOf(annotation.xmlType()));
+ } else {
+ TypeInfo type = typeMapper.getXMLType(property.getJavaType());
+ if (type != null) {
+ property.setXmlType(type.getQName());
+ }
+ }
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent,
+ Constructor<T> constructor,
+ PojoComponentType<JavaMappedService, JavaMappedReference,
+ JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ // override since heuristic pojo processor evalautes properties
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java
new file mode 100644
index 0000000000..12aba4c94e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessor.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Reference;
+
+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.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.toPropertyName;
+
+/**
+ * Processes an {@link @Reference} annotation, updating the component type with corresponding {@link
+ * org.apache.tuscany.spi.implementation.java.JavaMappedReference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProcessor extends ImplementationProcessorExtension {
+
+ private JavaInterfaceProcessorRegistry regsitry;
+
+ public ReferenceProcessor(@Autowire
+ JavaInterfaceProcessorRegistry registry) {
+ this.regsitry = registry;
+ }
+
+ public void visitMethod(CompositeComponent parent,
+ Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ Reference annotation = method.getAnnotation(Reference.class);
+ Autowire autowire = method.getAnnotation(Autowire.class);
+ boolean isAutowire = autowire != null;
+ if (annotation == null && !isAutowire) {
+ return; // Not a reference or autowire annotation.
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalReferenceException("Setter must have one parameter", method.toString());
+ }
+ // process autowire required first let reference override. or if
+ // conflicting should this fault?
+ boolean required = false;
+ if (isAutowire) {
+ required = autowire.required();
+ }
+
+ String name = null;
+
+ if (annotation != null) {
+ if (annotation.name() != null && annotation.name().length() > 0) {
+ name = annotation.name();
+ }
+ required = annotation.required();
+ }
+ if (name == null) {
+ name = toPropertyName(method.getName());
+ }
+ if (type.getReferences().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setMember(method);
+ reference.setAutowire(isAutowire);
+ //reference.setRequired(required);
+ reference.setName(name);
+ ServiceContract contract;
+ try {
+ Class<?> rawType = method.getParameterTypes()[0];
+ if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ } else {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ }
+ Class<?> baseType = getBaseType(rawType, method.getGenericParameterTypes()[0]);
+ contract = regsitry.introspect(baseType);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ reference.setServiceContract(contract);
+ type.getReferences().put(name, reference);
+ }
+
+ public void visitField(CompositeComponent parent,
+ Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ Reference annotation = field.getAnnotation(Reference.class);
+ boolean autowire = field.getAnnotation(Autowire.class) != null;
+ if (annotation == null && !autowire) {
+ return;
+ }
+ String name = field.getName();
+ boolean required = false;
+ if (annotation != null) {
+ if (annotation.name() != null) {
+ name = annotation.name();
+ }
+ required = annotation.required();
+ }
+ if (name.length() == 0) {
+ name = field.getName();
+ }
+ if (type.getReferences().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setMember(field);
+ //reference.setRequired(required);
+ reference.setAutowire(autowire);
+ reference.setName(name);
+ ServiceContract contract;
+ try {
+ Class<?> rawType = field.getType();
+ if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ } else {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ }
+ Class<?> baseType = getBaseType(rawType, field.getGenericType());
+ contract = regsitry.introspect(baseType);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ reference.setServiceContract(contract);
+ type.getReferences().put(name, reference);
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent,
+ Constructor<T> constructor,
+ PojoComponentType<JavaMappedService,
+ JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.java
new file mode 100644
index 0000000000..29773f5e80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ResourceProcessor.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.core.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.implementation.java.Resource;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.toPropertyName;
+
+/**
+ * Processes an {@link @Resource} annotation, updating the component type with corresponding {@link
+ * org.apache.tuscany.spi.implementation.java.Resource}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessor extends ImplementationProcessorExtension {
+
+ public ResourceProcessor() {
+ }
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ org.apache.tuscany.api.annotation.Resource annotation =
+ method.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalResourceException("Resource setter must have one parameter", method.toString());
+ }
+ String name = annotation.name();
+ if (name.length() < 1) {
+ name = toPropertyName(method.getName());
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = annotation.mappedName();
+ Resource resource = new Resource();
+ resource.setMember(method);
+ resource.setType(method.getParameterTypes()[0]);
+ resource.setOptional(annotation.optional());
+ resource.setName(name);
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.add(resource);
+ }
+
+ public void visitField(CompositeComponent parent, Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ org.apache.tuscany.api.annotation.Resource annotation =
+ field.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if (name.length() < 1) {
+ name = field.getName();
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = annotation.mappedName();
+ Resource resource = new Resource();
+ resource.setMember(field);
+ resource.setType(field.getType());
+ resource.setOptional(annotation.optional());
+ resource.setName(name);
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.add(resource);
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent, Constructor<T> constructor,
+ PojoComponentType<JavaMappedService, JavaMappedReference,
+ JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ScopeProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ScopeProcessor.java
new file mode 100644
index 0000000000..634aff0377
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ScopeProcessor.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.core.implementation.processor;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Processes the {@link Scope} annotation and updates the component type with the corresponding implmentation scope
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessor extends ImplementationProcessorExtension {
+
+ public <T> void visitClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
+ if (annotation == null) {
+ type.setImplementationScope(Scope.STATELESS);
+ return;
+ }
+ String name = annotation.value();
+ Scope scope;
+ if ("COMPOSITE".equals(name)) {
+ scope = Scope.COMPOSITE;
+ } else if ("SESSION".equals(name)) {
+ scope = Scope.SESSION;
+ } else if ("CONVERSATION".equals(name)) {
+ scope = Scope.CONVERSATION;
+ } else if ("REQUEST".equals(name)) {
+ scope = Scope.REQUEST;
+ } else if ("SYSTEM".equals(name)) {
+ scope = Scope.SYSTEM;
+ } else {
+ scope = new Scope(name);
+ }
+ type.setImplementationScope(scope);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceProcessor.java
new file mode 100644
index 0000000000..6f96c92006
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceProcessor.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+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.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllInterfaces;
+import static org.apache.tuscany.core.util.JavaIntrospectionHelper.toPropertyName;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Service} annotation and updates the component type with corresponding
+ * {@link JavaMappedService}s. Also processes related {@link org.osoa.sca.annotations.Callback} annotations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessor extends ImplementationProcessorExtension {
+
+ private ImplementationProcessorService implService;
+
+ public ServiceProcessor(@Autowire ImplementationProcessorService implService) {
+ this.implService = implService;
+ }
+
+ public <T> void visitClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ org.osoa.sca.annotations.Service annotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
+ if (annotation == null) {
+ // scan intefaces for remotable
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ for (Class<?> interfaze : interfaces) {
+ if (interfaze.getAnnotation(Remotable.class) != null) {
+ JavaMappedService service;
+ try {
+ service = implService.createService(interfaze);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getServices().put(service.getName(), service);
+ }
+ }
+ return;
+ }
+ Class<?>[] interfaces = annotation.interfaces();
+ if (interfaces.length == 0) {
+ Class<?> interfaze = annotation.value();
+ if (Void.class.equals(interfaze)) {
+ throw new IllegalServiceDefinitionException("No interfaces specified");
+ } else {
+ interfaces = new Class<?>[1];
+ interfaces[0] = interfaze;
+ }
+ }
+ for (Class<?> interfaze : interfaces) {
+ if (!interfaze.isInterface()) {
+ throw new InvalidServiceType("Service must be an interface", interfaze.getName());
+ }
+ JavaMappedService service;
+ try {
+ service = implService.createService(interfaze);
+ } catch (InvalidServiceContractException e) {
+ throw new ProcessingException(e);
+ }
+ type.getServices().put(service.getName(), service);
+ }
+ }
+
+
+ public void visitMethod(CompositeComponent parent,
+ Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ Callback annotation = method.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalCallbackReferenceException("Setter must have one parameter", method.toString());
+ }
+ String name = toPropertyName(method.getName());
+ JavaMappedService callbackService = null;
+ Class<?> callbackClass = method.getParameterTypes()[0];
+ for (JavaMappedService service : type.getServices().values()) {
+ ServiceContract serviceContract = service.getServiceContract();
+ if (serviceContract.getCallbackClass().equals(callbackClass)) {
+ callbackService = service;
+ }
+ }
+ if (callbackService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
+ }
+ callbackService.setCallbackReferenceName(name);
+ callbackService.setCallbackMember(method);
+ }
+
+ public void visitField(CompositeComponent parent, Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ Callback annotation = field.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = field.getName();
+ JavaMappedService callbacksService = null;
+ Class<?> callbackClass = field.getType();
+ for (JavaMappedService service : type.getServices().values()) {
+ ServiceContract serviceContract = service.getServiceContract();
+ if (serviceContract.getCallbackClass().equals(callbackClass)) {
+ callbacksService = service;
+ }
+ }
+ if (callbacksService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
+ }
+ callbacksService.setCallbackReferenceName(name);
+ callbacksService.setCallbackMember(field);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceTypeNotFoundException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceTypeNotFoundException.java
new file mode 100644
index 0000000000..8a0d4afc3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ServiceTypeNotFoundException.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.core.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+/**
+ * Thrown when a service interface cannot be determined based on a heuristic evaluation of an implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceTypeNotFoundException extends ProcessingException {
+
+ public ServiceTypeNotFoundException(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/implementation/processor/UnknownContextTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/UnknownContextTypeException.java
new file mode 100644
index 0000000000..a7868349a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/UnknownContextTypeException.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.core.implementation.processor;
+
+/**
+ * Thrown when a method or field marked with {@link org.osoa.sca.annotations.Context} takes an unknown type
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnknownContextTypeException extends IllegalContextException {
+
+ public UnknownContextTypeException(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/implementation/system/builder/SystemComponentBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
new file mode 100644
index 0000000000..33cbbe1232
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.system.builder;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+
+/**
+ * Produces system atomic components from a component definition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SystemComponentBuilder extends ComponentBuilderExtension<SystemImplementation> {
+ private ResourceHost host;
+
+ protected Class<SystemImplementation> getImplementationType() {
+ return SystemImplementation.class;
+ }
+
+ @Autowire
+ public void setHost(ResourceHost host) {
+ this.host = host;
+ }
+
+ @SuppressWarnings("unchecked")
+ public AtomicComponent build(CompositeComponent parent,
+ ComponentDefinition<SystemImplementation> definition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+ PojoComponentType<ServiceDefinition, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ definition.getImplementation().getComponentType();
+
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setParent(parent);
+ if (definition.getInitLevel() != null) {
+ configuration.setInitLevel(definition.getInitLevel());
+ } else {
+ configuration.setInitLevel(componentType.getInitLevel());
+ }
+ Method initMethod = componentType.getInitMethod();
+ if (initMethod != null) {
+ configuration.setInitInvoker(new MethodEventInvoker<Object>(initMethod));
+ }
+ Method destroyMethod = componentType.getDestroyMethod();
+ if (destroyMethod != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker<Object>(destroyMethod));
+ }
+ // setup property injection sites
+ for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
+ configuration.addPropertySite(property.getName(), property.getMember());
+ }
+ // setup reference injection sites
+ for (JavaMappedReference reference : componentType.getReferences().values()) {
+ Member member = reference.getMember();
+ if (member != null) {
+ // could be null if the reference is mapped to a constructor
+ configuration.addReferenceSite(reference.getName(), member);
+ }
+ }
+
+ for (Resource resource : componentType.getResources().values()) {
+ Member member = resource.getMember();
+ if (member != null) {
+ // could be null if the resource is mapped to a constructor
+ configuration.addResourceSite(resource.getName(), member);
+ }
+ }
+
+ // setup constructor injection
+ ConstructorDefinition<?> ctorDef = componentType.getConstructorDefinition();
+ Constructor<?> constr = ctorDef.getConstructor();
+ PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
+ configuration.setInstanceFactory(instanceFactory);
+ configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
+ for (Class<?> clazz : constr.getParameterTypes()) {
+ configuration.addConstructorParamType(clazz);
+ }
+ configuration.setName(definition.getName());
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ // handle properties
+ Map<String, PropertyValue<?>> propertyValues = definition.getPropertyValues();
+ processProperties(propertyValues, componentType.getProperties().values(), component);
+
+ // handle resources
+ for (Resource resource : componentType.getResources().values()) {
+ String name = resource.getName();
+ boolean optional = resource.isOptional();
+ Class<Object> type = (Class<Object>) resource.getType();
+ ResourceObjectFactory<Object> factory;
+ String mappedName = resource.getMappedName();
+ if (mappedName == null) {
+ // by type
+ factory = new ResourceObjectFactory<Object>(type, optional, parent, host);
+ } else {
+ factory = new ResourceObjectFactory<Object>(type, mappedName, optional, parent, host);
+ }
+ component.addResourceFactory(name, factory);
+
+ }
+ return component;
+ }
+
+// private void processReferences(ComponentDefinition<SystemImplementation> definition,
+// Map<String, JavaMappedReference> references,
+// CompositeComponent parent,
+// SystemAtomicComponentImpl component) {
+// // no proxies needed for system components
+// for (ReferenceTarget target : definition.getReferenceTargets().values()) {
+// String referenceName = target.getReferenceName();
+// JavaMappedReference referenceDefiniton = references.get(referenceName);
+// Class interfaze = referenceDefiniton.getServiceContract().getInterfaceClass();
+// OutboundWire wire;
+// if (referenceDefiniton.isAutowire()) {
+// boolean required = referenceDefiniton.isRequired();
+// wire = new SystemOutboundAutowire(referenceName, interfaze, parent, required);
+// } else {
+// //FIXME support multiplicity!
+// assert target.getTargets().size() == 1 : "Multiplicity not yet implemented";
+// QualifiedName targetName = new QualifiedName(target.getTargets().get(0).getPath());
+// wire = new SystemOutboundWireImpl(referenceName, targetName, interfaze);
+// }
+// component.addOutboundWire(wire);
+// }
+// }
+
+ private void processProperties(Map<String, PropertyValue<?>> propertyValues,
+ Collection<JavaMappedProperty<?>> properties,
+ SystemAtomicComponentImpl component) {
+ for (JavaMappedProperty<?> property : properties) {
+ PropertyValue value = propertyValues.get(property.getName());
+ ObjectFactory<?> factory;
+ if (value != null) {
+ factory = value.getValueFactory();
+ } else {
+ factory = property.getDefaultValueFactory();
+ }
+ if (factory != null) {
+ component.addPropertyFactory(property.getName(), factory);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java
new file mode 100644
index 0000000000..c43b0d1ee9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.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.implementation.system.component;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+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.core.implementation.PojoAtomicComponent;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.wire.OptimizedWireObjectFactory;
+
+/**
+ * Default implementation of a system atomic context
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SystemAtomicComponentImpl extends PojoAtomicComponent {
+
+ public SystemAtomicComponentImpl(PojoConfiguration configuration) {
+ super(configuration);
+ scope = Scope.COMPOSITE;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return null;
+ }
+
+ public boolean isSystem() {
+ return true;
+ }
+
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
+ return new OptimizedWireObjectFactory(wire);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoader.java
new file mode 100644
index 0000000000..2c7141044b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoader.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.implementation.system.loader;
+
+import java.net.URL;
+
+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.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Scope;
+
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+
+/**
+ * Loads a system component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemComponentTypeLoader extends ComponentTypeLoaderExtension<SystemImplementation> {
+ private Introspector introspector;
+
+ public SystemComponentTypeLoader() {
+ }
+
+ public SystemComponentTypeLoader(Introspector introspector) {
+ this.introspector = introspector;
+ }
+
+ public SystemComponentTypeLoader(LoaderRegistry loaderRegistry, Introspector introspector) {
+ super(loaderRegistry);
+ this.introspector = introspector;
+ }
+
+ //FIXME autowire to support multiple interfaces
+ @Autowire
+ public void setIntrospector(IntrospectionRegistry introspector) {
+ this.introspector = introspector;
+ }
+
+ public void load(CompositeComponent parent,
+ SystemImplementation implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+ Class<?> implClass = implementation.getImplementationClass();
+ URL sidefile = implClass.getResource(JavaIntrospectionHelper.getBaseName(implClass) + ".componentType");
+ PojoComponentType componentType;
+ if (sidefile == null) {
+ componentType = loadByIntrospection(parent, implementation, deploymentContext);
+ } else {
+ componentType = loadFromSidefile(sidefile, deploymentContext);
+ }
+ // this means system components are always composite scoped
+ componentType.setImplementationScope(Scope.COMPOSITE);
+ implementation.setComponentType(componentType);
+ }
+
+ protected Class<SystemImplementation> getImplementationClass() {
+ return SystemImplementation.class;
+ }
+
+ protected PojoComponentType loadByIntrospection(CompositeComponent parent,
+ SystemImplementation implementation,
+ DeploymentContext deploymentContext) throws ProcessingException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> componentType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Class<?> implClass = implementation.getImplementationClass();
+ introspector.introspect(parent, implClass, componentType, deploymentContext);
+ return componentType;
+ }
+
+
+ protected PojoComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) throws LoaderException {
+ return loaderRegistry.load(null, null, url, PojoComponentType.class, deploymentContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemCompositeComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemCompositeComponentTypeLoader.java
new file mode 100644
index 0000000000..0e05041ea5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemCompositeComponentTypeLoader.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.implementation.system.loader;
+
+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.LoaderRegistry;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+
+import org.apache.tuscany.core.deployer.ChildDeploymentContext;
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+
+/**
+ * Loads a system composite component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemCompositeComponentTypeLoader extends ComponentTypeLoaderExtension<SystemCompositeImplementation> {
+ public SystemCompositeComponentTypeLoader() {
+ }
+
+ public SystemCompositeComponentTypeLoader(LoaderRegistry loaderRegistry) {
+ super(loaderRegistry);
+ }
+
+ protected Class<SystemCompositeImplementation> getImplementationClass() {
+ return SystemCompositeImplementation.class;
+ }
+
+ public void load(CompositeComponent parent, SystemCompositeImplementation implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ URL scdlLocation = implementation.getScdlLocation();
+ if (scdlLocation == null) {
+ throw new LoaderException("SCDL location not found");
+ }
+ ClassLoader cl = implementation.getClassLoader();
+ deploymentContext = new ChildDeploymentContext(deploymentContext, cl, scdlLocation);
+ CompositeComponentType componentType = loadFromSidefile(parent, scdlLocation, deploymentContext);
+ implementation.setComponentType(componentType);
+ }
+
+
+ protected CompositeComponentType loadFromSidefile(CompositeComponent parent,
+ URL url,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ return loaderRegistry.load(parent, null, url, CompositeComponentType.class, deploymentContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoader.java
new file mode 100644
index 0000000000..d5d4269880
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoader.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.implementation.system.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+
+/**
+ * Loads information for a system implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemImplementationLoader extends LoaderExtension<SystemImplementation> {
+ public static final QName SYSTEM_IMPLEMENTATION =
+ new QName("http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT", "implementation.system");
+
+ public SystemImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public SystemImplementation load(CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+ assert SYSTEM_IMPLEMENTATION.equals(reader.getName());
+ SystemImplementation implementation = new SystemImplementation();
+ String implClass = reader.getAttributeValue(null, "class");
+ Class<?> implementationClass = LoaderUtil.loadClass(implClass, deploymentContext.getClassLoader());
+ implementation.setImplementationClass(implementationClass);
+ registry.loadComponentType(parent, implementation, deploymentContext);
+ while (true) {
+ int code = reader.next();
+ if (code == XMLStreamConstants.START_ELEMENT) {
+ throw new UnrecognizedElementException(reader.getName());
+ } else if (code == XMLStreamConstants.END_ELEMENT) {
+ return implementation;
+ }
+ }
+ }
+
+ public QName getXMLType() {
+ return SYSTEM_IMPLEMENTATION;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.java
new file mode 100644
index 0000000000..e634609c5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemCompositeImplementation.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.implementation.system.model;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Represents a system composite type
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemCompositeImplementation extends Implementation<CompositeComponentType> {
+ private URL scdlLocation;
+ private ClassLoader classLoader;
+
+ public SystemCompositeImplementation() {
+ }
+
+ public SystemCompositeImplementation(CompositeComponentType componentType) {
+ super(componentType);
+ }
+
+ public URL getScdlLocation() {
+ return scdlLocation;
+ }
+
+ public void setScdlLocation(URL scdlLocation) {
+ this.scdlLocation = scdlLocation;
+ }
+
+ 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/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java
new file mode 100644
index 0000000000..ce48ed3fe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.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.core.implementation.system.model;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+
+/**
+ * Represents the system composite implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemImplementation extends AtomicImplementation<PojoComponentType> {
+ private Class<?> implementationClass;
+
+ public SystemImplementation(PojoComponentType componentType, Class<?> implementationClass) {
+ super(componentType);
+ this.implementationClass = implementationClass;
+ }
+
+ public SystemImplementation() {
+ }
+
+ public SystemImplementation(Class<?> implementationClass) {
+ this.implementationClass = implementationClass;
+ }
+
+ public Class<?> getImplementationClass() {
+ return implementationClass;
+ }
+
+ public void setImplementationClass(Class<?> implementationClass) {
+ this.implementationClass = implementationClass;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ArrayMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ArrayMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..1a441dcf87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ArrayMultiplicityObjectFactory.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.injection;
+
+import java.lang.reflect.Array;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>Array</code>
+ * containing object instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArrayMultiplicityObjectFactory implements ObjectFactory<Object> {
+
+ private ObjectFactory[] factories;
+
+ private Class interfaceType;
+
+ public ArrayMultiplicityObjectFactory(Class interfaceType, List<ObjectFactory<?>> factories) {
+ assert interfaceType != null : "Interface type was null";
+ assert factories != null : "Object factories were null";
+ this.interfaceType = interfaceType;
+ this.factories = factories.toArray(new ObjectFactory[factories.size()]);
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ Object array = Array.newInstance(interfaceType, factories.length);
+ for (int i = 0; i < factories.length; i++) {
+ Array.set(array, i, factories[i].getInstance());
+ }
+ return array;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java
new file mode 100644
index 0000000000..fc389a23cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.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.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactory implements ObjectFactory {
+
+ private WireService wireService;
+ private Class<?> interfaze;
+ private InboundWire wire;
+
+ public CallbackWireObjectFactory(Class<?> interfaze, WireService wireService, InboundWire wire) {
+ this.interfaze = interfaze;
+ this.wireService = wireService;
+ this.wire = wire;
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ return wireService.createCallbackProxy(interfaze, wire);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java
new file mode 100644
index 0000000000..e44c8124d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.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.core.injection;
+
+import org.apache.tuscany.core.launcher.CompositeContextImpl;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.WireService;
+import org.osoa.sca.CompositeContext;
+
+/**
+ * Creates instances of {@link org.apache.tuscany.core.implementation.composite.ManagedCompositeContext} for injection
+ * on component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeContextObjectFactory implements ObjectFactory<CompositeContext> {
+ private CompositeComponent composite;
+ private WireService wireService;
+
+ public CompositeContextObjectFactory(CompositeComponent composite, WireService wireService) {
+ assert composite != null;
+ assert wireService != null;
+ this.composite = composite;
+ this.wireService = wireService;
+ }
+
+ public CompositeContext getInstance() throws ObjectCreationException {
+ return new CompositeContextImpl(composite, wireService);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ContextInjector.java
new file mode 100644
index 0000000000..a422500f3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ContextInjector.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.core.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+
+/**
+ * Implementations inject a pre-configured context type (interface) on an instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContextInjector<S, T> extends Injector<T> {
+
+ void setContext(S context) throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.java
new file mode 100644
index 0000000000..8dbc0a3a83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ConversationIDObjectFactory.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.injection;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+public class ConversationIDObjectFactory implements ObjectFactory<String> {
+
+ private WorkContext workContext;
+
+ public ConversationIDObjectFactory(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ public String getInstance() {
+ return (String)workContext.getIdentifier(Scope.CONVERSATION);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java
new file mode 100644
index 0000000000..af2382b36a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.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.core.injection;
+
+/**
+ * Performs an invocation on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EventInvoker<T> {
+
+ /**
+ * Performs the invocation on a given instance
+ *
+ * @throws ObjectCallbackException
+ */
+ void invokeEvent(T instance) throws ObjectCallbackException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java
new file mode 100644
index 0000000000..e9f8f42aa1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.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.injection;
+
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.spi.ObjectFactory} on a given field
+ *
+ * @version $Rev$ $Date$
+ */
+public class FieldInjector<T> implements Injector<T> {
+
+ private final Field field;
+
+ private final ObjectFactory<?> objectFactory;
+
+ /**
+ * Create an injector and have it use the given <code>ObjectFactory</code> to inject a value on the instance using
+ * the reflected <code>Field</code>
+ */
+ public FieldInjector(Field field, ObjectFactory<?> objectFactory) {
+ this.field = field;
+ this.field.setAccessible(true);
+ this.objectFactory = objectFactory;
+ }
+
+ /**
+ * Inject a new value on the given isntance
+ */
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ field.set(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Field is not accessible [" + field + "]");
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java
new file mode 100644
index 0000000000..c5f037d931
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.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.injection;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InjectionRuntimeException extends TuscanyRuntimeException {
+
+ public InjectionRuntimeException() {
+ super();
+ }
+
+ public InjectionRuntimeException(String message) {
+ super(message);
+ }
+
+
+ protected InjectionRuntimeException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InjectionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InjectionRuntimeException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public InjectionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/Injector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/Injector.java
new file mode 100644
index 0000000000..c2125d8212
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/Injector.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.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+
+/**
+ * Implementations inject a pre-configured value on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Injector<T> {
+
+ /**
+ * Inject a value on the given instance
+ */
+ void inject(T instance) throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.java
new file mode 100644
index 0000000000..2e7ff0e754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidAccessorException.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.core.injection;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class InvalidAccessorException extends InjectionRuntimeException {
+
+ public InvalidAccessorException(String message) {
+ super(message);
+ }
+
+ public InvalidAccessorException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidResourceTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidResourceTypeException.java
new file mode 100644
index 0000000000..1a3eaf4d1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/InvalidResourceTypeException.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.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+
+/**
+ * Denotes an invalid resource type, i.e. that is not a component
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourceTypeException extends ObjectCreationException {
+
+ public InvalidResourceTypeException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIListObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIListObjectFactory.java
new file mode 100644
index 0000000000..bf2a7a103e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIListObjectFactory.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.injection;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * An implementation of ObjectFactory that creates instances by looking them up in a JNDI context.
+ *
+ * @version $Rev: 430937 $ $Date: 2006-08-12 06:47:56 +0530 (Sat, 12 Aug 2006) $
+ */
+public class JNDIListObjectFactory<T> implements ObjectFactory<List<T>> {
+ private final Context context;
+ private List<String> nameList;
+
+ public JNDIListObjectFactory(Context context, List<String> name) {
+ this.context = context;
+ this.nameList = Collections.unmodifiableList(name);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public List<T> getInstance() throws ObjectCreationException {
+ try {
+ List<T> instanceList = new ArrayList<T>();
+ for (int count = 0 ; count < instanceList.size() ; ++count) {
+ instanceList.add((T) context.lookup(nameList.get(count)));
+ }
+ return instanceList;
+ } catch (NamingException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java
new file mode 100644
index 0000000000..0189d8245b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.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.injection;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * An implementation of ObjectFactory that creates instances by looking them up in a JNDI context.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JNDIObjectFactory<T> implements ObjectFactory<T> {
+ private final Context context;
+ private final String name;
+
+ public JNDIObjectFactory(Context context, String name) {
+ this.context = context;
+ this.name = name;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public T getInstance() throws ObjectCreationException {
+ try {
+ return (T) context.lookup(name);
+ } catch (NamingException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ListMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ListMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..b261bcda53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ListMultiplicityObjectFactory.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.injection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>List</code>
+ * containing object instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class ListMultiplicityObjectFactory implements ObjectFactory<List> {
+
+ private ObjectFactory[] factories;
+
+ public ListMultiplicityObjectFactory(List<ObjectFactory<?>> factories) {
+ assert factories != null : "Object factories were null";
+ this.factories = factories.toArray(new ObjectFactory[factories.size()]);
+ }
+
+ public List getInstance() throws ObjectCreationException {
+ List<Object> list = new ArrayList<Object>();
+ for (ObjectFactory factory : factories) {
+ list.add(factory.getInstance());
+ }
+ return list;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java
new file mode 100644
index 0000000000..e43a1e1fa6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.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.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Performs an wire on a method of a given instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class MethodEventInvoker<T> implements EventInvoker<T> {
+ private final Method method;
+
+ /**
+ * Intantiates an invoker for the given method
+ */
+ public MethodEventInvoker(Method method) {
+ assert method != null;
+ this.method = method;
+ }
+
+ public void invokeEvent(T instance) throws ObjectCallbackException {
+ try {
+ method.invoke(instance, (Object[]) null);
+ } catch (IllegalArgumentException e) {
+ String name = method.getName();
+ throw new ObjectCallbackException("Exception thrown by callback method [" + name + "]", e.getCause());
+ } catch (IllegalAccessException e) {
+ String name = method.getName();
+ throw new AssertionError("Method is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = method.getName();
+ throw new ObjectCallbackException("Exception thrown by callback method [" + name + "]", e.getCause());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java
new file mode 100644
index 0000000000..258f0817dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.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.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.spi.ObjectFactory} using a given method
+ *
+ * @version $Rev$ $Date$
+ */
+public class MethodInjector<T> implements Injector<T> {
+ private final Method method;
+ private final ObjectFactory<?> objectFactory;
+
+ public MethodInjector(Method method, ObjectFactory<?> objectFactory) {
+ assert method != null;
+ assert objectFactory != null;
+ this.method = method;
+ this.method.setAccessible(true);
+ this.objectFactory = objectFactory;
+ }
+
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ method.invoke(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Method is not accessible [" + method + "]");
+ } catch (IllegalArgumentException e) {
+ throw new ObjectCreationException("Exception thrown by setter", method.getName(), e);
+ } catch (InvocationTargetException e) {
+ throw new ObjectCreationException("Exception thrown by setter", method.getName(), e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.java
new file mode 100644
index 0000000000..b3109074e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoAccessorException.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.injection;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class NoAccessorException extends InjectionRuntimeException {
+ public NoAccessorException() {
+ }
+
+ public NoAccessorException(String message) {
+ super(message);
+ }
+
+ public NoAccessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoAccessorException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.java
new file mode 100644
index 0000000000..a86451525b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/NoMultiplicityTypeException.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 org.apache.tuscany.core.injection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NoMultiplicityTypeException extends InjectionRuntimeException {
+
+ public NoMultiplicityTypeException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java
new file mode 100644
index 0000000000..ff830aab4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.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.core.injection;
+
+/**
+ * Denotes an error when invoking on an object
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCallbackException extends InjectionRuntimeException {
+
+ public ObjectCallbackException() {
+ super();
+ }
+
+ public ObjectCallbackException(String message) {
+ super(message);
+ }
+
+ public ObjectCallbackException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ObjectCallbackException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCallbackException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java
new file mode 100644
index 0000000000..cf446a35fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.injection;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Creates new instances of a Java class
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.core.injection.Injector
+ */
+public class PojoObjectFactory<T> implements ObjectFactory<T> {
+
+ private final Constructor<T> ctr;
+ private ObjectFactory[] initializerFactories;
+
+ /**
+ * Creates the object factory
+ *
+ * @param ctr the constructor to use when instantiating a new object
+ */
+ public PojoObjectFactory(Constructor<T> ctr) {
+ assert ctr != null;
+ this.ctr = ctr;
+ initializerFactories = new ObjectFactory[ctr.getParameterTypes().length];
+ }
+
+ /**
+ * Creates the object factory
+ *
+ * @param ctr the constructor to use when instantiating a new object
+ * @param factories an ordered list of <code>ObjectFactory</code>s to use for returning constructor parameters
+ */
+ public PojoObjectFactory(Constructor<T> ctr, List<ObjectFactory> factories) {
+ assert ctr != null;
+ int params = ctr.getParameterTypes().length;
+ assert params == factories.size();
+ this.ctr = ctr;
+ initializerFactories = new ObjectFactory[params];
+ int i = 0;
+ for (ObjectFactory factory : factories) {
+ initializerFactories[i] = factory;
+ i++;
+ }
+ }
+
+ /**
+ * Returns the ordered array of <code>ObjectFactory</code>s use in creating constructor parameters
+ */
+ public ObjectFactory[] getInitializerFactories() {
+ return initializerFactories;
+ }
+
+ /**
+ * Sets an <code>ObjectFactory</code>s to use in creating constructor parameter
+ *
+ * @param pos the constructor parameter position
+ * @param factory the object factory
+ */
+ public void setInitializerFactory(int pos, ObjectFactory factory) {
+ assert pos < initializerFactories.length;
+ initializerFactories[pos] = factory;
+ }
+
+ /**
+ * Creates a new instance of an object
+ */
+ public T getInstance() throws ObjectCreationException {
+ int size = initializerFactories.length;
+ Object[] initargs = new Object[size];
+ // create the constructor arg array
+ for (int i = 0; i < size; i++) {
+ ObjectFactory<?> objectFactory = initializerFactories[i];
+ if (objectFactory == null) {
+ // [rfeng] Set it to null for property with default values
+ initargs[i] = null;
+ // String name = ctr.getName();
+ // throw new ObjectCallbackException("Null object factory for
+ // constructor parameter [" + i + "]", name);
+ } else {
+ initargs[i] = objectFactory.getInstance();
+ }
+ }
+ try {
+ ctr.setAccessible(true);
+ return ctr.newInstance(initargs);
+ } catch (IllegalArgumentException e) {
+ String name = ctr.getName();
+ throw new ObjectCreationException("Exception thrown by constructor", name, e);
+ } catch (InstantiationException e) {
+ String name = ctr.getDeclaringClass().getName();
+ throw new AssertionError("Class is not instantiable [" + name + "]");
+ } catch (IllegalAccessException e) {
+ String name = ctr.getName();
+ throw new AssertionError("Constructor is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = ctr.getName();
+ throw new ObjectCreationException("Exception thrown by constructor", name, e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java
new file mode 100644
index 0000000000..9a9d97a273
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/RequestContextObjectFactory.java
@@ -0,0 +1,26 @@
+package org.apache.tuscany.core.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import org.apache.tuscany.core.implementation.composite.ManagedRequestContext;
+
+/**
+ * Creates instances of {@link org.apache.tuscany.core.implementation.composite.ManagedRequestContext} for injection on
+ * component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactory implements ObjectFactory<ManagedRequestContext> {
+ private WorkContext workContext;
+
+ public RequestContextObjectFactory(WorkContext workContext) {
+ assert workContext != null;
+ this.workContext = workContext;
+ }
+
+ public ManagedRequestContext getInstance() throws ObjectCreationException {
+ return new ManagedRequestContext(workContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceNotFoundException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceNotFoundException.java
new file mode 100644
index 0000000000..ed3ac20631
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceNotFoundException.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.core.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+
+/**
+ * Denotes an exception thrown when a runtime resource is not found
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceNotFoundException extends ObjectCreationException {
+
+ public ResourceNotFoundException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceObjectFactory.java
new file mode 100644
index 0000000000..45df502256
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/ResourceObjectFactory.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.injection;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.host.ResourceResolutionException;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+/**
+ * Resolves a runtime resource to be injected on a field or method of a Java component type marked with {@link
+ * org.apache.tuscany.api.annotation.Resource}. If the mapped name of the resource is an absolute URI such as
+ * <code>sca://localhost</code> or <code>jndi://localhost</code> the host container namespace is searched; otherwise the
+ * URI is assumed to be relative and the parent composite is searched. If a mapped name is not provided, i.e. resolution
+ * is by type, the parent composite is first searched followed by the host namespace.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceObjectFactory<T> implements ObjectFactory<T> {
+
+ private Class<T> type;
+ private String mappedName;
+ private CompositeComponent parent;
+ private ResourceHost host;
+ private boolean resolveFromHost;
+ private boolean optional;
+
+ /**
+ * Instantiates a factory that resolves resources by type
+ *
+ * @param type the type of the resource to inject
+ * @param optional true if an error should be thrown if the resource is not found
+ * @param parent the parent composite of the component to inject on
+ * @param host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type,
+ boolean optional,
+ CompositeComponent parent,
+ ResourceHost host) {
+ this.type = type;
+ this.parent = parent;
+ this.host = host;
+ this.optional = optional;
+ }
+
+ /**
+ * Instantiates a factory that resolves resources by mapped name
+ *
+ * @param type the type of the resource to inject
+ * @param mappedName the resource name
+ * @param optional true if an error should be thrown if the resource is not found
+ * @param parent the parent composite of the component to inject on
+ * @param host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type,
+ String mappedName,
+ boolean optional,
+ CompositeComponent parent,
+ ResourceHost host) {
+ this.type = type;
+ this.parent = parent;
+ this.host = host;
+ if (mappedName.indexOf("://") >= 0) {
+ this.resolveFromHost = true;
+ }
+ this.mappedName = mappedName;
+ this.optional = optional;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public T getInstance() throws ObjectCreationException {
+ if (resolveFromHost) {
+ return resolveInstance();
+ } else {
+ T instance = null;
+ if (mappedName == null) {
+ try {
+ InboundWire wire = parent.resolveSystemAutowire(type);
+ if (wire != null) {
+ instance = (T) wire.getTargetService();
+ }
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ if (instance == null) {
+ // if not found in parent scope, search the host namespace
+ resolveFromHost = true;
+ instance = resolveInstance();
+ }
+ if (instance == null && !optional) {
+ throw new ResourceNotFoundException("No resource found matching type", type.getName());
+ }
+ return instance;
+ } else {
+ SCAObject child = parent.getSystemChild(mappedName);
+ if (child instanceof AtomicComponent) {
+ try {
+ AtomicComponent component = (AtomicComponent) child;
+ instance = type.cast(component.getTargetInstance());
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ } else if (child != null) {
+ throw new InvalidResourceTypeException("Invalid resource type", mappedName);
+ } else if (!optional) {
+ throw new ResourceNotFoundException("No resource found for URI", mappedName);
+ }
+ return instance;
+ }
+ }
+ }
+
+ private T resolveInstance() {
+ try {
+ if (mappedName == null) {
+ return host.resolveResource(type);
+ } else {
+ return host.resolveResource(type, mappedName);
+ }
+ } catch (ResourceResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonListObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonListObjectFactory.java
new file mode 100644
index 0000000000..fe503bfd68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonListObjectFactory.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.injection;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Implementation of ObjectFactory that returns a single instance, typically an immutable type.
+ *
+ * @version $Rev: 430937 $ $Date: 2006-08-12 06:47:56 +0530 (Sat, 12 Aug 2006) $
+ */
+public class SingletonListObjectFactory<T> implements ObjectFactory<List<T>> {
+ private List<T> instance;
+
+ public SingletonListObjectFactory(List<T> instance) {
+ this.instance = Collections.unmodifiableList(instance);
+ }
+
+ public List<T> getInstance() {
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java
new file mode 100644
index 0000000000..713c1ae54f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.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.injection;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * Implementation of ObjectFactory that returns a single instance, typically an immutable type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactory<T> implements ObjectFactory<T> {
+ private final T instance;
+
+ public SingletonObjectFactory(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/CompositeContextImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/CompositeContextImpl.java
new file mode 100644
index 0000000000..246ef8bdf7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/CompositeContextImpl.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.launcher;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.core.implementation.composite.AbstractCompositeContext;
+
+
+/**
+ * Default implementation of the {@link org.osoa.sca.CompositeContext} for non-managed code
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeContextImpl extends AbstractCompositeContext {
+
+ public CompositeContextImpl(final CompositeComponent composite, final WireService wireService) {
+ super(composite, wireService);
+ }
+
+ public ServiceReference createServiceReferenceForSession(Object arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceReference createServiceReferenceForSession(Object arg0, String arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public RequestContext getRequestContext() {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceReference newSession(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceReference newSession(String arg0, Object arg1) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LaunchException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LaunchException.java
new file mode 100644
index 0000000000..730f29611a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LaunchException.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.core.launcher;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Exception indicating that there was a problem launching an application.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class LaunchException extends TuscanyException {
+
+ protected LaunchException(String message) {
+ super(message);
+ }
+
+ protected LaunchException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected LaunchException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected LaunchException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected LaunchException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
new file mode 100644
index 0000000000..6f968b5209
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.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.launcher;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.stream.XMLInputFactory;
+
+import org.osoa.sca.CompositeContext;
+
+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.SCAObject;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.core.bootstrap.Bootstrapper;
+import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+import org.apache.tuscany.host.launcher.Launcher;
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+
+/**
+ * Basic launcher implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LauncherImpl implements Launcher {
+ /**
+ * A conventional META-INF based location for the system SCDL.
+ *
+ * @see #bootRuntime(URL,MonitorFactory)
+ */
+ public static final String METAINF_SYSTEM_SCDL_PATH = "META-INF/tuscany/system.scdl";
+
+ /**
+ * A conventional META-INF based location for the application SCDL.
+ */
+ public static final String METAINF_APPLICATION_SCDL_PATH = "META-INF/sca/default.scdl";
+
+ private ClassLoader applicationLoader;
+
+ private RuntimeComponent runtime;
+
+ private Deployer deployer;
+
+ private CompositeComponent composite;
+
+ public CompositeContext bootApplication(URL applicationScdl, ClassLoader applicationClassLoader) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitor)
+ throws TuscanyException {
+ if (systemScdl == null) {
+ throw new LoaderException("Null system SCDL URL");
+ }
+
+ XMLInputFactory xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", systemClassLoader);
+ TuscanyManagementService managementService = null;
+ Bootstrapper bootstrapper = new DefaultBootstrapper(monitor, xmlFactory, managementService);
+ Deployer bootDeployer = bootstrapper.createDeployer();
+
+ // create and start the core runtime
+ runtime = bootstrapper.createRuntime();
+ runtime.start();
+
+ // initialize the runtime info
+ CompositeComponent parent = runtime.getSystemComponent();
+ RuntimeInfo runtimeInfo = new LauncherRuntimeInfo(getInstallDirectory(), getApplicationRootDirectory(), true);
+ parent.registerJavaObject("RuntimeInfo", RuntimeInfo.class, runtimeInfo);
+
+ // register the monitor factory
+ if (monitor instanceof FormatterRegistry) {
+ List<Class<?>> interfazes = new ArrayList<Class<?>>(2);
+ interfazes.add(MonitorFactory.class);
+ interfazes.add(FormatterRegistry.class);
+ parent.registerJavaObject("MonitorFactory", interfazes, monitor);
+ } else {
+ parent.registerJavaObject("MonitorFactory", MonitorFactory.class, monitor);
+ }
+ parent.start();
+ // create a ComponentDefinition to represent the component we are going to deploy
+ SystemCompositeImplementation compositeImplementation = new SystemCompositeImplementation();
+ compositeImplementation.setScdlLocation(systemScdl);
+ compositeImplementation.setClassLoader(systemClassLoader);
+ ComponentDefinition<SystemCompositeImplementation> definition =
+ new ComponentDefinition<SystemCompositeImplementation>(
+ ComponentNames.TUSCANY_SYSTEM, compositeImplementation);
+ try {
+ // deploy the component into the runtime under the system parent
+ composite = (CompositeComponent) bootDeployer.deploy(parent, definition);
+ } catch (TuscanyException e) {
+ e.addContextName(definition.getName());
+ throw e;
+ }
+ // start the system
+ composite.start();
+
+ SCAObject child = composite.getSystemChild(ComponentNames.TUSCANY_DEPLOYER);
+ if (!(child instanceof AtomicComponent)) {
+ throw new InitializationException("Deployer must be an atomic component");
+ }
+ deployer = (Deployer) ((AtomicComponent) child).getTargetInstance();
+ runtime.getRootComponent().start();
+ }
+
+ /**
+ * Shuts down the active runtime being managed by this instance.
+ */
+ public void shutdownRuntime() {
+ if (composite != null) {
+ composite.stop();
+ composite = null;
+ }
+
+ if (runtime != null) {
+ runtime.stop();
+ runtime = null;
+ }
+ }
+
+ /**
+ * Returns the classloader for application classes.
+ *
+ * @return the classloader for application classes
+ */
+ public ClassLoader getApplicationLoader() {
+ return applicationLoader;
+ }
+
+ /**
+ * Set the classloader to be used for application classes. You should almost always supply your own application
+ * classloader, based on the hosting environment that the runtime is embedded in.
+ *
+ * @param applicationLoader the classloader to be used for application classes
+ */
+ public void setApplicationLoader(ClassLoader applicationLoader) {
+ this.applicationLoader = applicationLoader;
+ }
+
+ /**
+ * Boots the runtime defined by the specified SCDL.
+ *
+ * @param systemScdl a resource path to the SCDL defining the system.
+ * @return a CompositeComponent for the newly booted runtime system
+ * @throws LoaderException
+ */
+ @Deprecated
+ public CompositeComponent bootRuntime(URL systemScdl, MonitorFactory monitor) throws TuscanyException {
+ ClassLoader systemClassLoader = getClass().getClassLoader();
+ bootRuntime(systemScdl, systemClassLoader, monitor);
+ return composite;
+ }
+
+ /**
+ * Boots the application defined by the specified SCDL.
+ *
+ * @param name the name of the application component
+ * @param appScdl URL to the SCDL defining the application
+ * @return a CompositeComponent for the newly booted application
+ * @throws LoaderException
+ */
+ @Deprecated
+ public CompositeComponent bootApplication(String name, URL appScdl) throws TuscanyException {
+ ClassLoader applicationLoader = getApplicationLoader();
+
+ if (appScdl == null) {
+ throw new LoaderException("No application scdl found");
+ }
+
+ // create a ComponentDefinition to represent the component we are going to deploy
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(appScdl);
+ impl.setClassLoader(applicationLoader);
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(name, impl);
+
+ // deploy the component into the runtime under the system parent
+ CompositeComponent parent = runtime.getRootComponent();
+ // FIXME andyp -- this seems bogus when running inside an appserver
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+
+ try {
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ return (CompositeComponent) deployer.deploy(parent, definition);
+ } finally {
+ Thread.currentThread().setContextClassLoader(ccl);
+ }
+ }
+
+ public File getInstallDirectory() {
+ String property = System.getProperty("tuscany.installDir");
+ if (property != null) {
+ return new File(property);
+ }
+
+ // TODO: TUSCANY-648, should this throw an exception if it not running from a jar?
+
+ URL url = getClass().getResource("LauncherImpl.class");
+ String jarLocation = url.toString();
+ if ("jar".equals(url.getProtocol())) {
+ jarLocation = jarLocation.substring(4, jarLocation.lastIndexOf("!/"));
+ }
+ if (jarLocation.startsWith("file:")) {
+ jarLocation = jarLocation.substring(5);
+ }
+
+ File jarFile = new File(jarLocation);
+ return jarFile.getParentFile().getParentFile();
+ }
+
+ public File getApplicationRootDirectory() {
+ String property = System.getProperty("tuscany.applicationRootDir");
+ if (property != null) {
+ return new File(property);
+ }
+
+ return new File(System.getProperty("user.dir"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherRuntimeInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherRuntimeInfo.java
new file mode 100644
index 0000000000..a46631508b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherRuntimeInfo.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 org.apache.tuscany.core.launcher;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URI;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LauncherRuntimeInfo implements RuntimeInfo {
+
+ /** Install directory */
+ private final File installDirectory;
+
+ /** Application root directory */
+ private final File applicationRootDirectory;
+
+ private final boolean online;
+
+ /**
+ * Initializes the installation and application root directories.
+ *
+ * @param installDirectory Installation directory.
+ * @param applicationRootDirectory Application root directory.
+ */
+ public LauncherRuntimeInfo(File installDirectory, File applicationRootDirectory, boolean online) {
+ this.installDirectory = installDirectory;
+ this.applicationRootDirectory = applicationRootDirectory;
+ this.online = online;
+ }
+
+ public URI getDomain() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Return the directory where the running runtime was installed.
+ *
+ * @return the directory where the runtime was installed
+ */
+ public File getInstallDirectory() {
+ return installDirectory;
+ }
+
+ /**
+ * Return the root directory used to resolve application file paths.
+ *
+ * @return the directory used to resolve application file paths.
+ */
+ public File getApplicationRootDirectory() {
+ return applicationRootDirectory;
+ }
+
+ /**
+ * Gets the base URL for the runtime.
+ *
+ * @return The base URL for the runtime.
+ */
+ public URL getBaseURL() {
+ try {
+ return installDirectory.toURL();
+ } catch (MalformedURLException e) {
+ // TODO Decide on how to handle the exception
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean isOnline() {
+ return online;
+ }
+
+ public String getRuntimeId() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
new file mode 100644
index 0000000000..796ec2b77e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.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.core.loader;
+
+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.lang.reflect.Type;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.binding.local.LocalBindingDefinition;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.util.ReferenceLoaderHelper;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.InvalidReferenceException;
+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.loader.MissingImplementationException;
+import org.apache.tuscany.spi.loader.MissingPropertyValueException;
+import org.apache.tuscany.spi.loader.MissingReferenceException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityOverridingException;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityViolationException;
+import org.apache.tuscany.spi.loader.UndefinedPropertyException;
+import org.apache.tuscany.spi.loader.UndefinedReferenceException;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.osoa.sca.annotations.Constructor;
+import org.w3c.dom.Element;
+
+/**
+ * Loads a component definition from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoader extends LoaderExtension<ComponentDefinition<?>> {
+ private static final QName COMPONENT = new QName(SCA_NS, "component");
+
+ private static final QName PROPERTY = new QName(SCA_NS, "property");
+
+ private static final QName REFERENCE = new QName(SCA_NS, "reference");
+
+ private static final String COMPONENT_NAME_ATTR = "name";
+
+ private static final String COMPONENT_INIT_ATTR = "initLevel";
+
+ private static final String AUTOWIRE_ATTR = "autowire";
+
+ private static final String PROPERTY_FILE_ATTR = "file";
+
+ private static final String PROPERTY_SOURCE_ATTR = "source";
+
+ private static final String PROPERTY_NAME_ATTR = "name";
+
+ private static final String PROPERTY_TYPE_ATTR = "type";
+
+ private static final String PROPERTY_ELEMENT_ATTR = "element";
+
+ public static final String REF_NAME_ATTR = "name";
+
+ public static final String REF_MULTIPLICITY_ATTR = "multiplicity";
+
+ public static final String REF_TARGET_ATTR = "target";
+
+ public static final char COLON = ':';
+
+ private PropertyObjectFactory propertyFactory;
+
+ @Constructor
+ public ComponentLoader(@Autowire
+ LoaderRegistry registry, @Autowire
+ PropertyObjectFactory propertyFactory) {
+ super(registry);
+ this.propertyFactory = propertyFactory;
+ }
+
+ public QName getXMLType() {
+ return COMPONENT;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ComponentDefinition<?> load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+ assert COMPONENT.equals(reader.getName());
+ String name = reader.getAttributeValue(null, COMPONENT_NAME_ATTR);
+ String initLevel = reader.getAttributeValue(null, COMPONENT_INIT_ATTR);
+ String autowire = reader.getAttributeValue(null, AUTOWIRE_ATTR);
+
+ try {
+ Implementation<?> impl = loadImplementation(parent, reader, deploymentContext);
+ registry.loadComponentType(parent, impl, deploymentContext);
+
+ ComponentDefinition<Implementation<?>> componentDefinition =
+ new ComponentDefinition<Implementation<?>>(name, impl);
+ if (autowire != null) {
+ componentDefinition.setAutowire(Boolean.parseBoolean(autowire));
+ } else {
+ if (object instanceof CompositeComponentType) {
+ componentDefinition.setAutowire(((CompositeComponentType)object).isAutowire());
+ }
+ }
+
+ if (initLevel != null) {
+ if (initLevel.length() == 0) {
+ componentDefinition.setInitLevel(0);
+ } else {
+ try {
+ componentDefinition.setInitLevel(Integer.valueOf(initLevel));
+ } catch (NumberFormatException e) {
+ throw new InvalidValueException(initLevel, "initValue", e);
+ }
+ }
+ }
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (PROPERTY.equals(qname)) {
+ loadProperty(reader, deploymentContext, componentDefinition);
+ } else if (REFERENCE.equals(qname)) {
+ loadReference(parent, reader, deploymentContext, componentDefinition);
+ } else {
+ throw new UnrecognizedElementException(qname);
+ }
+ //reader.next();
+ break;
+ case END_ELEMENT:
+ if (reader.getName().equals(COMPONENT)) {
+ // hack to leave alone SystemImplementation
+ if (!((Implementation)componentDefinition.getImplementation() instanceof SystemImplementation)) {
+ populatePropertyValues(componentDefinition);
+ }
+ populateReferences(componentDefinition);
+ /*ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ (ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>)componentDefinition
+ .getImplementation().getComponentType();
+ for (ReferenceDefinition ref : type.getReferences().values()) {
+ if (ref.isAutowire()) {
+ ReferenceTarget referenceTarget = new ReferenceTarget();
+ referenceTarget.setReferenceName(ref.getName());
+ componentDefinition.add(referenceTarget);
+ }
+ }*/
+ //validate(componentDefinition);
+ return componentDefinition;
+ }
+ break;
+ }
+ }
+ } catch (LoaderException e) {
+ e.addContextName(name);
+ throw e;
+ }
+ }
+
+ protected Implementation<?> loadImplementation(CompositeComponent parent,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+ reader.nextTag();
+ ModelObject o = registry.load(parent, null, reader, deploymentContext);
+ if (!(o instanceof Implementation)) {
+ throw new MissingImplementationException();
+ }
+ return (Implementation<?>)o;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void loadProperty(XMLStreamReader reader,
+ DeploymentContext deploymentContext,
+ ComponentDefinition<?> componentDefinition) throws XMLStreamException,
+ LoaderException {
+ String name = reader.getAttributeValue(null, PROPERTY_NAME_ATTR);
+ Implementation<?> implementation = componentDefinition.getImplementation();
+ ComponentType<?, ?, ?> componentType = implementation.getComponentType();
+ Property<Type> property = componentType.getProperty(name);
+ if (property == null) {
+ throw new UndefinedPropertyException(name);
+ }
+
+ PropertyValue<Type> propertyValue;
+ readPropertyType(reader, property);
+
+ String source = reader.getAttributeValue(null, PROPERTY_SOURCE_ATTR);
+ String file = reader.getAttributeValue(null, PROPERTY_FILE_ATTR);
+
+ if (source != null || file != null) {
+ propertyValue = new PropertyValue<Type>(name, source, file);
+ propertyValue.setValue(property.getDefaultValues());
+ LoaderUtil.skipToEndElement(reader);
+ } else {
+ try {
+ DocumentBuilder documentBuilder = DOMHelper.newDocumentBuilder();
+ List<Element> values =
+ StaxUtil.createPropertyValues(reader, property.getXmlType(), property
+ .getXmlElement(), property.isMany(), documentBuilder);
+ propertyValue = new PropertyValue<Type>(name, values);
+ if (!property.isMany() && values.size() > 1) {
+ ManyPropertyValueLoaderException ex = new ManyPropertyValueLoaderException();
+ ex.setPropertyName(name);
+ ex.setLine(reader.getLocation().getLineNumber());
+ ex.setColumn(reader.getLocation().getColumnNumber());
+ throw ex;
+ }
+ } catch (ParserConfigurationException e) {
+ throw new LoaderException(e);
+ }
+ }
+
+ ObjectFactory<?> objectFactory = null;
+ if (property.isMany()) {
+ objectFactory = propertyFactory.createListObjectFactory(property, propertyValue);
+ } else {
+ objectFactory = propertyFactory.createObjectFactory(property, propertyValue);
+ }
+ // propertyValue.setValueFactory(new
+ // SimplePropertyObjectFactory(property, propertyValue.getValue()));
+ propertyValue.setValueFactory(objectFactory);
+ componentDefinition.add(propertyValue);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void loadReference(CompositeComponent parent,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext,
+ ComponentDefinition<?> componentDefinition) throws XMLStreamException,
+ LoaderException {
+
+ ComponentReferenceDefinition componentReference = null;
+ Implementation<?> impl = componentDefinition.getImplementation();
+ ComponentType<?, ComponentTypeReferenceDefinition, ?> componentType =
+ impl.getComponentType();
+
+ String name = reader.getAttributeValue(null, REF_NAME_ATTR);
+
+ if (name == null) {
+ throw new InvalidReferenceException("No name specified");
+ } else if (!componentType.getReferences().containsKey(name)) {
+ throw new UndefinedReferenceException(name);
+ } else {
+ componentReference =
+ new ComponentReferenceDefinition(componentType.getReferences().get(name));
+ }
+
+ String multiplicityVal = reader.getAttributeValue(null, REF_MULTIPLICITY_ATTR);
+ Multiplicity multiplicity =
+ StaxUtil.multiplicity(multiplicityVal, componentType.getReferences().get(name)
+ .getMultiplicity());
+ if (!ReferenceLoaderHelper.isValidMultiplicityOverride(componentType.getReferences()
+ .get(name).getMultiplicity(), multiplicity)) {
+ throw new ReferenceMultiplicityOverridingException(name, componentType.getReferences()
+ .get(name).getMultiplicity(), multiplicity);
+ } else {
+ componentReference.setMultiplicity(multiplicity);
+ }
+
+ String autowire = reader.getAttributeValue(null, AUTOWIRE_ATTR);
+ if (autowire == null) {
+ componentReference.setAutowire(componentDefinition.isAutowire());
+ } else {
+ componentReference.setAutowire(Boolean.parseBoolean(autowire));
+ }
+
+ String targets = reader.getAttributeValue(null, REF_TARGET_ATTR);
+ if (targets != null && targets.length() > 0) {
+ ReferenceLoaderHelper.populateRefTargets(componentReference, targets);
+ /*if (!ReferenceLoaderHelper.validateMultiplicityAndTargets(multiplicity,
+ componentReference
+ .getTargets())) {
+ throw new ReferenceMultiplicityViolationException(name,
+ multiplicity,
+ componentReference
+ .getTargets().size());
+ }*/
+ }
+
+ ComponentTypeReferenceDefinition ctReference = componentType.getReferences().get(name);
+ boolean isBindingsOverriden = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject o = registry.load(parent, null, reader, deploymentContext);
+ if (o instanceof ServiceContract) {
+ ServiceContract overridenSvcContract = (ServiceContract)o;
+ ServiceContract implSvcContract = ctReference.getServiceContract();
+ //TODO : Since the JavaInterfaceProcessorRegistryImpl does not do a deep introspection
+ //this comparison is not possible. This will be uncommented once that is fixed.
+ /*ReferenceLoaderHelper.checkInterfaceCompatibility(implSvcContract,
+ overridenSvcContract,
+ false);*/
+ componentReference.setServiceContract(overridenSvcContract);
+ } else if (o instanceof BindingDefinition) {
+ componentReference.addBinding((BindingDefinition)o);
+ isBindingsOverriden = true;
+ } else {
+ throw new UnrecognizedElementException(reader.getName());
+ }
+ //reader.next();
+ break;
+ case END_ELEMENT:
+ if (REFERENCE.equals(reader.getName())) {
+ if (componentType instanceof CompositeComponentType) {
+ //AbstractReferenceDefinition definition = componentType.getReferences().get(name);
+ //if there were targets overridden, then its better to copy the componentType
+ //bindings from the underlying componentType and set the overriden target
+ if (targets != null && targets.length() > 0) {
+ if (componentReference.getBindings().isEmpty()) {
+ for (URI targetUri : componentReference.getTargets()) {
+ // TODO JFM allow selection of a default binding
+ LocalBindingDefinition binding =
+ new LocalBindingDefinition(targetUri);
+ componentReference.addBinding(binding);
+ //HACK [svkrish]: to get composite implementations working.. not sure
+ //why the componentType should be updated for bindings and targets
+ componentReference.getAssociatedCompTypeRefDefn()
+ .addBinding(binding);
+ }
+ } else {
+ for (URI targetUri : componentReference.getTargets()) {
+ if (isBindingsOverriden) {
+ for (BindingDefinition binding : componentReference
+ .getBindings()) {
+ binding.setTargetUri(targetUri);
+ }
+ } else {
+ BindingDefinition clone = null;
+ for (BindingDefinition binding : componentReference
+ .getAssociatedCompTypeRefDefn().getBindings()) {
+ clone = (BindingDefinition)binding.clone();
+ clone.setTargetUri(targetUri);
+ componentReference.addBinding(clone);
+ //HACK [svkrish]: to get composite implementations working.. not sure
+ //why the componentType should be updated for bindings and targets
+ binding.setTargetUri(targetUri);
+ }
+ }
+ }
+ }
+ }
+ }
+ componentDefinition.add(componentReference);
+ return;
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void populatePropertyValues(ComponentDefinition<Implementation<?>> componentDefinition) throws LoaderException,
+ MissingPropertyValueException {
+ ComponentType componentType = componentDefinition.getImplementation().getComponentType();
+ if (componentType != null) {
+ Map<String, Property<?>> properties = componentType.getProperties();
+ Map<String, PropertyValue<?>> propertyValues = componentDefinition.getPropertyValues();
+
+ for (Property<?> aProperty : properties.values()) {
+ if (propertyValues.get(aProperty.getName()) == null) {
+ if (aProperty.isMustSupply()) {
+ throw new MissingPropertyValueException(aProperty.getName());
+ } else if (aProperty.getDefaultValues() != null) {
+ PropertyValue propertyValue = new PropertyValue();
+ propertyValue.setName(aProperty.getName());
+ propertyValue.setValue(aProperty.getDefaultValues());
+ propertyValue.setValueFactory(propertyFactory
+ .createObjectFactory(aProperty, propertyValue));
+ /*
+ * propertyValue.setValueFactory(new SimplePropertyObjectFactory(aProperty,
+ * propertyValue.getValue()));
+ */
+ propertyValues.put(aProperty.getName(), propertyValue);
+ }
+ }
+ }
+ }
+ }
+
+ private void readPropertyType(XMLStreamReader reader, Property property) throws MissingTypePropertyLoaderException {
+
+ String typeName = reader.getAttributeValue(null, PROPERTY_TYPE_ATTR);
+ String elementName = reader.getAttributeValue(null, PROPERTY_ELEMENT_ATTR);
+ QName xmlElement = null;
+ QName xmlType = null;
+
+ if (typeName != null) {
+ int index = typeName.indexOf(COLON);
+ if (index != -1) {
+ String prefix = typeName.substring(0, index);
+ String localName = typeName.substring(index + 1);
+ String ns = reader.getNamespaceURI(prefix);
+ xmlType = new QName(ns, localName, prefix);
+ }
+ } else if (elementName != null) {
+ int index = elementName.indexOf(COLON);
+ if (index != -1) {
+ String prefix = elementName.substring(0, index);
+ String localName = elementName.substring(index + 1);
+ String ns = reader.getNamespaceURI(prefix);
+ xmlElement = new QName(ns, localName, prefix);
+ // FIXME :
+ // need to figure out how to determine the xmltype from this
+ // xmlelement
+ // this need access to the global xml element thro
+ // schemalocation or thro
+ // artifact repository
+ xmlType = null;
+ }
+ }
+
+ if (xmlType != null) {
+ property.setXmlType(xmlType);
+ }
+
+ if (xmlElement != null) {
+ property.setXmlElement(xmlElement);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void populateReferences(ComponentDefinition<Implementation<?>> componentDefinition) {
+ //bring the component definition in sync with the componenttype for reference definitions
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> componentType =
+ componentDefinition.getImplementation().getComponentType();
+
+ for (ComponentTypeReferenceDefinition refDefn : componentType.getReferences().values()) {
+ if (componentDefinition.getReferences().get(refDefn.getName()) == null) {
+ componentDefinition.add(new ComponentReferenceDefinition(refDefn));
+ }
+ }
+ }
+
+ /**
+ * Validates a component definition, ensuring all component type configuration elements are satisfied
+ */
+ protected void validate(ComponentDefinition<Implementation<?>> definition) throws LoaderException {
+ // validate refererences
+ Implementation<?> implementation = definition.getImplementation();
+ ComponentType<?, ?, ?> type = implementation.getComponentType();
+ if (type == null) {
+ return;
+ }
+ for (ComponentReferenceDefinition referenceDef : definition.getReferences().values()) {
+ if (referenceDef.isAutowire()) {
+ continue;
+ }
+ String name = referenceDef.getName();
+ List<URI> targets = definition.getReferences().get(name).getTargets();
+ if (targets == null) {
+ throw new MissingReferenceException(name);
+ }
+ int count = targets.size();
+ Multiplicity multiplicity = referenceDef.getMultiplicity();
+ switch (multiplicity) {
+ case ZERO_N:
+ break;
+ case ZERO_ONE:
+ if (count > 1) {
+ throw new ReferenceMultiplicityViolationException(name, multiplicity, count);
+ }
+ break;
+ case ONE_ONE:
+ if (count != 1) {
+ throw new ReferenceMultiplicityViolationException(name, multiplicity, count);
+ }
+ break;
+ case ONE_N:
+ if (count < 1) {
+ throw new ReferenceMultiplicityViolationException(name, multiplicity, count);
+ }
+ break;
+ }
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java
new file mode 100644
index 0000000000..5313f32aa1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentTypeElementLoader.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+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 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.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeElementLoader extends LoaderExtension<ComponentType> {
+ public static final QName COMPONENT_TYPE = new QName(SCA_NS, "componentType");
+
+ @Constructor
+ public ComponentTypeElementLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return COMPONENT_TYPE;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ComponentType load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert COMPONENT_TYPE.equals(reader.getName());
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> componentType;
+ if (object != null) {
+ assert object instanceof ComponentType;
+ // a specialized component type was passed in
+ componentType = (ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>) object;
+ } else {
+ componentType = new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ }
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject o = registry.load(parent, componentType, reader, deploymentContext);
+ if (o instanceof ServiceDefinition) {
+ componentType.add((ServiceDefinition) o);
+ } else if (o instanceof ComponentTypeReferenceDefinition) {
+ componentType.add((ComponentTypeReferenceDefinition) o);
+ } else if (o instanceof Property) {
+ componentType.add((Property<?>) o);
+ }
+ break;
+ case END_ELEMENT:
+ return componentType;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DefaultPropertyValueLoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DefaultPropertyValueLoaderException.java
new file mode 100644
index 0000000000..adcde47dda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DefaultPropertyValueLoaderException.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.core.loader;
+
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev: 487057 $ $Date: 2006-12-14 12:50:44 +0530 (Thu, 14 Dec 2006) $
+ */
+public class DefaultPropertyValueLoaderException extends PropertyLoaderException {
+
+ public DefaultPropertyValueLoaderException() {
+ super("Default Property Value must be supplied only when 'mustSupply' attribute is set to 'false'");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DependencyLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DependencyLoader.java
new file mode 100644
index 0000000000..66aafb6525
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/DependencyLoader.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.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+
+import org.apache.tuscany.core.implementation.composite.Dependency;
+
+/**
+ * Loader for handling <dependency> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DependencyLoader extends LoaderExtension<Dependency> {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final QName DEPENDENCY = new QName(NS, "dependency");
+ private static final QName GROUP = new QName(NS, "group");
+ private static final QName NAME = new QName(NS, "name");
+ private static final QName VERSION = new QName(NS, "version");
+ private static final QName CLASSIFIER = new QName(NS, "classifier");
+ private static final QName TYPE = new QName(NS, "type");
+
+ public DependencyLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return DEPENDENCY;
+ }
+
+ public Dependency load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ Artifact artifact = new Artifact();
+ while (reader.nextTag() == XMLStreamConstants.START_ELEMENT) {
+ QName name = reader.getName();
+ String text = reader.getElementText();
+ if (GROUP.equals(name)) {
+ artifact.setGroup(text);
+ } else if (NAME.equals(name)) {
+ artifact.setName(text);
+ } else if (VERSION.equals(name)) {
+ artifact.setVersion(text);
+ } else if (CLASSIFIER.equals(name)) {
+ artifact.setClassifier(text);
+ } else if (TYPE.equals(name)) {
+ artifact.setType(text);
+ } else {
+ throw new UnrecognizedElementException(name);
+ }
+ }
+ Dependency dependency = new Dependency();
+ dependency.setArtifact(artifact);
+ return dependency;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java
new file mode 100644
index 0000000000..c1de002936
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.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.core.loader;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+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.loader.LoaderUtil;
+import org.apache.tuscany.spi.loader.MissingIncludeException;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Include;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import org.apache.tuscany.core.deployer.ChildDeploymentContext;
+
+/**
+ * Loader that handles &lt;include&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IncludeLoader extends LoaderExtension<Include> {
+ private static final QName INCLUDE = new QName(SCA_NS, "include");
+
+ @Constructor({"registry"})
+ public IncludeLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return INCLUDE;
+ }
+
+ public Include load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ assert INCLUDE.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ String scdlLocation = reader.getAttributeValue(null, "scdlLocation");
+ String scdlResource = reader.getAttributeValue(null, "scdlResource");
+ LoaderUtil.skipToEndElement(reader);
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+ URL url;
+ if (scdlLocation != null) {
+ try {
+ url = new URL(deploymentContext.getScdlLocation(), scdlLocation);
+ } catch (MalformedURLException e) {
+ throw new MissingResourceException(scdlLocation, name, e);
+ }
+ } else if (scdlResource != null) {
+ url = cl.getResource(scdlResource);
+ if (url == null) {
+ throw new MissingResourceException(scdlResource, name);
+ }
+ } else {
+ throw new MissingIncludeException("No SCDL location or resource specified", name);
+ }
+
+ DeploymentContext childContext = new ChildDeploymentContext(deploymentContext, cl, url);
+ CompositeComponentType composite;
+ try {
+ composite = loadFromSidefile(parent, url, childContext);
+ } catch (LoaderException e) {
+ e.addContextName(name);
+ throw e;
+ }
+
+ Include include = new Include();
+ include.setName(name);
+ include.setScdlLocation(url);
+ include.setIncluded(composite);
+ return include;
+ }
+
+ protected CompositeComponentType loadFromSidefile(CompositeComponent parent,
+ URL url,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ return registry.load(parent, null, url, CompositeComponentType.class, deploymentContext);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/JNDIPropertyFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/JNDIPropertyFactory.java
new file mode 100644
index 0000000000..32678a6179
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/JNDIPropertyFactory.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.core.loader;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+import org.apache.tuscany.core.injection.JNDIListObjectFactory;
+import org.apache.tuscany.core.injection.JNDIObjectFactory;
+
+/**
+ * A StAXPropertyFactory that creates property values by looking them up in the default JNDI InitialContext. <p/> This
+ * can be used to locate resources in a J2EE environment and inject them as configuration properties. For example, to
+ * access a database a component could write: <code> &at;Property DataSource myDB; </code> and configure with <code>
+ * &lt;properties&gt; &lt;v:myDb&gt;java:comp/env/jdbc/MyDatabase&lt;/v:myDB&gt; &lt;/properties&gt; </code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class JNDIPropertyFactory implements PropertyObjectFactory {
+ public <T> ObjectFactory<T> createObjectFactory(Property<T> property, PropertyValue<T> value)
+ throws LoaderException {
+ String text = value.getValue().get(0).getTextContent();
+ try {
+ Context context = new InitialContext();
+ return new JNDIObjectFactory<T>(context, text);
+ } catch (NamingException e) {
+ throw new LoaderException(e);
+ }
+ }
+
+ public <T> ObjectFactory<List<T>> createListObjectFactory(Property<T> property, PropertyValue<T> value)
+ throws LoaderException {
+ try {
+ List<T> instances = new ArrayList<T>();
+ Context context = new InitialContext();
+ List<String> text = new ArrayList<String>();
+ for (int count = 0 ; count < instances.size() ; ++count) {
+ text.add(value.getValue().get(count).getTextContent());
+ }
+ return new JNDIListObjectFactory<T>(context, text);
+ } catch (NamingException e) {
+ throw new LoaderException(e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java
new file mode 100644
index 0000000000..4fad10c95f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderExceptionFormatter.java
@@ -0,0 +1,50 @@
+package org.apache.tuscany.core.loader;
+
+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.loader.LoaderException;
+
+import org.apache.tuscany.host.monitor.ExceptionFormatter;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+
+/**
+ * Formats {@link org.apache.tuscany.spi.loader.LoaderException} events
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class LoaderExceptionFormatter implements ExceptionFormatter {
+ private FormatterRegistry factory;
+
+ public LoaderExceptionFormatter(@Autowire FormatterRegistry factory) {
+ this.factory = factory;
+ factory.register(this);
+ }
+
+ public boolean canFormat(Class<?> type) {
+ return LoaderException.class.isAssignableFrom(type);
+ }
+
+ @Destroy
+ public void destroy() {
+ factory.unregister(this);
+ }
+
+ public PrintWriter write(PrintWriter writer, Throwable exception) {
+ assert exception instanceof LoaderException;
+ LoaderException e = (LoaderException) exception;
+ e.appendBaseMessage(writer);
+ if (e.getLine() != LoaderException.UNDEFINED) {
+ writer.write("\nLine: " + e.getLine() + "\n");
+ writer.write("Column: " + e.getColumn());
+ } else {
+ writer.write("\n");
+ }
+ 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/loader/LoaderRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.java
new file mode 100644
index 0000000000..69c182cb6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/LoaderRegistryImpl.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.loader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.ComponentTypeLoader;
+import org.apache.tuscany.spi.loader.InvalidConfigurationException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.StAXElementLoader;
+import org.apache.tuscany.spi.loader.UnrecognizedComponentTypeException;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * The default implementation of a loader registry
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class LoaderRegistryImpl implements LoaderRegistry {
+ private Monitor monitor;
+ private final Map<QName, StAXElementLoader<? extends ModelObject>> loaders =
+ new HashMap<QName, StAXElementLoader<? extends ModelObject>>();
+ private final Map<Class<? extends Implementation<?>>,
+ ComponentTypeLoader<? extends Implementation<?>>> componentTypeLoaders =
+ new HashMap<Class<? extends Implementation<?>>, ComponentTypeLoader<? extends Implementation<?>>>();
+
+ public LoaderRegistryImpl(@org.apache.tuscany.api.annotation.Monitor Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public <T extends ModelObject> void registerLoader(QName element, StAXElementLoader<T> loader) {
+ monitor.registeringLoader(element);
+ loaders.put(element, loader);
+ }
+
+ public <T extends ModelObject> void unregisterLoader(QName element, StAXElementLoader<T> loader) {
+ monitor.unregisteringLoader(element);
+ loaders.remove(element);
+ }
+
+ public ModelObject load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ QName name = reader.getName();
+ monitor.elementLoad(name);
+ StAXElementLoader<? extends ModelObject> loader = loaders.get(name);
+ if (loader == null) {
+ throw new UnrecognizedElementException(name);
+ }
+ return loader.load(parent, object, reader, deploymentContext);
+ }
+
+ public <MO extends ModelObject> MO load(CompositeComponent parent,
+ ModelObject object,
+ URL url,
+ Class<MO> type,
+ DeploymentContext ctx) throws LoaderException {
+ try {
+ XMLStreamReader reader;
+ InputStream is;
+ is = url.openStream();
+ try {
+ XMLInputFactory factory = ctx.getXmlFactory();
+ reader = factory.createXMLStreamReader(is);
+ try {
+ reader.nextTag();
+ QName name = reader.getName();
+ ModelObject mo = load(parent, object, reader, ctx);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(name);
+ e.setResourceURI(url.toString());
+ throw e;
+ }
+ } catch (LoaderException e) {
+ Location location = reader.getLocation();
+ e.setLine(location.getLineNumber());
+ e.setColumn(location.getColumnNumber());
+ throw e;
+ } finally {
+ try {
+ reader.close();
+ } catch (XMLStreamException e) {
+ // ignore
+ }
+ }
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ } catch (IOException e) {
+ LoaderException sfe = new LoaderException(e);
+ sfe.setResourceURI(url.toString());
+ throw sfe;
+ } catch (XMLStreamException e) {
+ throw new InvalidConfigurationException("Invalid or missing resource", url.toString(), e);
+ }
+ }
+
+ public <I extends Implementation<?>> void registerLoader(Class<I> key, ComponentTypeLoader<I> loader) {
+ componentTypeLoaders.put(key, loader);
+ }
+
+ public <I extends Implementation<?>> void unregisterLoader(Class<I> key) {
+ componentTypeLoaders.remove(key);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <I extends Implementation<?>> void loadComponentType(CompositeComponent parent,
+ I implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException {
+ Class<I> key = (Class<I>) implementation.getClass();
+ ComponentTypeLoader<I> loader = (ComponentTypeLoader<I>) componentTypeLoaders.get(key);
+ if (loader == null) {
+ throw new UnrecognizedComponentTypeException(key);
+ }
+ try {
+ loader.load(parent, implementation, deploymentContext);
+ } catch ( Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static interface Monitor {
+ /**
+ * Event emitted when a StAX element loader is registered.
+ *
+ * @param xmlType the QName of the element the loader will handle
+ */
+ void registeringLoader(QName xmlType);
+
+ /**
+ * Event emitted when a StAX element loader is unregistered.
+ *
+ * @param xmlType the QName of the element the loader will handle
+ */
+ void unregisteringLoader(QName xmlType);
+
+ /**
+ * Event emitted when a request is made to load an element.
+ *
+ * @param xmlType the QName of the element that should be loaded
+ */
+ void elementLoad(QName xmlType);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ManyPropertyValueLoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ManyPropertyValueLoaderException.java
new file mode 100644
index 0000000000..e0893994a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ManyPropertyValueLoaderException.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.core.loader;
+
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev: 487057 $ $Date: 2006-12-14 12:50:44 +0530 (Thu, 14 Dec 2006) $
+ */
+public class ManyPropertyValueLoaderException extends PropertyLoaderException {
+
+ public ManyPropertyValueLoaderException() {
+ super("Multiple property values may be supplied only if 'many' attribute is set to 'true'");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/MissingTypePropertyLoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/MissingTypePropertyLoaderException.java
new file mode 100644
index 0000000000..9ec0ac2a68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/MissingTypePropertyLoaderException.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.core.loader;
+
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev: 487057 $ $Date: 2006-12-14 12:50:44 +0530 (Thu, 14 Dec 2006) $
+ */
+public class MissingTypePropertyLoaderException extends PropertyLoaderException {
+
+ public MissingTypePropertyLoaderException() {
+ super("Property type missing - either one of 'type' or 'element' must be specified ");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.java
new file mode 100644
index 0000000000..7f9df442e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PolicySetLoader.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.loader;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+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.LoaderRegistry;
+import org.apache.tuscany.spi.loader.LoaderUtil;
+import org.apache.tuscany.spi.model.IntentMap;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.PolicySet;
+import org.apache.tuscany.spi.model.PolicySetReference;
+import org.apache.tuscany.spi.model.Qualifier;
+import org.apache.tuscany.spi.model.WSPolicyAttachment;
+
+/**
+ * Loads a PolicySet definition from an SCDL file.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetLoader extends LoaderExtension<PolicySet> {
+
+ private static final String WSPOLICY_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+
+ private static final QName POLICYSET = new QName(SCA_NS, "policySet");
+
+ private static final QName INTENTMAP = new QName(SCA_NS, "intentMap");
+
+ private static final QName QUALIFIER = new QName(SCA_NS, "qualifier");
+
+ private static final QName POLICYSETREFERENCE = new QName(SCA_NS, "policySetReference");
+
+ private static final QName WSPOLICYATTACHMENT = new QName(WSPOLICY_NAMESPACE, "PolicyAttachment");
+
+ @Constructor({"registry"})
+ public PolicySetLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+
+ }
+
+ @Override
+ public QName getXMLType() {
+ return POLICYSET;
+ }
+
+ public PolicySet load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException {
+ assert POLICYSET.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ String provides = reader.getAttributeValue(null, "provides");
+ String appliesTo = reader.getAttributeValue(null, "appliesTo");
+ PolicySet policySet = new PolicySet(new QName(SCA_NS, name), parseIntentName(provides));
+ String[] appliesToArtifact = split(appliesTo);
+ for (String artifact : appliesToArtifact) {
+ policySet.addAppliedArtifacts(new QName(SCA_NS, artifact));
+ }
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (INTENTMAP.equals(qname)) {
+ policySet.addIntentMap(loadIntentMap(reader, deploymentContext));
+ } else if (POLICYSETREFERENCE.equals(qname)) {
+ policySet.addPolicySetReference(loadPolicyReference(reader, deploymentContext));
+ } else if (WSPOLICYATTACHMENT.equals(qname)) {
+ policySet.addWsPolicyAttachment(loadWSPolicyAttachment(reader, deploymentContext));
+ }
+
+ reader.next();
+ break;
+ case END_ELEMENT:
+ if (reader.getName().equals(POLICYSET)) {
+ return policySet;
+ }
+ break;
+ }
+ }
+
+ }
+
+ private PolicySetReference loadPolicyReference(XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException {
+ assert POLICYSETREFERENCE.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ LoaderUtil.skipToEndElement(reader);
+ return new PolicySetReference(new QName(SCA_NS, name));
+ }
+
+ private IntentMap loadIntentMap(XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException {
+ assert INTENTMAP.equals(reader.getName());
+ String defaultIntentAttr = reader.getAttributeValue(null, "default");
+ String provides = reader.getAttributeValue(null, "provides");
+ IntentMap intentMap = new IntentMap(defaultIntentAttr, java.util.Arrays.asList(split(provides)));
+ //parentPolicySet.addIntentMap(intentMap);
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (QUALIFIER.equals(qname)) {
+ intentMap.addQualifier(loadQualifier(reader, deploymentContext));
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ if (reader.getName().equals(INTENTMAP)) {
+ return intentMap;
+ }
+ }
+ }
+
+ }
+
+ private Qualifier loadQualifier(XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException {
+ assert QUALIFIER.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ Qualifier qualifier = new Qualifier(name);
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ if (INTENTMAP.equals(qname)) {
+ qualifier.setIntentMap(loadIntentMap(reader, deploymentContext));
+ } else if (WSPOLICYATTACHMENT.equals(qname)) {
+ qualifier.addWsPolicyAttachment(loadWSPolicyAttachment(reader, deploymentContext));
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ if (reader.getName().equals(QUALIFIER)) {
+ return qualifier;
+ }
+ }
+ }
+
+ }
+
+ private WSPolicyAttachment loadWSPolicyAttachment(XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException {
+ return new WSPolicyAttachment();
+ }
+
+ /**
+ * Split a string to string array separated by " "
+ */
+ private static String[] split(String string) {
+ if (string == null) {
+ return new String[0];
+ }
+ String[] intents = string.split("[ ]+");
+ return intents;
+ }
+
+ private static List<IntentName> parseIntentName(String attributes) {
+ String[] intents = split(attributes);
+ List<IntentName> result = new ArrayList<IntentName>(intents.length);
+ for (String intent : intents) {
+ result.add(new IntentName(intent));
+ }
+ return result;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java
new file mode 100644
index 0000000000..41113d1da2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoader.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+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.LoaderRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.osoa.sca.annotations.Constructor;
+import org.w3c.dom.Element;
+
+/**
+ * Loads a property from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyLoader extends LoaderExtension<Property> {
+ public static final String PROPERTY_NAME_ATTR = "name";
+ public static final String PROPERTY_TYPE_ATTR = "type";
+ public static final String PROPERTY_ELEMENT_ATTR = "element";
+ public static final String PROPERTY_MANY_ATTR = "many";
+ public static final String PROPERTY_NO_DEFAULT_ATTR = "mustSupply";
+ public static final String DEFAULT_PREFIX = "xs";
+ public static final String DEFAULT_SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+ public static final char COLON = ':';
+
+ public static final QName PROPERTY = new QName(SCA_NS, "property");
+ private final DocumentBuilder documentBuilder;
+
+ @Constructor( {"registry"})
+ public PropertyLoader(@Autowire
+ LoaderRegistry registry) {
+ super(registry);
+ try {
+ documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ // we should be able to construct the default DocumentBuilder
+ throw new AssertionError(e);
+ }
+ }
+
+ public QName getXMLType() {
+ return PROPERTY;
+ }
+
+ public Property<?> load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext ctx) throws XMLStreamException,
+ PropertyLoaderException {
+ assert PROPERTY.equals(reader.getName());
+ String name = reader.getAttributeValue(null, PROPERTY_NAME_ATTR);
+ String typeName = reader.getAttributeValue(null, PROPERTY_TYPE_ATTR);
+ String elementName = reader.getAttributeValue(null, PROPERTY_ELEMENT_ATTR);
+ QName xmlElement = null;
+ QName xmlType = null;
+
+ if (typeName != null) {
+ int index = typeName.indexOf(COLON);
+ if (index != -1) {
+ String prefix = typeName.substring(0, index);
+ if (prefix == null || prefix.length() == 0) {
+ prefix = DEFAULT_PREFIX;
+ }
+
+ String localName = typeName.substring(index + 1);
+ String ns = reader.getNamespaceURI(prefix);
+ if (ns == null || ns.length() == 0) {
+ ns = DEFAULT_SCHEMA_NS;
+ }
+ xmlType = new QName(ns, localName, prefix);
+ }
+ } else if (elementName != null) {
+ int index = elementName.indexOf(COLON);
+ if (index != -1) {
+ String prefix = elementName.substring(0, index);
+ String localName = elementName.substring(index + 1);
+ String ns = reader.getNamespaceURI(prefix);
+ xmlElement = new QName(ns, localName, prefix);
+ // FIXME :
+ // need to figure out how to determine the xmltype from this
+ // xmlelement
+ // this need access to the global xml element thro
+ // schemalocation or thro
+ // artifact repository
+ xmlType = null;
+ }
+ }
+
+ if (xmlType == null && xmlElement == null) {
+ MissingTypePropertyLoaderException ex = new MissingTypePropertyLoaderException();
+ ex.setPropertyName(name);
+ ex.setLine(reader.getLocation().getLineNumber());
+ ex.setColumn(reader.getLocation().getColumnNumber());
+ throw ex;
+ }
+
+ boolean many = false;
+ boolean mustSupply = false;
+ String attrValue = null;
+ attrValue = reader.getAttributeValue(null, PROPERTY_MANY_ATTR);
+ if (attrValue != null) {
+ many = Boolean.parseBoolean(attrValue);
+ }
+
+ attrValue = reader.getAttributeValue(null, PROPERTY_NO_DEFAULT_ATTR);
+ if (attrValue != null) {
+ mustSupply = Boolean.parseBoolean(attrValue);
+ }
+
+ List<Element> defaultValues =
+ StaxUtil.createPropertyValues(reader, xmlType, xmlElement, many, documentBuilder);
+
+ if (mustSupply && defaultValues.size() > 0) {
+ DefaultPropertyValueLoaderException ex = new DefaultPropertyValueLoaderException();
+ ex.setPropertyName(name);
+ ex.setLine(reader.getLocation().getLineNumber());
+ ex.setColumn(reader.getLocation().getColumnNumber());
+ throw ex;
+ }
+
+ if (!many && defaultValues.size() > 1) {
+ ManyPropertyValueLoaderException ex = new ManyPropertyValueLoaderException();
+ ex.setPropertyName(name);
+ ex.setLine(reader.getLocation().getLineNumber());
+ ex.setColumn(reader.getLocation().getColumnNumber());
+ throw ex;
+ }
+
+ Property<?> property = new Property();
+ property.setName(name);
+ property.setXmlType(xmlType);
+ property.setXmlElement(xmlElement);
+ property.setMany(many);
+ property.setMustSupply(mustSupply);
+ property.setDefaultValues(defaultValues);
+ return property;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoaderException.java
new file mode 100644
index 0000000000..9e08396a68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/PropertyLoaderException.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.loader;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev: 487057 $ $Date: 2006-12-14 12:50:44 +0530 (Thu, 14 Dec 2006) $
+ */
+public class PropertyLoaderException extends LoaderException {
+
+ private String propertyName;
+
+ public PropertyLoaderException() {
+ super();
+ }
+
+ public PropertyLoaderException(String message) {
+ super(message);
+ }
+
+
+ protected PropertyLoaderException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public PropertyLoaderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected PropertyLoaderException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public PropertyLoaderException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + " in " + getPropertyName();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.java
new file mode 100644
index 0000000000..37acbcbf55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ReferenceLoader.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.loader;
+
+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 javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.util.ReferenceLoaderHelper;
+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.DuplicateReferenceNameException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityViolationException;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Loads a reference from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceLoader extends LoaderExtension<ComponentTypeReferenceDefinition> {
+ public static final String NAME_ATTR = "name";
+
+ public static final String MULTIPLICITY_ATTR = "multiplicity";
+
+ public static final String WIRED_BY_IMPL_ATTR = "wiredByImpl";
+
+ public static final String TARGET_ATTR = "target";
+
+ public static final String PROMOTE_ATTR = "promote";
+
+ public static final QName REFERENCE = new QName(SCA_NS, "reference");
+
+ @Constructor
+ public ReferenceLoader(@Autowire
+ LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return REFERENCE;
+ }
+
+ public ComponentTypeReferenceDefinition load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ if (object instanceof CompositeComponentType<?, ?, ?>) {
+ return loadCompositeReference(parent, object, reader, deploymentContext);
+ //return loadComponentType(parent, object, reader, deploymentContext);
+ } else {
+ return loadComponentTypeReference(parent, object, reader, deploymentContext);
+ }
+ }
+
+
+
+ public ComponentTypeReferenceDefinition loadComponentTypeReference(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+
+ assert REFERENCE.equals(reader.getName());
+ String name = reader.getAttributeValue(null, NAME_ATTR);
+ String multiplicityVal = reader.getAttributeValue(null, MULTIPLICITY_ATTR);
+ String wiredByImpl = reader.getAttributeValue(null, WIRED_BY_IMPL_ATTR);
+ String targets = reader.getAttributeValue(null, TARGET_ATTR);
+ Multiplicity multiplicity = StaxUtil.multiplicity(multiplicityVal, Multiplicity.ONE_ONE);
+
+
+
+ ComponentType<?, ?, ?> componentType = (ComponentType<?, ?, ?>)object;
+ if ( componentType.getReferences().get(name) != null) {
+ throw new DuplicateReferenceNameException(name,
+ DuplicateReferenceNameException.COMPONENT_TYPE,
+ "");
+ }
+ ComponentTypeReferenceDefinition referenceDefinition = new ComponentTypeReferenceDefinition();
+ referenceDefinition.setName(name);
+ referenceDefinition.setMultiplicity(multiplicity);
+ referenceDefinition.setName(name);
+ referenceDefinition.setWiredByImpl(Boolean.parseBoolean(wiredByImpl));
+
+ if (targets != null && targets.length() > 0 )
+ ReferenceLoaderHelper.populateRefTargets(referenceDefinition, targets);
+
+ /*if (!ReferenceLoaderHelper.validateMultiplicityAndTargets(multiplicity, referenceDefinition
+ .getTargets())) {
+ throw new ReferenceMultiplicityViolationException(name, multiplicity, referenceDefinition.getTargets().size());
+ }*/
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject o = registry.load(parent, null, reader, deploymentContext);
+ if (o instanceof ServiceContract) {
+ referenceDefinition.setServiceContract((ServiceContract)o);
+ } else if (o instanceof BindingDefinition) {
+ referenceDefinition.addBinding((BindingDefinition)o);
+ } else {
+ throw new UnrecognizedElementException(reader.getName());
+ }
+ break;
+ case END_ELEMENT:
+ return referenceDefinition;
+ }
+ }
+ }
+
+ public CompositeReferenceDefinition loadCompositeReference(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+
+ String name = reader.getAttributeValue(null, NAME_ATTR);
+ String multiplicityVal = reader.getAttributeValue(null, MULTIPLICITY_ATTR);
+ String wiredByImpl = reader.getAttributeValue(null, WIRED_BY_IMPL_ATTR);
+ String targets = reader.getAttributeValue(null, TARGET_ATTR);
+ String promotedComponentRefs = reader.getAttributeValue(null, PROMOTE_ATTR);
+ //if multiplicity is not set, it will be derived in the composite loader by looking
+ //at the multiplicity of all promoted references - which can be done only after the composite
+ //is completelly loaded
+ Multiplicity multiplicity = StaxUtil.multiplicity(multiplicityVal, null);
+
+
+ CompositeComponentType<?, ?, ?> compositeCompType = (CompositeComponentType<?, ?, ?>)object;
+ if ( compositeCompType.getDeclaredReferences().get(name) != null) {
+ throw new DuplicateReferenceNameException(name,
+ DuplicateReferenceNameException.COMPOSITE,
+ compositeCompType.getName());
+ }
+ CompositeReferenceDefinition referenceDefinition = new CompositeReferenceDefinition();
+ referenceDefinition.setName(name);
+ referenceDefinition.setMultiplicity(multiplicity);
+
+ if (promotedComponentRefs != null && promotedComponentRefs.length() > 0) {
+ ReferenceLoaderHelper.populatePromotedRefs(referenceDefinition, promotedComponentRefs);
+ }
+
+ if (targets != null && targets.length() > 0 )
+ ReferenceLoaderHelper.populateRefTargets(referenceDefinition, targets);
+
+ referenceDefinition.setWiredByImpl(Boolean.parseBoolean(wiredByImpl));
+
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ ModelObject o = registry.load(parent, null, reader, deploymentContext);
+ if (o instanceof ServiceContract) {
+ referenceDefinition.setServiceContract((ServiceContract)o);
+ } else if (o instanceof BindingDefinition) {
+ referenceDefinition.addBinding((BindingDefinition)o);
+ } else {
+ throw new UnrecognizedElementException(reader.getName());
+ }
+ break;
+ case END_ELEMENT:
+ return referenceDefinition;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java
new file mode 100644
index 0000000000..a365a281b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.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.core.loader;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+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.InvalidReferenceException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Loads a service definition from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceLoader extends LoaderExtension<ServiceDefinition> {
+ private static final QName SERVICE = new QName(SCA_NS, "service");
+ private static final QName REFERENCE = new QName(SCA_NS, "reference");
+
+ @Constructor
+ public ServiceLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return SERVICE;
+ }
+
+ public ServiceDefinition load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert SERVICE.equals(reader.getName());
+ String name = reader.getAttributeValue(null, "name");
+ String target = null;
+ ServiceDefinition def = new ServiceDefinition();
+ def.setName(name);
+ while (true) {
+ int i = reader.next();
+ switch (i) {
+ case START_ELEMENT:
+ // there is a reference already using this qname which doesn't seem appropriate.
+ if (REFERENCE.equals(reader.getName())) {
+ String text = reader.getElementText();
+ target = text != null ? text.trim() : null;
+ } else {
+ ModelObject o = registry.load(parent, null, reader, deploymentContext);
+ if (o instanceof ServiceContract) {
+ def.setServiceContract((ServiceContract) o);
+ } else if (o instanceof BindingDefinition) {
+ def.addBinding((BindingDefinition) o);
+ } else {
+ throw new UnrecognizedElementException(reader.getName());
+ }
+ }
+ break;
+ case END_ELEMENT:
+ if (SERVICE.equals(reader.getName())) {
+ if (target != null) {
+ try {
+ def.setTarget(new URI(target));
+ } catch (URISyntaxException e) {
+ throw new InvalidReferenceException(target, name);
+ }
+ }
+ return def;
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java
new file mode 100644
index 0000000000..965dbcf8d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/StringParserPropertyFactory.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.core.injection.SingletonListObjectFactory;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+/**
+ * Implementation of StAXPropertyFactory that interprets the XML as
+ *
+ * @version $Rev$ $Date$
+ */
+public class StringParserPropertyFactory implements PropertyObjectFactory {
+
+ public <T> ObjectFactory<T> createObjectFactory(Property<T> property, PropertyValue<T> value)
+ throws LoaderException {
+ String text = value.getValue().get(0).getTextContent();
+ return new SingletonObjectFactory<T>(createInstance(text, property.getJavaType()));
+ }
+
+ public <T> ObjectFactory<List<T>> createListObjectFactory(Property<T> property, PropertyValue<T> value)
+ throws LoaderException {
+ String text = null;
+ List<T> instances = new ArrayList<T>();
+ for (int count = 0 ; count < value.getValue().size() ; ++count) {
+ text = value.getValue().get(count).getTextContent();
+ instances.add(createInstance(text, property.getJavaType()));
+ }
+ return new SingletonListObjectFactory<T>(instances);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T createInstance(String text, Class<T> type) throws LoaderException {
+ // Class<T> type = property.getJavaType();
+ assert type != null : "property type is null";
+
+ // degenerate case where property type is a String
+ if (String.class.equals(type)) {
+ return type.cast(text);
+ }
+
+ // special handler to convert hexBinary to a byte[]
+ if (byte[].class.equals(type)) {
+ byte[] instance = new byte[text.length() >> 1];
+ for (int i = 0; i < instance.length; i++) {
+ instance[i] =
+ (byte) (Character.digit(text.charAt(i << 1), 16) << 4 | Character.digit(text
+ .charAt((i << 1) + 1), 16));
+ }
+ return type.cast(instance);
+ }
+
+ // does this type have a static valueOf(String) method?
+ try {
+ Method valueOf = type.getMethod("valueOf", String.class);
+ if (Modifier.isStatic(valueOf.getModifiers())) {
+ try {
+ return type.cast(valueOf.invoke(null, text));
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("getMethod returned an inaccessible method");
+ } catch (InvocationTargetException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e.getCause());
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ // try something else
+ }
+
+ // does this type have a constructor that takes a String?
+ try {
+ Constructor<T> ctr = type.getConstructor(String.class);
+ return ctr.newInstance(text);
+ } catch (NoSuchMethodException e) {
+ // try something else
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("getConstructor returned an inaccessible method");
+ } catch (InstantiationException e) {
+ throw new LoaderException("Property type cannot be instantiated: " + type.getName());
+ } catch (InvocationTargetException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e.getCause());
+ }
+
+ // do we have a property editor for it?
+ PropertyEditor editor = PropertyEditorManager.findEditor(type);
+ if (editor != null) {
+ try {
+ editor.setAsText(text);
+ return (T) editor.getValue();
+ } catch (IllegalArgumentException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e);
+
+ }
+ }
+
+ // FIXME we should throw something better
+ throw new LoaderException("Do not have a way to parse a String into a " + type.getName());
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> ObjectFactory<T> createObjectFactory(String text, Property<T> property)
+ throws XMLStreamException, LoaderException {
+ Class<T> type = property.getJavaType();
+ assert type != null : "property type is null";
+
+ // degenerate case where property type is a String
+ if (String.class.equals(type)) {
+ return new SingletonObjectFactory<T>(type.cast(text));
+ }
+
+ // special handler to convert hexBinary to a byte[]
+ if (byte[].class.equals(type)) {
+ byte[] instance = new byte[text.length() >> 1];
+ for (int i = 0; i < instance.length; i++) {
+ instance[i] =
+ (byte) (Character.digit(text.charAt(i << 1), 16) << 4 | Character.digit(text
+ .charAt((i << 1) + 1), 16));
+ }
+ return new SingletonObjectFactory<T>(type.cast(instance));
+ }
+
+ // does this type have a static valueOf(String) method?
+ try {
+ Method valueOf = type.getMethod("valueOf", String.class);
+ if (Modifier.isStatic(valueOf.getModifiers())) {
+ try {
+ return new SingletonObjectFactory<T>(type.cast(valueOf.invoke(null, text)));
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("getMethod returned an inaccessible method");
+ } catch (InvocationTargetException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e.getCause());
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ // try something else
+ }
+
+ // does this type have a constructor that takes a String?
+ try {
+ Constructor<T> ctr = type.getConstructor(String.class);
+ return new SingletonObjectFactory<T>(ctr.newInstance(text));
+ } catch (NoSuchMethodException e) {
+ // try something else
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("getConstructor returned an inaccessible method");
+ } catch (InstantiationException e) {
+ throw new LoaderException("Property type cannot be instantiated: " + type.getName());
+ } catch (InvocationTargetException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e.getCause());
+ }
+
+ // do we have a property editor for it?
+ PropertyEditor editor = PropertyEditorManager.findEditor(type);
+ if (editor != null) {
+ try {
+ editor.setAsText(text);
+ return new SingletonObjectFactory<T>((T) editor.getValue());
+ } catch (IllegalArgumentException e) {
+ // FIXME we should throw something better
+ throw new LoaderException(e);
+
+ }
+ }
+
+ // FIXME we should throw something better
+ throw new LoaderException("Do not have a way to parse a String into a " + type.getName());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/WireLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/WireLoader.java
new file mode 100644
index 0000000000..c6863ec140
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/WireLoader.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+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.InvalidWireException;
+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.model.WireDefinition;
+
+/**
+ * Loads a wire from an XML-based assembly file
+ *
+ * @version $Rev: 465084 $ $Date: 2006-10-18 04:00:49 +0530 (Wed, 18 Oct 2006) $
+ */
+public class WireLoader extends LoaderExtension<WireDefinition> {
+ private static final QName WIRE = new QName(SCA_NS, "wire");
+ private static final QName SOURCE_URI = new QName(SCA_NS, "source.uri");
+ private static final QName TARGET_URI = new QName(SCA_NS, "target.uri");
+
+ @Constructor({"registry"})
+ public WireLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return WIRE;
+ }
+
+ public WireDefinition load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert WIRE.equals(reader.getName());
+ WireDefinition wireDefn;
+ URI sourceURI = null;
+ URI targetURI = null;
+ String uriString;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ try {
+ if (reader.getName().equals(SOURCE_URI)) {
+ uriString = reader.getElementText();
+ if (uriString != null && uriString.trim().length() > 0) {
+ sourceURI = new URI(uriString);
+ } else {
+ throw new InvalidWireException("Wire source not defined");
+ }
+ } else if (reader.getName().equals(TARGET_URI)) {
+ uriString = reader.getElementText();
+ if (uriString != null && uriString.trim().length() > 0) {
+ targetURI = new URI(uriString);
+ } else {
+ throw new InvalidWireException("Wire target not defined");
+ }
+ } else {
+ QName name = reader.getName();
+ throw new InvalidWireException("Unrecognized element in wire ", name.toString());
+ }
+ } catch (URISyntaxException e) {
+ throw new InvalidWireException("Invalid wire uri", e);
+ }
+
+ reader.next();
+ break;
+ case END_ELEMENT:
+ if (reader.getName().equals(WIRE)) {
+ if (sourceURI != null && targetURI != null) {
+ wireDefn = new WireDefinition();
+ wireDefn.setSource(sourceURI);
+ wireDefn.setTarget(targetURI);
+ } else {
+ throw new InvalidWireException("Incomplete wire definition");
+ }
+ return wireDefn;
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java
new file mode 100644
index 0000000000..b1510b67e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/ComponentDefinitionMarshaller.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.marshaller;
+
+import static javax.xml.stream.XMLStreamConstants.END_DOCUMENT;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.marshaller.MarshalException;
+import org.apache.tuscany.spi.marshaller.ModelMarshaller;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+
+/**
+ * Marshaller used for marshalling and unmarshalling component definition.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class ComponentDefinitionMarshaller implements ModelMarshaller<ComponentDefinition<?>> {
+
+ /**
+ * Marshalls the component definition object to the specified stream writer.
+ *
+ * @param modelObject Component definition object to be serialized.
+ * @param writer Stream writer to which the infoset is serialized.
+ * @throws MarshalException In case of any marshalling error.
+ */
+ public void marshall(ComponentDefinition<?> modelObject, XMLStreamWriter writer) throws MarshalException {
+
+ try {
+ writer.writeStartDocument();
+ writer.writeEndDocument();
+ } catch (XMLStreamException ex) {
+ throw new MarshalException(ex);
+ }
+
+ }
+
+ /**
+ * Unmarshalls the component definition object from an XML stream.
+ *
+ * @param reader XML stream from where the marshalled XML is read.
+ * @param upconvert Whether to upconvert the object is the current runtime
+ * supports a higher version of the model object.
+ * @return Hydrated component definition object.
+ * @throws MarshalException In case of any unmarshalling error.
+ */
+ public ComponentDefinition<?> unmarshall(XMLStreamReader reader, boolean upconvert) throws MarshalException {
+ try {
+ while (true) {
+ ComponentDefinition<?> definition = null;
+ switch (reader.next()) {
+ case END_DOCUMENT:
+ return definition;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new MarshalException(ex);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.java
new file mode 100644
index 0000000000..686c74c7f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatter.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.monitor;
+
+import java.io.PrintWriter;
+
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.api.TuscanyRuntimeException;
+import org.apache.tuscany.host.monitor.ExceptionFormatter;
+
+/**
+ * Performs basics formatting of exceptions for JDK logging
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultExceptionFormatter implements ExceptionFormatter {
+
+ public DefaultExceptionFormatter() {
+ }
+
+ public boolean canFormat(Class<?> type) {
+ return Throwable.class.isAssignableFrom(type);
+ }
+
+ public PrintWriter write(PrintWriter writer, Throwable exception) {
+ if (exception instanceof TuscanyException) {
+ TuscanyException e = (TuscanyException) exception;
+ e.appendContextStack(e.appendBaseMessage(writer));
+ } else if (exception instanceof TuscanyRuntimeException) {
+ TuscanyRuntimeException e = (TuscanyRuntimeException) exception;
+ e.appendContextStack(e.appendBaseMessage(writer));
+ }
+ 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/monitor/InvalidLevelException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.java
new file mode 100644
index 0000000000..cf07b0f914
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/InvalidLevelException.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.core.monitor;
+
+/**
+ * Exception indicating an invalid log level has been passed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidLevelException extends IllegalArgumentException {
+ private static final long serialVersionUID = 7767234706427841915L;
+ private final String method;
+ private final String level;
+
+ /**
+ * Constructor specifying the method name and the level affected.
+ *
+ * @param method the name of the method being monitored
+ * @param level the invalid log level value
+ */
+ public InvalidLevelException(String method, String level) {
+ super();
+ this.method = method;
+ this.level = level;
+ }
+
+ /**
+ * Returns the name of the method being monitored.
+ *
+ * @return the name of the method being monitored
+ */
+ public String getMethod() {
+ return method;
+ }
+
+ /**
+ * Returns the invalid log level specified.
+ *
+ * @return the invalid log level that was specified
+ */
+ public String getLevel() {
+ return level;
+ }
+
+ public String getMessage() {
+ return "Invalid level for method " + method + " : " + level;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
new file mode 100644
index 0000000000..019dcbdcd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
@@ -0,0 +1,321 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.monitor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.monitor.ExceptionFormatter;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+
+/**
+ * A factory for monitors that forwards events to a {@link java.util.logging.Logger Java Logging (JSR47) Logger}.
+ *
+ * @version $Rev$ $Date$
+ * @see java.util.logging
+ */
+@Service(interfaces = {MonitorFactory.class, FormatterRegistry.class})
+public class JavaLoggingMonitorFactory implements MonitorFactory, FormatterRegistry {
+ private String bundleName;
+ private Level defaultLevel;
+ private Map<String, Level> levels;
+ private List<ExceptionFormatter> formatters = new ArrayList<ExceptionFormatter>();
+ private ExceptionFormatter defaultFormatter = new DefaultExceptionFormatter();
+ private Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
+
+ /**
+ * Construct a MonitorFactory that will monitor the specified methods at the specified levels and generate messages
+ * using java.util.logging.
+ * <p/>
+ * The supplied Properties can be used to specify custom log levels for specific monitor methods. The key should be
+ * the method name in form returned by <code>Class.getName() + '#' + Method.getName()</code> and the value the log
+ * level to use as defined by {@link java.util.logging.Level}.
+ *
+ * @param levels definition of custom levels for specific monitored methods, may be null or empty.
+ * @param defaultLevel the default log level to use
+ * @param bundleName the name of a resource bundle that will be passed to the logger
+ * @see java.util.logging.Logger
+ */
+ public JavaLoggingMonitorFactory(Properties levels, Level defaultLevel, String bundleName) {
+ Map<String, Object> configProperties = new HashMap<String, Object>();
+ configProperties.put("levels", levels);
+ configProperties.put("defaultLevel", defaultLevel);
+ configProperties.put("bundleName", bundleName);
+ initInternal(configProperties);
+ }
+
+ /**
+ * Constructs a MonitorFactory that needs to be subsequently configured via a call to {@link #initialize}.
+ */
+ public JavaLoggingMonitorFactory() {
+ }
+
+ public void initialize(Map<String, Object> configProperties) {
+ if (configProperties == null) {
+ return;
+ }
+ initInternal(configProperties);
+ }
+
+ private void initInternal(Map<String, Object> configProperties) {
+ try {
+ this.defaultLevel = (Level) configProperties.get("defaultLevel");
+ this.bundleName = (String) configProperties.get("bundleName");
+ Properties levels = (Properties) configProperties.get("levels");
+
+ this.levels = new HashMap<String, Level>();
+ if (levels != null) {
+ for (Map.Entry<Object, Object> entry : levels.entrySet()) {
+ String method = (String) entry.getKey();
+ String level = (String) entry.getValue();
+ try {
+ this.levels.put(method, Level.parse(level));
+ } catch (IllegalArgumentException e) {
+ throw new InvalidLevelException(method, level);
+ }
+ }
+ }
+ } catch (ClassCastException cce) {
+ throw new IllegalArgumentException(cce.getLocalizedMessage());
+ }
+ }
+
+ public synchronized <T> T getMonitor(Class<T> monitorInterface) {
+ T proxy = getCachedMonitor(monitorInterface);
+ if (proxy == null) {
+ proxy = createMonitor(monitorInterface, bundleName);
+ proxies.put(monitorInterface, new WeakReference<T>(proxy));
+ }
+ return proxy;
+ }
+
+ private <T> T getCachedMonitor(Class<T> monitorInterface) {
+ WeakReference<?> ref = proxies.get(monitorInterface);
+ return (ref != null) ? monitorInterface.cast(ref.get()) : null;
+ }
+
+ private <T> T createMonitor(Class<T> monitorInterface, String bundleName) {
+ String className = monitorInterface.getName();
+ Logger logger = Logger.getLogger(className);
+ Method[] methods = monitorInterface.getMethods();
+ Map<String, Level> levels = new HashMap<String, Level>(methods.length);
+ for (Method method : methods) {
+ String key = className + '#' + method.getName();
+ Level level = null;
+ if (this.levels != null) {
+ this.levels.get(key);
+ }
+ // if not specified the in config properties, look for an annotation on the method
+ if (level == null) {
+ LogLevel annotation = method.getAnnotation(LogLevel.class);
+ if (annotation != null && annotation.value() != null) {
+ try {
+ level = Level.parse(annotation.value());
+ } catch (IllegalArgumentException e) {
+ // bad value, just use the default
+ level = defaultLevel;
+ }
+ }
+ }
+ if (level == null) {
+ level = defaultLevel;
+ }
+ levels.put(method.getName(), level);
+ }
+
+ ResourceBundle bundle = locateBundle(monitorInterface, bundleName);
+
+ InvocationHandler handler = new LoggingHandler(logger, levels, bundle, formatters, defaultFormatter);
+ return monitorInterface
+ .cast(Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler));
+ }
+
+ private static <T> ResourceBundle locateBundle(Class<T> monitorInterface, String bundleName) {
+ Locale locale = Locale.getDefault();
+ ClassLoader cl = monitorInterface.getClassLoader();
+ String packageName = monitorInterface.getPackage().getName();
+ while (true) {
+ try {
+ return ResourceBundle.getBundle(packageName + '.' + bundleName, locale, cl);
+ } catch (MissingResourceException e) {
+ //ok
+ }
+ int index = packageName.lastIndexOf('.');
+ if (index == -1) {
+ break;
+ }
+ packageName = packageName.substring(0, index);
+ }
+ try {
+ return ResourceBundle.getBundle(bundleName, locale, cl);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public void register(ExceptionFormatter formatter) {
+ formatters.add(formatter);
+ }
+
+ public void unregister(ExceptionFormatter formatter) {
+ formatters.remove(formatter);
+ }
+
+ private static final class LoggingHandler implements InvocationHandler {
+ private final Logger logger;
+ private final Map<String, Level> methodLevels;
+ private final ResourceBundle bundle;
+ private List<ExceptionFormatter> formatters;
+ private ExceptionFormatter defaultFormatter;
+
+ public LoggingHandler(Logger logger,
+ Map<String, Level> methodLevels,
+ ResourceBundle bundle,
+ List<ExceptionFormatter> formatters,
+ ExceptionFormatter defaultFormatter) {
+ this.logger = logger;
+ this.methodLevels = methodLevels;
+ this.bundle = bundle;
+ this.formatters = formatters;
+ this.defaultFormatter = defaultFormatter;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ String sourceMethod = method.getName();
+ Level level = methodLevels.get(sourceMethod);
+ if (level != null && logger.isLoggable(level)) {
+ // construct the key for the resource bundle
+ String className = logger.getName();
+ String key = className + '#' + sourceMethod;
+
+ LogRecord logRecord = new LogRecord(level, key);
+ logRecord.setLoggerName(className);
+ logRecord.setSourceClassName(className);
+ logRecord.setSourceMethodName(sourceMethod);
+ logRecord.setParameters(args);
+ if (args != null) {
+ for (Object o : args) {
+ if (o instanceof Throwable) {
+ Throwable e = (Throwable) o;
+ ExceptionFormatter formatter = null;
+ for (ExceptionFormatter candidate : formatters) {
+ if (candidate.canFormat(e.getClass())) {
+ formatter = candidate;
+ break;
+ }
+ }
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ if (formatter != null) {
+ formatter.write(pw, e);
+ } else {
+ defaultFormatter.write(pw, e);
+ }
+ format(pw, e);
+ pw.close();
+ logRecord.setMessage(writer.toString());
+ break;
+ }
+ }
+ }
+ logRecord.setResourceBundle(bundle);
+ logger.log(logRecord);
+ }
+ return null;
+ }
+
+ private void format(PrintWriter writer, Throwable throwable) {
+ writer.println(throwable.getClass().getName());
+ StackTraceElement[] trace = throwable.getStackTrace();
+ for (StackTraceElement aTrace : trace) {
+ writer.println("\tat " + aTrace);
+ }
+ Throwable ourCause = throwable.getCause();
+
+ if (ourCause != null) {
+ printStackTraceAsCause(writer, ourCause, trace);
+ }
+ }
+
+ private void printStackTraceAsCause(PrintWriter pw,
+ Throwable throwable,
+ StackTraceElement[] causedTrace) {
+
+ // Compute number of frames in common between this and caused
+ StackTraceElement[] trace = throwable.getStackTrace();
+ int m = trace.length - 1;
+ int n = causedTrace.length - 1;
+ while (m >= 0 && n >= 0 && trace[m].equals(causedTrace[n])) {
+ m--;
+ n--;
+ }
+ int framesInCommon = trace.length - 1 - m;
+
+ pw.println("Caused by: " + throwable.getClass().getName());
+
+ ExceptionFormatter formatter = null;
+ for (ExceptionFormatter candidate : formatters) {
+ if (candidate.canFormat(throwable.getClass())) {
+ formatter = candidate;
+ break;
+ }
+ }
+ if (formatter != null) {
+ formatter.write(pw, throwable);
+ } else {
+ defaultFormatter.write(pw, throwable);
+ }
+
+
+ for (int i = 0; i <= m; i++) {
+ pw.println("\tat " + trace[i]);
+ }
+ if (framesInCommon != 0) {
+ pw.println("\t... " + framesInCommon + " more");
+ }
+
+ // Recurse if we have a cause
+ Throwable ourCause = throwable.getCause();
+ if (ourCause != null) {
+ printStackTraceAsCause(pw, ourCause, trace);
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.java
new file mode 100644
index 0000000000..92224d469f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/MonitorFactoryUtil.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.monitor;
+
+import org.apache.tuscany.host.MonitorFactory;
+
+import java.util.Map;
+
+/**
+ * Helper for creating MonitorFactory instances.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public final class MonitorFactoryUtil {
+ /**
+ * Hide the constructor
+ */
+ private MonitorFactoryUtil() {
+ }
+
+ /**
+ * Creates a MonitorFactory instance of the specified type.
+ * @param name fully qualified classname of the desired MonitorFactory type
+ * @param props collection of initialization properties
+ * @return a configured MonitorFactory instance, or null if the factory could not be instantiated.
+ */
+ @SuppressWarnings("unchecked")
+ public static MonitorFactory createMonitorFactory(String name, Map<String, Object> props) {
+ Class<? extends MonitorFactory> clazz;
+ try {
+ clazz = (Class<? extends MonitorFactory>) Class.forName(name);
+ } catch (ClassNotFoundException cnfe) {
+ return null;
+ } catch (ClassCastException cce) {
+ return null;
+ }
+
+ return createMonitorFactory(clazz, props);
+ }
+
+ /**
+ * Creates a MonitorFactory instance of the specified type.
+ * @param mfc class of the desired MonitorFactory type
+ * @param props collection of initialization properties
+ * @return a configured MonitorFactory instance, or null if the factory could not be instantiated.
+ */
+ public static MonitorFactory createMonitorFactory(Class<? extends MonitorFactory> mfc, Map<String, Object> props) {
+ MonitorFactory mf;
+ try {
+ mf = mfc.newInstance();
+ mf.initialize(props);
+ } catch (InstantiationException e) {
+ throw new AssertionError(e);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError(e);
+ }
+ // allow IllegalArgumentException to propogate out
+
+ return mf;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java
new file mode 100644
index 0000000000..8ba3053c2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.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.monitor;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.host.MonitorFactory;
+
+/**
+ * Implementation of a {@link MonitorFactory} that produces implementations that simply return.
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class NullMonitorFactory implements MonitorFactory {
+ /**
+ * Singleton wire hander that does nothing.
+ */
+ private static final InvocationHandler NULL_MONITOR = new InvocationHandler() {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ return null;
+ }
+ };
+
+ public void initialize(Map<String, Object> configProperties) {
+ }
+
+ public <T> T getMonitor(Class<T> monitorInterface) {
+ /*
+ * This uses a reflection proxy to implement the monitor interface which
+ * is a simple but perhaps not very performant solution. Performance
+ * might be improved by code generating an implementation with empty methods.
+ */
+ return monitorInterface.cast(
+ Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, NULL_MONITOR));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java
new file mode 100644
index 0000000000..5ea24e4c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+
+/**
+ * The default implementation of a data intent registry
+ */
+public class IntentRegistryImpl implements IntentRegistry {
+ private final Map<IntentName, IntentEntry> intentRepo = new HashMap<IntentName, IntentEntry>();
+
+ public Collection<IntentName> getQualifiedIntents(final IntentName qualifiable, final QName artifact) {
+ List<IntentName> result = new ArrayList<IntentName>();
+ for (IntentName intentName : intentRepo.keySet()) {
+ if (intentRepo.get(intentName).getAppliedArtifacts().contains(artifact)
+ && PolicyHelper.isQualifiedIntentFor(intentName, qualifiable, true)) {
+ result.add(intentName);
+ }
+ }
+ return result;
+ }
+
+ public Collection<IntentName> inlineProfileIntent(final Collection<IntentName> intentNameList,
+ final QName artifact) {
+
+ return getConcretIntentsInternal(intentNameList, artifact);
+ }
+
+ private Collection<IntentName> getConcretIntentsInternal(final Collection<IntentName> intentNameList,
+ QName artifact) {
+ List<IntentName> result = new ArrayList<IntentName>();
+ for (IntentName intentName : intentNameList) {
+ IntentEntry intentEntry = intentRepo.get(intentName);
+ if (!intentEntry.isProfileIntent()) {
+ if (intentEntry.getAppliedArtifacts().contains(artifact)) {
+ result.add(intentEntry.getName());
+ }
+ } else {
+ result.addAll(getConcretIntentsInternal(intentEntry.getRequriedIntents(), artifact));
+ }
+ }
+ return result;
+ }
+
+ public boolean isApplicable(IntentName intentName, QName artifact) {
+ if (intentRepo.containsKey(intentName)) {
+ return intentRepo.get(intentName).getAppliedArtifacts().contains(artifact);
+ }
+ return false;
+ }
+
+ public void register(Intent intent) {
+
+ IntentEntry entry = new IntentEntry(intent);
+ // if the qualified intents have been registered, make the intent qualifiable(unqualified)
+ if (!getQualifiedIntents(intent.getName()).isEmpty()) {
+ entry.setQualified(false);
+ }
+ intentRepo.put(intent.getName(), entry);
+ List<IntentName> qualifiables = getAllQualifiableIntent(intent.getName());
+ // set qualifiable intent of this intent unqualified
+ for (IntentName qualifiable : qualifiables) {
+ IntentEntry qualifiableEntry = intentRepo.get(qualifiable);
+ qualifiableEntry.setQualified(false);
+ for (QName artifact : intent.getAppliedArtifacts()) {
+ qualifiableEntry.addAppliedArtifacts(artifact);
+ }
+ }
+ }
+
+ public void unRegister(Intent intent) {
+ if (intentRepo.containsKey(intent.getName())) {
+ IntentEntry intentEntry = intentRepo.get(intent.getName());
+ List<QName> appliedArtifacts = intent.getAppliedArtifacts();
+ for (QName artifact : appliedArtifacts) {
+ if (intentEntry.getAppliedArtifacts().contains(artifact)) {
+ intentEntry.removeappliedArtifact(artifact);
+ }
+ }
+ if (intentEntry.getAppliedArtifacts().isEmpty()) {
+ intentRepo.remove(intent.getName());
+ }
+ }
+ }
+
+ public boolean isQualifiedIntent(IntentName name) {
+ IntentEntry intentEntry = intentRepo.get(name);
+ return intentEntry.isQualified();
+ }
+
+ private List<IntentName> getQualifiedIntents(final IntentName qualifiable) {
+ List<IntentName> result = new ArrayList<IntentName>();
+ for (IntentName intentName : intentRepo.keySet()) {
+ if (PolicyHelper.isQualifiedIntentFor(intentName, qualifiable, true)) {
+ result.add(intentName);
+ }
+ }
+ return result;
+ }
+
+ private List<IntentName> getAllQualifiableIntent(final IntentName qualified) {
+
+ List<IntentName> result = new ArrayList<IntentName>();
+ for (IntentName intentName : intentRepo.keySet()) {
+ if (PolicyHelper.isQualifiedIntentFor(qualified, intentName, false)) {
+ result.add(intentName);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Wrapper class for intent used internally
+ */
+ private static final class IntentEntry extends Intent {
+
+ /**
+ * Whether this intent is qualified, defaults to true
+ */
+ private boolean isQualified = true;
+
+ private IntentEntry(Intent intent) {
+ super(intent.getName(), intent.getDescription());
+ appliedArtifacts.addAll(intent.getAppliedArtifacts());
+ requriedIntents.addAll(intent.getRequriedIntents());
+ }
+
+ public boolean isQualified() {
+ return isQualified;
+ }
+
+ public void setQualified(boolean isQualified) {
+ this.isQualified = isQualified;
+ }
+
+ public void removeappliedArtifact(QName artifact) {
+ appliedArtifacts.remove(artifact);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java
new file mode 100644
index 0000000000..94703f6abf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.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.core.policy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
+import org.apache.tuscany.spi.policy.SourcePolicyBuilder;
+import org.apache.tuscany.spi.policy.TargetPolicyBuilder;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * The default policy builder
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyBuilderRegistryImpl implements PolicyBuilderRegistry {
+
+ private final List<List<SourcePolicyBuilder>> sourceBuilders;
+ private final List<List<TargetPolicyBuilder>> targetBuilders;
+
+ public PolicyBuilderRegistryImpl() {
+ sourceBuilders = new ArrayList<List<SourcePolicyBuilder>>();
+ targetBuilders = new ArrayList<List<TargetPolicyBuilder>>();
+ for (int i = 0; i <= FINAL; i++) {
+ sourceBuilders.add(new ArrayList<SourcePolicyBuilder>());
+ targetBuilders.add(new ArrayList<TargetPolicyBuilder>());
+ }
+ }
+
+ public void registerTargetBuilder(int phase, TargetPolicyBuilder builder) {
+ assert INITIAL <= phase && phase <= FINAL : "Illegal phase";
+ targetBuilders.get(phase).add(builder);
+ }
+
+ public void registerSourceBuilder(int phase, SourcePolicyBuilder builder) {
+ assert INITIAL <= phase && phase <= FINAL : "Illegal phase";
+ sourceBuilders.get(phase).add(builder);
+ }
+
+
+ public void buildSource(AbstractReferenceDefinition referenceDefinition, OutboundWire wire) throws BuilderException {
+ for (List<SourcePolicyBuilder> builders : sourceBuilders) {
+ for (SourcePolicyBuilder builder : builders) {
+ builder.build(referenceDefinition, wire);
+ }
+ }
+ }
+
+ public void buildTarget(ServiceDefinition serviceDefinition, InboundWire wire) throws BuilderException {
+ for (List<TargetPolicyBuilder> builders : targetBuilders) {
+ for (TargetPolicyBuilder builder : builders) {
+ builder.build(serviceDefinition, wire);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyEngineImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyEngineImpl.java
new file mode 100644
index 0000000000..308e43c038
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyEngineImpl.java
@@ -0,0 +1,297 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.IntentMap;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.model.PolicyContentModel;
+import org.apache.tuscany.spi.model.PolicyModel;
+import org.apache.tuscany.spi.model.PolicySet;
+import org.apache.tuscany.spi.model.PolicySetReference;
+import org.apache.tuscany.spi.model.Qualifier;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+import org.apache.tuscany.spi.policy.PolicyEngine;
+import org.apache.tuscany.spi.policy.PolicySetContainer;
+import org.apache.tuscany.spi.policy.SCATypeManager;
+
+/**
+ * Default implementation of a polciy engine
+ */
+public class PolicyEngineImpl implements PolicyEngine {
+ private final IntentRegistry intentRegistry;
+ private final PolicySetContainer policySetContainer;
+ private final SCATypeManager scaTypeManager;
+
+ public PolicyEngineImpl(IntentRegistry intentRegistry,
+ PolicySetContainer policySetContainer,
+ SCATypeManager scaTypeManager) {
+ this.intentRegistry = intentRegistry;
+ this.policySetContainer = policySetContainer;
+ this.scaTypeManager = scaTypeManager;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<PolicyModel> getPolicy(final IntentName[] requires,
+ final QName[] policySetNames,
+ final QName artifactType) {
+ if (requires == null || requires.length == 0) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection<PolicyModel> result = new ArrayList<PolicyModel>();
+ Collection<IntentName> requiredIntents = java.util.Arrays.asList(requires);
+ Collection<IntentName> matchings;
+
+ //handle profile intents
+ requiredIntents = intentRegistry.inlineProfileIntent(requiredIntents, artifactType);
+ //
+ if (policySetNames != null && policySetNames.length != 0) {
+ Collection<PolicySet> explicitPolicySet = getExplicitPolicySet(policySetNames);
+ matchings = calculateExplicitPolicySet(requiredIntents, explicitPolicySet, artifactType, result);
+ //remove satisfied intent
+ requiredIntents.removeAll(matchings);
+ }
+ //
+ if (requiredIntents.size() > 0) {
+ matchings = findingAdditionalMatching(requiredIntents, artifactType, result);
+ requiredIntents.removeAll(matchings);
+ }
+ //If no collection of policySets covers all required intents, the configuration is not valid.
+ if (requiredIntents.size() > 0) {
+ //TODO
+ }
+ return result;
+ }
+
+
+ private boolean introspectPolicySet(PolicySet policySet, IntentName intent, QName artifactType,
+ Collection<PolicyModel> matchings) {
+ Collection<QName> appliedArtifacts = policySet.getAppliedArtifacts();
+ boolean provide = false;
+ for (QName name : appliedArtifacts) {
+ if (this.scaTypeManager.isTypeOf(artifactType, name)) {
+ provide = true;
+ break;
+ }
+ }
+ if (!provide) {
+ return false;
+ }
+ //1. The required intent matches a provides intent in a policySet exactly.
+ if (policySet.getProvideIntents().contains(intent)) {
+ if (intentRegistry.isQualifiedIntent(intent)) {
+ addMatching(matchings, policySet);
+ } else {
+ Collection<IntentMap> intentMaps = policySet.getIntentMaps();
+ provide = searchIntentMaps(intent, intent, matchings, intentMaps);
+ if (provide) {
+ return true;
+ }
+ }
+ } else if (provideAbstract(intent, policySet.getProvideIntents())) {
+ // 2. The provides intent is a parent (e.g. prefix) of the required intent (in this case the policySet must
+ // have an intentMap entry for the requested qualifier)
+ Collection<IntentMap> intentMaps = policySet.getIntentMaps();
+ IntentName satisfiedIntent = getSatisfiedIntent(intent, policySet.getProvideIntents());
+ provide = searchIntentMaps(intent, satisfiedIntent, matchings, intentMaps);
+ if (provide) {
+ return true;
+ }
+ } else if (provideQualifier(intent, policySet.getProvideIntents())) {
+ //3. The provides intent is more qualified than the required intent
+ if (intentRegistry.isQualifiedIntent(intent)) {
+ addMatching(matchings, policySet);
+ } else {
+ //TODO
+ }
+ }
+
+ //handle PolicySetReference
+ Collection<PolicySetReference> policySetReferences = policySet.getPolicySetReferences();
+ for (PolicySetReference reference : policySetReferences) {
+ PolicySet referencedPolicySet = policySetContainer.getPolicySet(reference.getReference());
+ if (introspectPolicySet(referencedPolicySet, intent, artifactType, matchings)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void addMatching(Collection<PolicyModel> matching, PolicyContentModel policy) {
+ if (!policy.getWsPolicyAttachments().isEmpty()) {
+ matching.addAll(policy.getWsPolicyAttachments());
+ }
+ if (!policy.getPolicyExtensions().isEmpty()) {
+ matching.addAll(policy.getPolicyExtensions());
+ }
+ }
+
+ private boolean searchIntentMaps(IntentName require,
+ IntentName satisfiedIntent,
+ Collection<PolicyModel> matchings,
+ Collection<IntentMap> intentMaps) {
+ String qualifierName = getQualifierName(require, satisfiedIntent, intentMaps);
+ for (IntentMap intentMap : intentMaps) {
+ if (intentMap.getProvideIntents().contains(qualifierName)) {
+ Collection<Qualifier> qualifiers = intentMap.getQualifiers();
+ for (Qualifier qualifier : qualifiers) {
+ String nextQualifier = getNextQualifier(require, satisfiedIntent, intentMap);
+ if (qualifier.getName().equals(nextQualifier)) {
+ if (intentRegistry
+ .isQualifiedIntent(new IntentName(satisfiedIntent.toString() + "/" + nextQualifier))) {
+ addMatching(matchings, qualifier);
+ return true;
+ } else {
+ require = new IntentName(require.toString() + "/" + intentMap.getDefaultProvideIntent());
+ satisfiedIntent = new IntentName(satisfiedIntent.toString() + "/" + qualifierName);
+ intentMaps = new ArrayList<IntentMap>(0);
+ intentMaps.add(qualifier.getIntentMap());
+ searchIntentMaps(require, satisfiedIntent, matchings, intentMaps);
+ }
+ break;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private String getQualifierName(IntentName require, IntentName satisfiedIntent, Collection<IntentMap> intentMaps) {
+ String[] requrieQualifiers = require.getQualifiedNames();
+ String[] satisfiedQualifiers = satisfiedIntent.getQualifiedNames();
+ if (requrieQualifiers.length == satisfiedQualifiers.length) {
+ return requrieQualifiers[requrieQualifiers.length - 1];
+ } else if (requrieQualifiers.length > satisfiedQualifiers.length) {
+ return satisfiedQualifiers[satisfiedQualifiers.length - 1];
+ }
+ //TODO raise exception
+ return null;
+ }
+
+ private String getNextQualifier(IntentName require, IntentName satisfiedIntent, IntentMap intentMap) {
+ String[] requrieQualifiers = require.getQualifiedNames();
+ String[] satisfiedQualifiers = satisfiedIntent.getQualifiedNames();
+ if (requrieQualifiers.length > satisfiedQualifiers.length) {
+ return requrieQualifiers[satisfiedQualifiers.length];
+ } else {
+ return intentMap.getDefaultProvideIntent();
+ }
+ }
+
+ private IntentName getSatisfiedIntent(IntentName require, Collection<IntentName> provides) {
+ for (IntentName name : provides) {
+ if (PolicyHelper.isQualifiedIntentFor(require, name, true)) {
+ return name;
+ }
+ }
+ //TODO raise exception
+ return null;
+ }
+
+ private boolean provideAbstract(IntentName require, Collection<IntentName> provides) {
+ for (IntentName name : provides) {
+ if (PolicyHelper.isQualifiedIntentFor(require, name, true)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean provideQualifier(IntentName require, Collection<IntentName> provides) {
+ for (IntentName name : provides) {
+ if (PolicyHelper.isQualifiedIntentFor(name, require, true)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Collection<PolicySet> getExplicitPolicySet(QName[] policySetNames) {
+ Collection<PolicySet> result = new ArrayList<PolicySet>();
+ for (QName policySetName : policySetNames) {
+ PolicySet set = policySetContainer.getPolicySet(policySetName);
+ if (set != null) {
+ result.add(set);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Step C. Calculate the list of explicitly specified policySets that apply to the target element as follows: 1.
+ * Start with the list of policySets specified in the element's policySet attribute. 2. If any of these explicitly
+ * listed policySets has an XPath expression in its appliesTo attribute that does not match the target element
+ * (binding or implementation) then the composite is invalid. It does not match if the XPath returns a result set
+ * that corresponds to XPath false. For example, a policySet could have appliesTo=”binding.ws/soaphttp”. This would
+ * return false if the target element is a <binding.jms…/> element. 3. Include the values of policySet attributes
+ * from ancestor elements. 4. Remove any policySet where the XPath expression in that policySet’s appliesTo
+ * attribute does not match the target element.
+ * <p/>
+ *
+ * @param requires
+ * @param policies
+ * @return intent names was satisfied by this step.
+ */
+ private Collection<IntentName> calculateExplicitPolicySet(Collection<IntentName> requires,
+ Collection<PolicySet> policies,
+ QName artifactType,
+ Collection<PolicyModel> matchings) {
+ Collection<IntentName> satisfied = new ArrayList<IntentName>();
+ for (IntentName intent : requires) {
+ for (PolicySet policySet : policies) {
+ if (introspectPolicySet(policySet, intent, artifactType, matchings)) {
+ satisfied.add(intent);
+ }
+ }
+ }
+ return satisfied;
+ }
+
+ /**
+ * * The remaining required intents, if any, are provided by finding additional matching policySets within the SCA
+ * system. E. Choose the smallest collection of these policySets that match all remaining required intents. A
+ * policySet matches a required intent if any of the following are true: 1. The required intent matches a provides
+ * intent in a policySet exactly. 2. The provides intent is a parent (e.g. prefix) of the required intent (in this
+ * case the policySet must have an intentMap entry for the requested qualifier) 3. The provides intent is more
+ * qualified than the required intent All intents should now be satisfied.
+ *
+ * @param remainings
+ * @param artifactType
+ * @param matchings
+ */
+ private Collection<IntentName> findingAdditionalMatching(final Collection<IntentName> remainings,
+ QName artifactType,
+ Collection<PolicyModel> matchings) {
+ Collection<IntentName> satisfied = new ArrayList<IntentName>();
+ Collection<PolicySet> policies = this.policySetContainer.getAllPolicySet();
+ for (IntentName intent : remainings) {
+ for (PolicySet policySet : policies) {
+ if (introspectPolicySet(policySet, intent, artifactType, matchings)) {
+ satisfied.add(intent);
+ }
+ }
+ }
+ return satisfied;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyHelper.java
new file mode 100644
index 0000000000..50c94aaf13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyHelper.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.policy;
+
+import org.apache.tuscany.spi.model.IntentName;
+
+/**
+ * Contains utility methods for dealing with policies
+ */
+public final class PolicyHelper {
+
+ private PolicyHelper() {
+ }
+
+ /**
+ * Whether <code>qualified</code> is qualified intent for <code>qualifiable</code>
+ * <p/>
+ * For example: sec.confidentiality/message is direct qualifier for sec.confidentiality.
+ * sec.confidentiality/message/body is qualifier for sec.confidentiality, but not a direct qualifier
+ *
+ * @param qualified qualified intent name
+ * @param qualifiable qualifiable intent name
+ * @param direct indicate whether to expect <code>qualified</code> is direct qualified intent for
+ * <code>qualifiable</code>
+ * @return whether <code>qualified</code> is qualified intent for <code>qualifiable</code>
+ */
+ public static boolean isQualifiedIntentFor(final IntentName qualified,
+ final IntentName qualifiable,
+ boolean direct) {
+ if (qualified.equals(qualifiable) || !qualified.getDomain().equals(qualifiable.getDomain())) {
+ return false;
+ }
+ boolean result = true;
+ String[] shortArray = qualifiable.getQualifiedNames();
+ String[] longArray = qualified.getQualifiedNames();
+ if (longArray.length - shortArray.length < 1 && !direct) {
+ return false;
+ } else if (direct && longArray.length - shortArray.length != 1) {
+ return false;
+ }
+ for (int i = 0; i < shortArray.length; i++) {
+ if (!shortArray[i].equals(longArray[i])) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyHelper.java
new file mode 100644
index 0000000000..36054dc2f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyHelper.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.property;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.core.databinding.xml.InputStream2Node;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.InvalidValueException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * The property factory backed by the DataBindingframework
+ */
+public final class PropertyHelper {
+
+ private static final XPathFactory FACTORY = XPathFactory.newInstance();
+
+ private PropertyHelper() {
+ }
+
+ public static Document evaluate(NamespaceContext nsContext, Node node, String xPathExpression)
+ throws XPathExpressionException, ParserConfigurationException {
+ XPath path = FACTORY.newXPath();
+ if (nsContext != null) {
+ path.setNamespaceContext(nsContext);
+ } else {
+ path.setNamespaceContext(new DOMNamespeceContext(node));
+ }
+ XPathExpression expression = path.compile(xPathExpression);
+ Node result = (Node)expression.evaluate(node, XPathConstants.NODE);
+ if (result == null) {
+ return null;
+ }
+
+ // TODO: How to wrap the result into a Document?
+ Document document = DOMHelper.newDocument();
+ if (result instanceof Document) {
+ return (Document)result;
+ } else {
+ document.appendChild(document.importNode(result, true));
+ return document;
+ }
+ }
+
+ public static Document loadFromFile(String file, DeploymentContext deploymentContext)
+ throws LoaderException {
+ try {
+ URI uri = URI.create(file);
+ URL url = null;
+ if (!uri.isAbsolute()) {
+ url = deploymentContext.getClassLoader().getResource(file);
+ } else {
+ url = uri.toURL();
+ }
+ InputStream is = url.openStream();
+ try {
+ InputStream2Node transformer = new InputStream2Node();
+ return (Document)transformer.transform(is, null);
+ } finally {
+ is.close();
+ }
+ } catch (Exception e) {
+ throw new LoaderException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void processProperties(CompositeComponentType<?, ?, Property<?>> parent,
+ ComponentDefinition<? extends Implementation<?>> componentDefinition,
+ DeploymentContext deploymentContext) throws LoaderException {
+ Map<String, PropertyValue<?>> propertyValues = componentDefinition.getPropertyValues();
+
+ for (PropertyValue propValue : propertyValues.values()) {
+ String source = propValue.getSource();
+ String file = propValue.getFile();
+ if (source != null) {
+ try {
+ // $<name>/...
+ int index = source.indexOf('/');
+ if (index == -1) {
+ // Tolerating $prop
+ source = source + "/";
+ index = source.length() - 1;
+ }
+ if (source.charAt(0) == '$') {
+ String name = source.substring(1, index);
+ Property<?> compositeProp = parent.getProperties().get(name);
+ if (compositeProp == null) {
+ InvalidValueException ex =
+ new InvalidValueException(
+ "The 'source' cannot be resolved to a composite property");
+ ex.addContextName(source);
+ throw ex;
+ }
+
+ boolean prependValue = false;
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document compositePropDefValues = builder.newDocument();
+ Node element = null;
+ for (int count = 0 ; count < compositeProp.getDefaultValues().size() ; ++count) {
+ element = compositeProp.getDefaultValues().get(count);
+ prependValue = element.getNodeName().equals("value");
+ element = compositePropDefValues.adoptNode(element);
+ compositePropDefValues.appendChild(element);
+ }
+ // Adding /value because the document root is "value"
+ String path = source.substring(index);
+ String xpath = null;
+ Property<?> componentProperty = (Property<?>)
+ componentDefinition.getImplementation().getComponentType().getProperties().get(propValue.getName());
+ if (prependValue) {
+ if ("/".equals(path)) {
+ // trailing / is not legal for xpath
+ xpath = "/value";
+ } else {
+ xpath = "/value" + path;
+ }
+ } else {
+ xpath = path;
+ }
+
+ // FIXME: How to deal with namespaces?
+ Document node = evaluate(null, compositePropDefValues, xpath);
+ //Document node = evaluate(null, compositeProp.getDefaultValues().get(0).getOwnerDocument(), xpath);
+ if (node != null) {
+ List<Document> values = new ArrayList<Document>();
+ values.add(node);
+ propValue.setValue(values);
+ }
+ } else {
+ InvalidValueException ex =
+ new InvalidValueException("The 'source' has an invalid value");
+ ex.addContextName(source);
+ throw ex;
+ }
+ } catch (Exception e) {
+ throw new LoaderException(e);
+ }
+ } else if (file != null) {
+ Property<?> prop =
+ (Property<?>)componentDefinition.getImplementation().getComponentType().getProperties()
+ .get(propValue.getName());
+ Document document = loadFromFile(propValue.getFile(), deploymentContext);
+ List<Element> values = new ArrayList<Element>();
+ if (prop.isMany()) {
+ //extract the property value elements from the loaded document
+ Element element = document.getDocumentElement();
+ Node childNode = null;
+ for (int count = 0 ; count < element.getChildNodes().getLength() ; ++count) {
+ if (element.getChildNodes().item(count).getNodeType() == Document.ELEMENT_NODE) {
+ values.add((Element)element.getChildNodes().item(count));
+ }
+ }
+ propValue.setValue(values);
+ propValue.setValueFactory(new SimpleMultivaluedPropertyObjectFactory(prop, propValue.getValue()));
+ } else {
+ values.add(document.getDocumentElement());
+ propValue.setValue(values);
+ propValue.setValueFactory(new SimplePropertyObjectFactory(prop, (Element)propValue.getValue().get(0)));
+ }
+ }
+ }
+ }
+
+ private static class DOMNamespeceContext implements NamespaceContext {
+ private Node node;
+
+ /**
+ * @param node
+ */
+ public DOMNamespeceContext(Node node) {
+ super();
+ this.node = node;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ //return "http://foo";
+ return node.lookupNamespaceURI(prefix);
+ }
+
+ public String getPrefix(String namespaceURI) {
+ //return "foo";
+ return node.lookupPrefix(namespaceURI);
+ }
+
+ public Iterator getPrefixes(String namespaceURI) {
+ return null;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyObjectFactoryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyObjectFactoryImpl.java
new file mode 100644
index 0000000000..53b4f58b71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/PropertyObjectFactoryImpl.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.property;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.core.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+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.Mediator;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(PropertyObjectFactory.class)
+@Scope("COMPOSITE")
+public class PropertyObjectFactoryImpl implements PropertyObjectFactory {
+ private DataBindingRegistry registry;
+ private Mediator mediator;
+
+ public PropertyObjectFactoryImpl() {
+ }
+
+ @Constructor( {"registry", "mediator"})
+ public PropertyObjectFactoryImpl(@Autowire
+ DataBindingRegistry registry, @Autowire
+ Mediator mediator) {
+ super();
+ this.registry = registry;
+ this.mediator = mediator;
+ }
+
+ public <T> ObjectFactory<T> createObjectFactory(Property<T> property, PropertyValue<T> value) {
+ if (mediator == null) {
+ return new SimplePropertyObjectFactory<T>(property, value.getValue().get(0));
+ }
+ return new ObjectFactoryImpl<T>(property, value);
+ }
+
+ public <T> ObjectFactory<List<T>> createListObjectFactory(Property<T> property, PropertyValue<T> value)
+ throws LoaderException {
+ if (mediator == null) {
+ return new SimpleMultivaluedPropertyObjectFactory<T>(property, value.getValue());
+ }
+ return new ListObjectFactoryImpl<T>(property, value);
+ }
+
+ public class ObjectFactoryImplBase<P> {
+ protected Property<P> property;
+ protected PropertyValue<P> propertyValue;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+
+ public ObjectFactoryImplBase(Property<P> property, PropertyValue<P> propertyValue) {
+ this.property = property;
+ this.propertyValue = propertyValue;
+ sourceDataType =
+ new DataType<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property.getXmlType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXmlType() != null) {
+ if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXmlType())) {
+ typeInfo = new TypeInfo(property.getXmlType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXmlType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXmlType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ /*
+ * ElementInfo elementInfo = new ElementInfo(null, typeInfo);
+ * sourceDataType.setMetadata(ElementInfo.class.getName(),
+ * elementInfo);
+ */
+ Class javaType = this.property.getJavaType();
+ String dataBinding = (String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataType<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataType<XMLType>(dataBinding, javaType, xmlType);
+ registry.introspectType(targetDataType, null);
+ }
+ }
+ }
+
+ public class ObjectFactoryImpl<P> extends ObjectFactoryImplBase<P> implements ObjectFactory<P> {
+
+ public ObjectFactoryImpl(Property<P> property, PropertyValue<P> propertyValue) {
+ super(property, propertyValue);
+ }
+
+ @SuppressWarnings("unchecked")
+ public P getInstance() throws ObjectCreationException {
+ return (P)mediator.mediate(propertyValue.getValue().get(0), sourceDataType, targetDataType, null);
+ }
+ }
+
+ public class ListObjectFactoryImpl<P> extends ObjectFactoryImplBase<P> implements ObjectFactory<List<P>> {
+
+ public ListObjectFactoryImpl(Property<P> property, PropertyValue<P> propertyValue) {
+ super(property, propertyValue);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<P> getInstance() throws ObjectCreationException {
+ List<P> instances = new ArrayList<P>();
+ for (int count = 0; count < propertyValue.getValue().size(); ++count) {
+ instances.add((P)mediator.mediate(propertyValue.getValue().get(count),
+ sourceDataType,
+ targetDataType,
+ null));
+ }
+ return instances;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimpleMultivaluedPropertyObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimpleMultivaluedPropertyObjectFactory.java
new file mode 100644
index 0000000000..85e41381a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimpleMultivaluedPropertyObjectFactory.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.property;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.model.Property;
+import org.w3c.dom.Element;
+
+public class SimpleMultivaluedPropertyObjectFactory<P> implements ObjectFactory<List<P>> {
+ private SimpleTypeMapperExtension typeMapper;
+ private Property<P> property;
+ private List<Element> values;
+ private List<P> instance;
+
+ public SimpleMultivaluedPropertyObjectFactory(Property<P> property, List<Element> value) {
+ super();
+
+ this.property = property;
+ this.values = (value == null) ? property.getDefaultValues() : value;
+ this.typeMapper = new SimpleTypeMapperExtension();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<P> getInstance() throws ObjectCreationException {
+ if (values == null) {
+ return null;
+ }
+
+ TypeInfo xmlType = null;
+ String text = null;
+
+ if (instance == null) {
+ instance = new ArrayList<P>();
+ for (int count = 0 ; count < values.size() ; ++count) {
+ text = values.get(count).getTextContent();
+
+ if (property.getJavaType() == null) {
+ xmlType = new TypeInfo(property.getXmlType(), true, null);
+ } else {
+ xmlType = typeMapper.getXMLType(property.getJavaType());
+ }
+ if (xmlType == null) {
+ throw new IllegalArgumentException("Complex property is not supported.");
+ }
+ instance.add((P)typeMapper.toJavaObject(xmlType.getQName(), text, null));
+ }
+ }
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.java
new file mode 100644
index 0000000000..87d8d414e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/property/SimplePropertyObjectFactory.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.core.property;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.model.Property;
+import org.w3c.dom.Element;
+
+public class SimplePropertyObjectFactory<P> implements ObjectFactory<P> {
+ private SimpleTypeMapperExtension typeMapper;
+ private Property<P> property;
+ private Element value;
+ private P instance;
+
+ public SimplePropertyObjectFactory(Property<P> property, Element value) {
+ super();
+
+ this.property = property;
+ this.value = (value == null) ? property.getDefaultValues().get(0) : value;
+ this.typeMapper = new SimpleTypeMapperExtension();
+ }
+
+ @SuppressWarnings("unchecked")
+ public P getInstance() throws ObjectCreationException {
+ if (value == null) {
+ return null;
+ }
+ if (instance == null) {
+ String text = value.getTextContent();
+ TypeInfo xmlType = null;
+ if (property.getJavaType() == null) {
+ xmlType = new TypeInfo(property.getXmlType(), true, null);
+ } else {
+ xmlType = typeMapper.getXMLType(property.getJavaType());
+ }
+ if (xmlType == null) {
+ throw new IllegalArgumentException("Complex property is not supported.");
+ }
+ instance = (P)typeMapper.toJavaObject(xmlType.getQName(), text, null);
+ }
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
new file mode 100644
index 0000000000..4dd4e792a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.runtime;
+
+import java.net.URL;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.core.bootstrap.Bootstrapper;
+import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.management.ManagementService;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractRuntime implements TuscanyRuntime {
+ private final XMLInputFactory xmlFactory;
+ private URL systemScdl;
+ private String applicationName;
+ private URL applicationScdl;
+ private ClassLoader hostClassLoader;
+ private ClassLoader applicationClassLoader;
+ private RuntimeInfo runtimeInfo;
+ private MonitorFactory monitorFactory;
+ private ManagementService<?> managementService;
+
+ private RuntimeComponent runtime;
+ private CompositeComponent systemComponent;
+ private CompositeComponent tuscanySystem;
+ private Deployer deployer;
+ private WireService wireService;
+
+ protected AbstractRuntime() {
+ this(new NullMonitorFactory());
+ }
+
+ protected AbstractRuntime(MonitorFactory monitorFactory) {
+ this.monitorFactory = monitorFactory;
+ xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ public URL getSystemScdl() {
+ return systemScdl;
+ }
+
+ public void setSystemScdl(URL systemScdl) {
+ this.systemScdl = systemScdl;
+ }
+
+ public String getApplicationName() {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ public URL getApplicationScdl() {
+ return applicationScdl;
+ }
+
+ public void setApplicationScdl(URL applicationScdl) {
+ this.applicationScdl = applicationScdl;
+ }
+
+ public ClassLoader getApplicationClassLoader() {
+ return applicationClassLoader;
+ }
+
+ public void setApplicationClassLoader(ClassLoader applicationClassLoader) {
+ this.applicationClassLoader = applicationClassLoader;
+ }
+
+ public ClassLoader getHostClassLoader() {
+ return hostClassLoader;
+ }
+
+ public void setHostClassLoader(ClassLoader hostClassLoader) {
+ this.hostClassLoader = hostClassLoader;
+ }
+
+ public RuntimeInfo getRuntimeInfo() {
+ return runtimeInfo;
+ }
+
+ public void setRuntimeInfo(RuntimeInfo runtimeInfo) {
+ this.runtimeInfo = runtimeInfo;
+ }
+
+ public MonitorFactory getMonitorFactory() {
+ return monitorFactory;
+ }
+
+ public void setMonitorFactory(MonitorFactory monitorFactory) {
+ this.monitorFactory = monitorFactory;
+ }
+
+ public ManagementService<?> getManagementService() {
+ return managementService;
+ }
+
+ public void setManagementService(ManagementService<?> managementService) {
+ this.managementService = managementService;
+ }
+
+ protected XMLInputFactory getXMLFactory() {
+ return xmlFactory;
+ }
+
+ protected RuntimeComponent getRuntime() {
+ return runtime;
+ }
+
+ protected CompositeComponent getSystemComponent() {
+ return systemComponent;
+ }
+
+ protected CompositeComponent getTuscanySystem() {
+ return tuscanySystem;
+ }
+
+ protected Deployer getDeployer() {
+ return deployer;
+ }
+
+ protected WireService getWireService() {
+ return wireService;
+ }
+
+ public void initialize() throws InitializationException {
+ Bootstrapper bootstrapper = createBootstrapper();
+ runtime = bootstrapper.createRuntime();
+ runtime.start();
+
+ systemComponent = runtime.getSystemComponent();
+ registerSystemComponents();
+ systemComponent.start();
+
+ // deploy the system scdl
+ try {
+ tuscanySystem =
+ deploySystemScdl(bootstrapper.createDeployer(),
+ systemComponent,
+ ComponentNames.TUSCANY_SYSTEM,
+ getSystemScdl(),
+ getClass().getClassLoader());
+ } catch (LoaderException e) {
+ throw new InitializationException(e);
+ } catch (BuilderException e) {
+ throw new InitializationException(e);
+ } catch (ComponentException e) {
+ throw new InitializationException(e);
+ }
+ tuscanySystem.start();
+
+ this.deployer = locateDeployer();
+ this.wireService = locateWireService();
+ }
+
+ public void destroy() {
+ this.wireService = null;
+ this.deployer = null;
+ if (tuscanySystem != null) {
+ tuscanySystem.stop();
+ tuscanySystem = null;
+ }
+ if (systemComponent != null) {
+ systemComponent.stop();
+ systemComponent = null;
+ }
+ if (runtime != null) {
+ runtime.stop();
+ runtime = null;
+ }
+ }
+
+ protected Bootstrapper createBootstrapper() {
+ TuscanyManagementService tms = (TuscanyManagementService)getManagementService();
+ return new DefaultBootstrapper(getMonitorFactory(), xmlFactory, tms);
+ }
+
+ protected void registerSystemComponents() throws InitializationException {
+ try {
+ systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME, RuntimeInfo.class, runtimeInfo);
+ systemComponent.registerJavaObject("MonitorFactory", MonitorFactory.class, getMonitorFactory());
+ } catch (ComponentRegistrationException e) {
+ throw new InitializationException(e);
+ }
+ }
+
+ protected Deployer locateDeployer() throws InitializationException {
+ SCAObject deployerComponent = tuscanySystem.getSystemChild(ComponentNames.TUSCANY_DEPLOYER);
+ if (!(deployerComponent instanceof AtomicComponent)) {
+ throw new InitializationException("Deployer must be an atomic component");
+ }
+ try {
+ return (Deployer)((AtomicComponent)deployerComponent).getTargetInstance();
+ } catch (TargetResolutionException e) {
+ throw new InitializationException(e);
+ }
+ }
+
+ protected WireService locateWireService() throws InitializationException {
+ SCAObject wireServiceComponent = tuscanySystem.getSystemChild(ComponentNames.TUSCANY_WIRE_SERVICE);
+ if (!(wireServiceComponent instanceof AtomicComponent)) {
+ throw new InitializationException("WireService must be an atomic component");
+ }
+ try {
+ return (WireService)((AtomicComponent)wireServiceComponent).getTargetInstance();
+ } catch (TargetResolutionException e) {
+ throw new InitializationException(e);
+ }
+ }
+
+ protected CompositeComponent deploySystemScdl(Deployer deployer,
+ CompositeComponent parent,
+ String name,
+ URL systemScdl,
+ ClassLoader systemClassLoader) throws LoaderException,
+ BuilderException, ComponentException {
+
+ SystemCompositeImplementation impl = new SystemCompositeImplementation();
+ impl.setScdlLocation(systemScdl);
+ impl.setClassLoader(systemClassLoader);
+ ComponentDefinition<SystemCompositeImplementation> definition =
+ new ComponentDefinition<SystemCompositeImplementation>(name, impl);
+
+ return (CompositeComponent)deployer.deploy(parent, definition);
+ }
+
+ protected CompositeComponent deployApplicationScdl(Deployer deployer,
+ CompositeComponent parent,
+ String name,
+ URL applicationScdl,
+ ClassLoader applicationClassLoader) throws LoaderException,
+ BuilderException, ComponentException {
+
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(applicationScdl);
+ impl.setClassLoader(applicationClassLoader);
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(name, impl);
+
+ return (CompositeComponent)deployer.deploy(parent, definition);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntime.java
new file mode 100644
index 0000000000..e192b18e5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntime.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.core.runtime.mini;
+
+import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface SimpleRuntime extends TuscanyRuntime {
+ CompositeComponent start() throws Exception;
+ <T> T getSystemService(Class<T> type, String name) throws TargetResolutionException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeImpl.java
new file mode 100644
index 0000000000..bb9a32e7e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeImpl.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.runtime.mini;
+
+import static org.apache.tuscany.spi.bootstrap.ComponentNames.TUSCANY_ASSEMBLY_SERVICE;
+import static org.apache.tuscany.spi.bootstrap.ComponentNames.TUSCANY_CONTRIBUTION_SERVICE;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.core.launcher.CompositeContextImpl;
+import org.apache.tuscany.core.monitor.JavaLoggingMonitorFactory;
+import org.apache.tuscany.core.runtime.AbstractRuntime;
+import org.apache.tuscany.core.services.deployment.AssemblyServiceImpl;
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.deployment.AssemblyService;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+import org.apache.tuscany.host.runtime.InitializationException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleRuntimeImpl extends AbstractRuntime implements SimpleRuntime {
+ protected JavaLoggingMonitorFactory monitorFactory;
+ protected SimpleMonitor monitor;
+ protected CompositeComponent application;
+
+ public SimpleRuntimeImpl(SimpleRuntimeInfo runtimeInfo) {
+ super();
+ monitorFactory = new JavaLoggingMonitorFactory();
+ setMonitorFactory(monitorFactory);
+ monitor = monitorFactory.getMonitor(SimpleMonitor.class);
+ ClassLoader hostClassLoader = ClassLoader.getSystemClassLoader();
+ setHostClassLoader(hostClassLoader);
+ setSystemScdl(runtimeInfo.getSystemSCDL());
+ setRuntimeInfo(runtimeInfo);
+ }
+
+ public interface SimpleMonitor {
+ @LogLevel("SEVERE")
+ void runError(Exception e);
+ }
+
+ public CompositeComponent start() throws Exception {
+ initialize();
+ ContributionService contributionService =
+ getSystemService(ContributionService.class, TUSCANY_CONTRIBUTION_SERVICE);
+ CompositeComponent composite = getTuscanySystem();
+ // TODO: Make assembly service a pluggable component?
+ AssemblyService assemblyService = new AssemblyServiceImpl(contributionService, composite);
+ composite.registerJavaObject(TUSCANY_ASSEMBLY_SERVICE, AssemblyService.class, assemblyService);
+
+ SimpleRuntimeInfo runtimeInfo = (SimpleRuntimeInfo)getRuntimeInfo();
+ int i = 0;
+ for (URL ext : runtimeInfo.getExtensionSCDLs()) {
+ CompositeComponent extensionComponent =
+ deploySystemScdl(getDeployer(), getTuscanySystem(), "tuscany.extension." + (i++), ext, runtimeInfo
+ .getClassLoader());
+ extensionComponent.start();
+ }
+
+ URI contributionId = runtimeInfo.getContributionURI();
+ contributionService.contribute(contributionId, runtimeInfo.getContributionRoot(), false);
+ URI compositeDefinitionId = contributionId.resolve(runtimeInfo.getCompositePath());
+
+ application =
+ (CompositeComponent)assemblyService.addCompositeToDomain(contributionId, compositeDefinitionId, runtimeInfo
+ .getCompositePath());
+
+ CompositeContext context = new CompositeContextImpl(application, getWireService());
+ CurrentCompositeContext.setContext(context);
+ return application;
+ }
+
+ public <T> T getSystemService(Class<T> type, String name) throws TargetResolutionException {
+ SCAObject child = getTuscanySystem().getSystemChild(name);
+ if (child == null) {
+ return null;
+ }
+ AtomicComponent service = (AtomicComponent)child;
+ return type.cast(service.getTargetInstance());
+ }
+
+ @Override
+ protected void registerSystemComponents() throws InitializationException {
+ try {
+ // initialize the runtime info
+ CompositeComponent parent = getSystemComponent();
+ parent.registerJavaObject("RuntimeInfo", RuntimeInfo.class, getRuntimeInfo());
+
+ // register the monitor factory
+ if (monitorFactory instanceof FormatterRegistry) {
+ List<Class<?>> interfazes = new ArrayList<Class<?>>(2);
+ interfazes.add(MonitorFactory.class);
+ interfazes.add(FormatterRegistry.class);
+ parent.registerJavaObject("MonitorFactory", interfazes, monitorFactory);
+ } else {
+ parent.registerJavaObject("MonitorFactory", MonitorFactory.class, monitorFactory);
+ }
+ } catch (ComponentRegistrationException e) {
+ throw new InitializationException(e);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ CurrentCompositeContext.setContext(null);
+ application.stop();
+ super.destroy();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfo.java
new file mode 100644
index 0000000000..10b88d9e47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfo.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.core.runtime.mini;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.host.RuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface SimpleRuntimeInfo extends RuntimeInfo {
+ String DEFAULT_SYSTEM_SCDL = "META-INF/tuscany/default-system.composite";
+ String SYSTEM_SCDL = "system.composite";
+ String EXTENSION_SCDL = "META-INF/sca/extension.composite";
+ String SERVICE_SCDL = "META-INF/sca/service.composite";
+ String META_APPLICATION_SCDL = "META-INF/sca/application.composite";
+ String APPLICATION_SCDL = "application.composite";
+
+ ClassLoader getClassLoader();
+
+ String getCompositePath();
+
+ URL getSystemSCDL();
+ List<URL> getExtensionSCDLs();
+ URL getContributionRoot();
+ URI getContributionURI();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfoImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfoImpl.java
new file mode 100644
index 0000000000..a9e0f2a114
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/mini/SimpleRuntimeInfoImpl.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.runtime.mini;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.apache.tuscany.core.util.FileHelper;
+import org.apache.tuscany.host.AbstractRuntimeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleRuntimeInfoImpl extends AbstractRuntimeInfo implements SimpleRuntimeInfo {
+ private ClassLoader classLoader;
+ private String compositePath;
+
+ private List<URL> extensions;
+ private URL applicationSCDL;
+ private URL systemSCDL;
+
+ private URL contributionURL;
+ private URI contributionURI;
+
+ /**
+ * @param classLoader
+ * @param compositePath
+ * @param extensions
+ * @param applicationSCDL
+ * @param systemSCDL
+ */
+ public SimpleRuntimeInfoImpl(ClassLoader classLoader,
+ URL systemSCDL,
+ List<URL> extensions,
+ URI contributionURI,
+ URL applicationSCDL,
+ String compositePath) {
+ this(classLoader, compositePath);
+ this.extensions = extensions;
+ this.applicationSCDL = applicationSCDL;
+ this.systemSCDL = systemSCDL;
+ this.contributionURI = contributionURI;
+ }
+
+ public SimpleRuntimeInfoImpl(ClassLoader classLoader, String compositePath) {
+ // super(domain, applicationRootDirectory, baseUrl, online, runtimeId);
+ super(URI.create("sca://domain/local"), null, null, false, "simple");
+ if (classLoader != null) {
+ this.classLoader = classLoader;
+ } else {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ this.compositePath = compositePath != null ? compositePath : APPLICATION_SCDL;
+ getApplicationSCDL();
+ this.contributionURI = URI.create("/default");
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public String getCompositePath() {
+ return compositePath;
+ }
+
+ public final URL getApplicationSCDL() {
+ if (applicationSCDL == null) {
+ applicationSCDL = classLoader.getResource(compositePath);
+ if (applicationSCDL == null) {
+ applicationSCDL = classLoader.getResource(APPLICATION_SCDL);
+ if (applicationSCDL == null) {
+ applicationSCDL = classLoader.getResource(META_APPLICATION_SCDL);
+ if (applicationSCDL != null) {
+ compositePath = META_APPLICATION_SCDL;
+ }
+ } else {
+ if (compositePath == null) {
+ compositePath = APPLICATION_SCDL;
+ }
+ }
+ if (applicationSCDL == null) {
+ throw new IllegalArgumentException("application SCDL not found: " + APPLICATION_SCDL);
+ }
+ }
+ }
+ return applicationSCDL;
+ }
+
+ public URL getContributionRoot() {
+ if (contributionURL == null) {
+ contributionURL = getContributionLocation(getApplicationSCDL(), compositePath);
+ }
+ return contributionURL;
+ }
+
+ public List<URL> getExtensionSCDLs() {
+ if (extensions == null) {
+ try {
+ List<URL> extensionURLs = new ArrayList<URL>();
+ Enumeration<URL> urls = classLoader.getResources(SERVICE_SCDL);
+ extensionURLs.addAll(Collections.list(urls));
+ urls = classLoader.getResources(EXTENSION_SCDL);
+ extensionURLs.addAll(Collections.list(urls));
+ if (extensions != null) {
+ for (URL ext : extensions) {
+ if (!extensionURLs.contains(ext)) {
+ extensionURLs.add(ext);
+ }
+ }
+ }
+ extensions = extensionURLs;
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return extensions;
+ }
+
+ public URL getSystemSCDL() {
+ if (systemSCDL == null) {
+ systemSCDL = classLoader.getResource(SYSTEM_SCDL);
+ if (systemSCDL == null) {
+ systemSCDL = classLoader.getResource(DEFAULT_SYSTEM_SCDL);
+ }
+ }
+ return systemSCDL;
+ }
+
+ private static URL getContributionLocation(URL applicationSCDL, String compositePath) {
+ URL root = null;
+ // "jar:file://....../something.jar!/a/b/c/app.composite"
+ try {
+ String scdlUrl = applicationSCDL.toExternalForm();
+ String protocol = applicationSCDL.getProtocol();
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (scdlUrl.endsWith(compositePath)) {
+ String location = scdlUrl.substring(0, scdlUrl.lastIndexOf(compositePath));
+ // workaround from evil url/uri form maven
+ root = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = scdlUrl.substring(4, scdlUrl.lastIndexOf("!/"));
+ // workaround from evil url/uri form maven
+ root = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ } catch (MalformedURLException mfe) {
+ throw new IllegalArgumentException(mfe);
+ }
+
+ return root;
+ }
+
+ public URI getContributionURI() {
+ return contributionURI;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/artifact/LocalMavenRepository.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/artifact/LocalMavenRepository.java
new file mode 100644
index 0000000000..f50e8544a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/artifact/LocalMavenRepository.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.core.services.artifact;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+
+/**
+ * An implementation of ArtifactRepository that uses a local Maven2 repository.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LocalMavenRepository implements ArtifactRepository {
+ private File localRepo;
+
+ /**
+ * Constructor specifying the location of the local repo. Relative paths are resolved against the user's home
+ * directory.
+ *
+ * @param repoPath the path to the local repo
+ */
+ public LocalMavenRepository(@Property(name = "repository") String repoPath) {
+ String home = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty("user.home");
+ }
+ });
+ this.localRepo = new File(home, repoPath);
+ }
+
+ public void resolve(Artifact artifact) {
+ if (artifact.getUrl() != null) {
+ return;
+ }
+
+ String path = getPath(artifact);
+ File artifactFile = new File(localRepo, path);
+ if (artifactFile.exists()) {
+ try {
+ artifact.setUrl(artifactFile.toURI().toURL());
+ } catch (MalformedURLException e) {
+ // toURI should have escaped the filename to allow it to be converted to a URL
+ throw new AssertionError();
+ }
+ }
+ }
+
+ /**
+ * Return the path into the repo for an artifact. The path for an artifact is ${group.replace('.',
+ * '/')}/$[name}/${version}/${name}-${version}[-${classifier}].${type}
+ *
+ * @param artifact the artifact to resolve
+ * @return the path into the repo for the artifact
+ */
+ protected String getPath(Artifact artifact) {
+ StringBuilder builder = new StringBuilder();
+ if (artifact.getGroup() != null) {
+ builder.append(artifact.getGroup().replace('.', '/')).append('/');
+ }
+ builder.append(artifact.getName()).append('/');
+ builder.append(artifact.getVersion()).append('/');
+
+ builder.append(artifact.getName()).append('-').append(artifact.getVersion());
+ if (artifact.getClassifier() != null) {
+ builder.append('-').append(artifact.getClassifier());
+ }
+ builder.append('.').append(artifact.getType());
+ return builder.toString();
+ }
+
+ public void resolve(Collection<? extends Artifact> artifacts) {
+ for (Artifact artifact : artifacts) {
+ resolve(artifact);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ArtifactResolverRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ArtifactResolverRegistryImpl.java
new file mode 100644
index 0000000000..a8fd3ba737
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ArtifactResolverRegistryImpl.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.services.deployment;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.deployer.ArtifactResolver;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.Contribution;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class ArtifactResolverRegistryImpl implements ArtifactResolverRegistry {
+ private Map<Class, ArtifactResolver> registry = new HashMap<Class, ArtifactResolver>();
+
+ public void registerResolver(Class<?> modelClass, ArtifactResolver resolver) {
+ registry.put(modelClass, resolver);
+ }
+
+ public void unregisterResolver(Class<?> modelClass) {
+ registry.remove(modelClass);
+ }
+
+ public <T> T resolve(Contribution contribution,
+ Class<T> modelClass,
+ String namespace,
+ String name,
+ Map attributes,
+ DeploymentContext context) {
+ ArtifactResolver resolver = registry.get(modelClass);
+ if (resolver == null) {
+ return null;
+ }
+ return resolver.resolve(contribution, modelClass, namespace, name, attributes, context);
+ }
+
+ public URL resolve(Contribution contribution, String targetNamespace, String location, String baseURI) {
+ // FIXME: What's a URI resolver?
+ ArtifactResolver resolver = registry.get(URI.class);
+ if (resolver == null) {
+ return null;
+ }
+ return resolver.resolve(contribution, targetNamespace, location, baseURI);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java
new file mode 100644
index 0000000000..6982a9fa58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImpl.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.host.deployment.AssemblyService;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.host.deployment.UnsupportedContentTypeException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.deployer.ChangeSetHandler;
+import org.apache.tuscany.spi.deployer.ChangeSetHandlerRegistry;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AssemblyServiceImpl implements AssemblyService, ChangeSetHandlerRegistry {
+ private final Map<String, ChangeSetHandler> registry = new HashMap<String, ChangeSetHandler>();
+
+ private final ContributionService contributionService;
+
+ private final CompositeComponent domain;
+
+ @Constructor
+ public AssemblyServiceImpl(@Autowire ContributionService contributionService, CompositeComponent domain) {
+ this.contributionService = contributionService;
+ this.domain = domain;
+ }
+
+ public Object addCompositeToDomain(URI contribution, URI composite, String artifactName)
+ throws DeploymentException {
+
+ /*Contribution contributionMetadata =
+ (Contribution)this.contributionService.getContribution(contribution);
+ DeployedArtifact scdlArtifact = contributionMetadata.getArtifacts().get(composite);
+
+ ComponentDefinition model =
+ (ComponentDefinition)scdlArtifact.getModelObject(CompositeComponentType.class, null);*/
+
+ ComponentDefinition model =
+ (ComponentDefinition) this.contributionService.resolve(contribution, ComponentDefinition.class, null, artifactName);
+
+ Component component = null;
+ Deployer deployer = null;
+
+ SCAObject child = this.domain.getSystemChild(ComponentNames.TUSCANY_DEPLOYER);
+ assert child instanceof AtomicComponent : "Deployer must be an atomic component";
+
+ try {
+
+ deployer = (Deployer)((AtomicComponent)child).getTargetInstance();
+ component = deployer.deployFromContribution(this.domain, model);
+
+ } catch (TargetResolutionException e) {
+ throw new DomainUpdateException(e);
+ } catch (BuilderException e) {
+ throw new DomainUpdateException(e);
+ } catch (ComponentException e) {
+ throw new DomainUpdateException(e);
+ }
+ component.start();
+
+ return component;
+ }
+
+ public void applyChanges(URL changeSet) throws DeploymentException, IOException {
+ if (changeSet == null) {
+ throw new IllegalArgumentException("changeSet is null");
+ }
+
+ URLConnection connection = changeSet.openConnection();
+ String contentType = connection.getContentType();
+ // todo try and figure out content type from the URL
+ if (contentType == null) {
+ throw new UnsupportedContentTypeException(null, changeSet.toString());
+ }
+
+ InputStream is = connection.getInputStream();
+ try {
+ applyChanges(is, contentType);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ public void applyChanges(InputStream changeSet, String contentType) throws DeploymentException, IOException {
+ if (changeSet == null) {
+ throw new IllegalArgumentException("changeSet is null");
+ }
+ if (contentType == null) {
+ throw new IllegalArgumentException("contentType is null");
+ }
+
+ ChangeSetHandler handler = registry.get(contentType);
+ if (handler == null) {
+ throw new UnsupportedContentTypeException(contentType);
+ }
+
+ handler.applyChanges(changeSet);
+ }
+
+ public void register(ChangeSetHandler handler) {
+ registry.put(handler.getContentType(), handler);
+ }
+
+ public <T> T getDefinition(URI contribution, Class<T> type, String namespace, String name) {
+ return contributionService.resolve(contribution, type, namespace, name);
+ }
+
+ public Object getDomainComposite() {
+ return domain;
+ }
+
+ public void removeCompositeFromDomain(URI contribution, URI composite) throws DeploymentException {
+ // TODO:
+ throw new UnsupportedOperationException("To be implemented");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java
new file mode 100644
index 0000000000..013d916c1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.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.core.services.deployment;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.core.util.FileHelper;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.model.Contribution;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of the content describer
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+@Service(ContentTypeDescriber.class)
+public class ContentTypeDescriberImpl implements ContentTypeDescriber {
+ private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
+
+ public ContentTypeDescriberImpl() {
+ super();
+ init();
+ }
+
+ /**
+ * Initialize contentType registry with know types based on known file
+ * extensions
+ */
+ private void init() {
+ contentTypeRegistry.put("COMPOSITE", ContentType.COMPOSITE);
+ contentTypeRegistry.put("SCDL", ContentType.COMPOSITE);
+ contentTypeRegistry.put("WSDL", ContentType.WSDL);
+ contentTypeRegistry.put("JAR", ContentType.JAR);
+ }
+
+ protected String resolveContentyTypeByExtension(URL resourceURL) {
+ String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
+ if (artifactExtension == null) {
+ return null;
+ }
+ return contentTypeRegistry.get(artifactExtension.toUpperCase());
+ }
+
+ /**
+ * Build contentType for a specific resource. We first check if the file is
+ * a supported one (looking into our registry based on resource extension)
+ * If not found, we try to check file contentType Or we return
+ * defaultContentType provided
+ *
+ * @param url
+ * @param defaultContentType
+ * @return
+ */
+ public String getContentType(URL resourceURL, String defaultContentType) {
+ URLConnection connection = null;
+ String contentType = defaultContentType;
+
+ if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
+ // Special case : contribution is a folder
+ contentType = ContentType.FOLDER;
+ } else if (resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_META)
+ || resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_GENERATED_META)) {
+ // Special case : contribution metadata
+ contentType = ContentType.CONTRIBUTION_METADATA;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ contentType = connection.getContentType();
+
+ if (contentType == null || contentType.equals("content/unknown")) {
+ // here we couldn't figure out from our registry or from URL and it's not a special file
+ // return defaultContentType if provided
+ contentType = defaultContentType;
+ }
+ } catch (IOException io) {
+ // could not access artifact, just ignore and we will return
+ // null contentType
+ }
+ }
+ }
+ return contentType == null ? defaultContentType : contentType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.java
new file mode 100644
index 0000000000..f06010a0ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionDirectoryWatcher.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.services.deployment;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+@EagerInit
+public class ContributionDirectoryWatcher {
+ private final String path;
+
+ private final ContributionService contributionService;
+
+ public ContributionDirectoryWatcher(@Autowire
+ ContributionService contributionService, @Property(name = "path")
+ String path) {
+ this.path = path;
+ this.contributionService = contributionService;
+ }
+
+ @Init
+ public void init() {
+ File extensionDir = new File(path);
+ if (!extensionDir.isDirectory()) {
+ // we don't have an extension directory, there's nothing to do
+ return;
+ }
+
+ File[] files = extensionDir.listFiles();
+ for (File file : files) {
+ try {
+ if (file.isDirectory()) {
+ this.contributionService.contribute(null, file.toURL(), false);
+ } else {
+ this.contributionService.contribute(null, file.toURL(), true);
+ }
+ } catch (DeploymentException de) {
+ // FIXME handle this
+ de.printStackTrace();
+ } catch (IOException ioe) {
+ // FIXME handle this
+ ioe.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionLoader.java
new file mode 100644
index 0000000000..eef4bd30af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionLoader.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.services.deployment;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.osoa.sca.Constants.SCA_NS;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.model.Contribution;
+import org.apache.tuscany.spi.model.ContributionImport;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Loader that handles &lt;include&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionLoader extends LoaderExtension<Contribution> {
+ private static final QName CONTRIBUTION = new QName(SCA_NS, "contribution");
+ private static final QName DEPLOYABLE = new QName(SCA_NS, "deployable");
+ private static final QName IMPORT = new QName(SCA_NS, "import");
+ private static final QName EXPORT = new QName(SCA_NS, "export");
+
+ @Constructor({"registry"})
+ public ContributionLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return CONTRIBUTION;
+ }
+
+ public Contribution load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+
+ Contribution contribution = new Contribution();
+ while (true) {
+ int event = reader.next();
+ switch (event) {
+ case START_ELEMENT:
+ QName element = reader.getName();
+ if (DEPLOYABLE.equals(element)) {
+ String name = reader.getAttributeValue(null, "composite");
+ if (name == null) {
+ throw new InvalidValueException("Attribute 'composite' is missing");
+ }
+ QName compositeName = null;
+ int index = name.indexOf(':');
+ if (index != -1) {
+ String prefix = name.substring(0, index);
+ String localPart = name.substring(index);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ throw new InvalidValueException("Invalid prefix: " + prefix);
+ }
+ compositeName = new QName(ns, localPart, prefix);
+ } else {
+ String prefix = "";
+ String ns = reader.getNamespaceURI();
+ String localPart = name;
+ compositeName = new QName(ns, localPart, prefix);
+ }
+ contribution.getDeployables().add(compositeName);
+ } else if (IMPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new InvalidValueException("Attribute 'namespace' is missing");
+ }
+ String location = reader.getAttributeValue(null, "location");
+ ContributionImport contributionImport = new ContributionImport();
+ if (location != null) {
+ contributionImport.setLocation(URI.create(location));
+ }
+ contributionImport.setNamespace(ns);
+ contribution.getImports().add(contributionImport);
+ } else if (EXPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new InvalidValueException("Attribute 'namespace' is missing");
+ }
+ contribution.getExports().add(ns);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (CONTRIBUTION.equals(reader.getName())) {
+ return contribution;
+ }
+ break;
+
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.java
new file mode 100644
index 0000000000..47f457d396
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionProcessorRegistryImpl.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 org.apache.tuscany.core.services.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.host.deployment.UnsupportedContentTypeException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.model.Contribution;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Default implementation of ContributionProcessorRegistry
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+@Service(ContributionProcessorRegistry.class)
+public class ContributionProcessorRegistryImpl implements ContributionProcessorRegistry {
+ /**
+ * Processor registry
+ */
+ private Map<String, ContributionProcessor> registry = new HashMap<String, ContributionProcessor>();
+ /**
+ * Helper method to describe contentType for each artifact
+ */
+ private ContentTypeDescriber contentTypeDescriber;
+
+ public ContributionProcessorRegistryImpl(@Autowire ContentTypeDescriber contentTypeDescriber) {
+ if (contentTypeDescriber == null) {
+ this.contentTypeDescriber = new ContentTypeDescriberImpl();
+ } else {
+ this.contentTypeDescriber = contentTypeDescriber;
+ }
+ }
+
+ public void register(String contentType, ContributionProcessor processor) {
+ registry.put(contentType, processor);
+ }
+
+ public void unregister(String contentType) {
+ registry.remove(contentType);
+ }
+
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ throws DeploymentException, IOException {
+
+ URL locationURL = contribution.getArtifact(source).getLocation();
+ String contentType = this.contentTypeDescriber.getContentType(locationURL, null);
+ if (contentType == null) {
+ throw new UnsupportedContentTypeException("Invalid contentType: null");
+ }
+
+ ContributionProcessor processor = this.registry.get(contentType);
+ if (processor == null) {
+ throw new UnsupportedContentTypeException(contentType, locationURL.getPath());
+ }
+ try {
+ processor.processContent(contribution, source, inputStream);
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryImpl.java
new file mode 100644
index 0000000000..b56c7fe263
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryImpl.java
@@ -0,0 +1,275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.util.FileHelper;
+import org.apache.tuscany.core.util.IOHelper;
+import org.apache.tuscany.spi.deployer.ContributionRepository;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * The default implementation of ContributionRepository
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class ContributionRepositoryImpl implements ContributionRepository {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private final File rootFile;
+ private Map<URI, String> contributionMap = new HashMap<URI, String>();
+
+ private URI domain;
+ private XMLInputFactory factory;
+
+ /**
+ * Constructor with repository root
+ *
+ * @param repository
+ */
+ @Constructor
+ public ContributionRepositoryImpl(@Property(name = "repository")
+ final String repository) throws IOException {
+ String root = repository;
+ if (repository == null) {
+ root = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ // Default to <user.home>/.tuscany/domains/local/
+ String userHome = System.getProperty("user.home");
+ String slash = File.separator;
+ return userHome + slash + ".tuscany" + slash + "domains" + slash + "local" + slash;
+ }
+ });
+ }
+ this.rootFile = new File(root);
+ this.domain = rootFile.toURI();
+ FileHelper.forceMkdir(rootFile);
+ if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
+ throw new IOException("The root is not a directory: " + repository);
+ }
+ factory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ public URI getDomain() {
+ return domain;
+ }
+
+ /**
+ * Resolve contribution location in the repository -> root repository /
+ * contribution file -> contribution group id / artifact id / version
+ *
+ * @param contribution
+ * @return
+ */
+ private File mapToFile(URI contribution) {
+ // FIXME: Map the contribution URI to a file?
+ return new File(rootFile, "contributions" + File.separator + contribution.getPath());
+ }
+
+ /**
+ * Write a specific source inputstream to a file on disk
+ *
+ * @param source contents of the file to be written to disk
+ * @param target file to be written
+ * @throws IOException
+ */
+ public static void copy(InputStream source, File target) throws IOException {
+ BufferedOutputStream out = null;
+ BufferedInputStream in = null;
+
+ try {
+ out = new BufferedOutputStream(new FileOutputStream(target));
+ in = new BufferedInputStream(source);
+ IOHelper.copy(in, out);
+ } finally {
+ IOHelper.closeQuietly(out);
+ IOHelper.closeQuietly(in);
+ }
+ }
+
+ public URL store(URI contribution, InputStream contributionStream) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(contribution);
+ FileHelper.forceMkdir(location.getParentFile());
+
+ copy(contributionStream, location);
+
+ // add contribution to repositoryContent
+ URL contributionURL = location.toURL();
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return contributionURL;
+ }
+
+ public URL store(URI contribution, URL sourceURL) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(contribution);
+ File source = FileHelper.toFile(sourceURL);
+ if (source == null || source.isFile()) {
+ InputStream is = sourceURL.openStream();
+ try {
+ return store(contribution, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ FileHelper.forceMkdir(location);
+ FileHelper.copyDirectory(source, location);
+
+ // add contribution to repositoryContent
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return location.toURL();
+ }
+
+ public URL find(URI contribution) {
+ if (contribution == null) {
+ return null;
+ }
+ String location = contributionMap.get(contribution);
+ if (location == null) {
+ return null;
+ }
+ try {
+ return new File(rootFile, location).toURL();
+ } catch (MalformedURLException e) {
+ // Should not happen
+ throw new AssertionError(e);
+ }
+ }
+
+ public void remove(URI contribution) {
+ URL contributionURL = this.find(contribution);
+ if (contributionURL != null) {
+ // remove
+ try {
+ FileHelper.forceDelete(FileHelper.toFile(contributionURL));
+ this.contributionMap.remove(contribution);
+ saveMap();
+ } catch (IOException ioe) {
+ // handle file could not be removed
+ }
+ }
+ }
+
+ public List<URI> list() {
+ return new ArrayList<URI>(contributionMap.keySet());
+ }
+
+ @Init
+ public void init() {
+ File domainFile = new File(rootFile, "sca-domain.xml");
+ if (!domainFile.isFile()) {
+ return;
+ }
+ FileInputStream is;
+ try {
+ is = new FileInputStream(domainFile);
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ try {
+ XMLStreamReader reader = factory.createXMLStreamReader(new InputStreamReader(is, "UTF-8"));
+ while (reader.hasNext()) {
+ switch (reader.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ String name = reader.getName().getLocalPart();
+ if ("domain".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ domain = URI.create(uri);
+ }
+ }
+ if ("contribution".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ String location = reader.getAttributeValue(null, "location");
+ contributionMap.put(URI.create(uri), location);
+ }
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ } catch (Exception e) {
+ // Ignore
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ private void saveMap() {
+ File domainFile = new File(rootFile, "sca-domain.xml");
+ FileOutputStream os = null;
+ try {
+ os = new FileOutputStream(domainFile);
+ PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
+ writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ writer.println("<domain uri=\"" + getDomain() + "\" xmlns=\"" + NS + "\">");
+ for (Map.Entry<URI, String> e : contributionMap.entrySet()) {
+ writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
+ }
+ writer.println("</domain>");
+ writer.flush();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } finally {
+ IOHelper.closeQuietly(os);
+ }
+ }
+
+ @Destroy
+ public void destroy() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java
new file mode 100644
index 0000000000..5d28d5f2ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContributionServiceImpl.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.util.IOHelper;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.deployer.ContributionRepository;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContributionServiceImpl implements ContributionService {
+ /**
+ * Repository where contributions are stored. Usually set by injection.
+ */
+ protected ContributionRepository contributionRepository;
+
+ /**
+ * Registry of available processors. Usually set by injection.
+ */
+ protected ContributionProcessorRegistry processorRegistry;
+
+ /**
+ * xml factory used to create reader instance to load contribution metadata
+ */
+ protected XMLInputFactory xmlFactory;
+ /**
+ * contribution metadata loader
+ */
+ protected ContributionLoader contributionLoader;
+
+
+ /**
+ * Contribution registry This is a registry of processed Contributios index
+ * by URI
+ */
+ protected Map<URI, Contribution> contributionRegistry = new HashMap<URI, Contribution>();
+
+ protected ArtifactResolverRegistry resolverRegistry;
+
+ public ContributionServiceImpl(@Autowire
+ ContributionRepository repository, @Autowire
+ ContributionProcessorRegistry processorRegistry, @Autowire
+ ArtifactResolverRegistry resolverRegistry) {
+ super();
+ this.contributionRepository = repository;
+ this.processorRegistry = processorRegistry;
+ this.resolverRegistry = resolverRegistry;
+
+ this.xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ this.contributionLoader = new ContributionLoader(null);
+ }
+
+ public void contribute(URI contributionURI, URL sourceURL, boolean storeInRepository) throws DeploymentException,
+ IOException {
+ if (contributionURI == null) {
+ throw new IllegalArgumentException("URI for the contribution is null");
+ }
+ if (sourceURL == null) {
+ throw new IllegalArgumentException("Source URL for the contribution is null");
+ }
+
+ addContribution(contributionURI, sourceURL, null, storeInRepository);
+ }
+
+ public void contribute(URI contributionURI, InputStream input) throws DeploymentException, IOException {
+ addContribution(contributionURI, null, input, true);
+ }
+
+ private Contribution initializeContributionMetadata(URL sourceURL) throws DeploymentException {
+ Contribution contributionMetadata = null;
+ URL contributionMetadataURL;
+ URL generatedContributionMetadataURL;
+ InputStream metadataStream = null;
+
+ URL[] clUrls = {sourceURL};
+ URLClassLoader cl = new URLClassLoader(clUrls, getClass().getClassLoader());
+
+ contributionMetadataURL = cl.getResource(Contribution.SCA_CONTRIBUTION_META);
+ generatedContributionMetadataURL = cl.getResource(Contribution.SCA_CONTRIBUTION_GENERATED_META);
+
+ try {
+ if (contributionMetadataURL == null && generatedContributionMetadataURL == null) {
+ contributionMetadata = new Contribution();
+ } else {
+ URL metadataURL =
+ contributionMetadataURL != null ? contributionMetadataURL : generatedContributionMetadataURL;
+
+ try {
+ metadataStream = metadataURL.openStream();
+ XMLStreamReader xmlReader = this.xmlFactory.createXMLStreamReader(metadataStream);
+ contributionMetadata = this.contributionLoader.load(null, null, xmlReader, null);
+
+ } catch (IOException ioe) {
+ throw new
+ InvalidContributionMetadataException(ioe.getMessage(), metadataURL.toExternalForm(), ioe);
+ } catch (XMLStreamException xmle) {
+ throw new
+ InvalidContributionMetadataException(xmle.getMessage(), metadataURL.toExternalForm(), xmle);
+ } catch (LoaderException le) {
+ throw new
+ InvalidContributionMetadataException(le.getMessage(), metadataURL.toExternalForm(), le);
+ }
+ }
+ } finally {
+ IOHelper.closeQuietly(metadataStream);
+ metadataStream = null;
+ }
+
+ if (contributionMetadata == null) {
+ contributionMetadata = new Contribution();
+ }
+
+ return contributionMetadata;
+
+ }
+
+ /**
+ * Note:
+ * @param contributionURI ContributionID
+ * @param sourceURL contribution location
+ * @param contributionStream contribution content
+ * @param storeInRepository flag if we store the contribution into the repository or not
+ * @throws IOException
+ * @throws DeploymentException
+ */
+ private void addContribution(URI contributionURI, URL sourceURL, InputStream contributionStream, boolean storeInRepository)
+ throws IOException, DeploymentException {
+ if (contributionStream == null && sourceURL == null) {
+ throw new IllegalArgumentException("The content of the contribution is null");
+ }
+
+ // store the contribution in the contribution repository
+ URL locationURL = sourceURL;
+ if (contributionRepository != null && storeInRepository) {
+ if (sourceURL != null) {
+ locationURL = contributionRepository.store(contributionURI, sourceURL);
+ } else {
+ locationURL = contributionRepository.store(contributionURI, contributionStream);
+ }
+ }
+
+ Contribution contribution = initializeContributionMetadata(locationURL);
+ contribution.setURI(contributionURI);
+ contribution.setLocation(locationURL);
+
+ if (contributionStream == null) {
+ contributionStream = sourceURL.openStream();
+ try {
+ // process the contribution
+ this.processorRegistry.processContent(contribution, contribution.getUri(), contributionStream);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ contributionStream = null;
+ }
+
+ } else {
+ // process the contribution
+ this.processorRegistry.processContent(contribution, contribution.getUri(), contributionStream);
+ }
+
+
+ // store the contribution on the registry
+ this.contributionRegistry.put(contribution.getUri(), contribution);
+ }
+
+ public Object getContribution(URI id) {
+ return this.contributionRegistry.get(id);
+ }
+
+ public void remove(URI contribution) throws DeploymentException {
+ // remove from repository
+ this.contributionRegistry.remove(contribution);
+ }
+
+ public void addDeploymentComposite(URI contribution, Object composite) {
+ CompositeComponentType model = (CompositeComponentType)composite;
+ URI compositeURI = contribution.resolve(model.getName() + ".composite");
+ DeployedArtifact artifact = new DeployedArtifact(compositeURI);
+ // FIXME: the namespace should be from the CompositeComponentType model
+ artifact.addModelObject(composite.getClass(), null, composite);
+ Contribution contributionObject = (Contribution)getContribution(contribution);
+ contributionObject.addArtifact(artifact);
+ }
+
+ public <T> T resolve(URI contribution, Class<T> definitionType, String namespace, String name) {
+ Contribution contributionObject = (Contribution)getContribution(contribution);
+ return resolverRegistry.resolve(contributionObject, definitionType, namespace, name, null, null);
+ }
+
+ public URL resolve(URI contribution, String namespace, URI uri, URI baseURI) {
+ Contribution contributionObject = (Contribution)getContribution(contribution);
+ return resolverRegistry.resolve(contributionObject, namespace, uri.toString(), baseURI.toString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/DomainUpdateException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/DomainUpdateException.java
new file mode 100644
index 0000000000..65df12f35c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/DomainUpdateException.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.services.deployment;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+public class DomainUpdateException extends DeploymentException {
+ public DomainUpdateException() {
+ }
+
+ public DomainUpdateException(String message) {
+ super(message);
+ }
+
+ public DomainUpdateException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public DomainUpdateException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DomainUpdateException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public DomainUpdateException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidContributionMetadataException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidContributionMetadataException.java
new file mode 100644
index 0000000000..110633e685
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidContributionMetadataException.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.services.deployment;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ * @version $Rev: 511466 $ $Date: 2007-02-25 00:45:22 -0800 (Sun, 25 Feb 2007) $
+ */
+public class InvalidContributionMetadataException extends DeploymentException {
+
+ protected InvalidContributionMetadataException() {
+ }
+
+ protected InvalidContributionMetadataException(String message) {
+ super(message);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected InvalidContributionMetadataException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected InvalidContributionMetadataException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidDocumentException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidDocumentException.java
new file mode 100644
index 0000000000..c4848a3a08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/InvalidDocumentException.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.services.deployment;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidDocumentException extends DeploymentException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8872656291809499499L;
+
+ protected InvalidDocumentException(String rootElement) {
+ super(rootElement);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java
new file mode 100644
index 0000000000..87f68340e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import static javax.xml.stream.XMLStreamConstants.END_DOCUMENT;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
+import org.apache.tuscany.spi.builder.Builder;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.PrepareException;
+import org.apache.tuscany.spi.deployer.ChangeSetHandler;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.Loader;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.host.deployment.ContentTypes;
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLChangeSetHandler implements ChangeSetHandler {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final QName CHANGESET = new QName(NS, "changeSet");
+ private static final QName CREATECOMPONENT = new QName(NS, "createComponent");
+
+ private final RuntimeComponent runtime;
+ private final Builder builder;
+ private final Loader loader;
+ private final XMLInputFactory xmlFactory;
+
+ public XMLChangeSetHandler(RuntimeComponent runtime, Loader loader, Builder builder) {
+ this.runtime = runtime;
+ this.loader = loader;
+ this.builder = builder;
+ xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ public String getContentType() {
+ return ContentTypes.CHANGESET_XML;
+ }
+
+ public void applyChanges(InputStream changeSet) throws DeploymentException, IOException {
+ try {
+ XMLStreamReader xmlReader = xmlFactory.createXMLStreamReader(changeSet);
+ while (true) {
+ switch (xmlReader.next()) {
+ case START_ELEMENT:
+ if (!CHANGESET.equals(xmlReader.getName())) {
+ throw new InvalidDocumentException(xmlReader.getName().toString());
+ }
+ processChanges(xmlReader);
+ break;
+ case END_DOCUMENT:
+ return;
+ }
+ }
+ } catch (XMLStreamException e) {
+ throw (IOException) new IOException(e.getMessage()).initCause(e);
+ }
+ }
+
+ public void processChanges(XMLStreamReader xmlReader) throws XMLStreamException, DeploymentException {
+ while (true) {
+ switch (xmlReader.next()) {
+ case START_ELEMENT:
+ if (CREATECOMPONENT.equals(xmlReader.getName())) {
+ createComponent(xmlReader);
+ } else {
+ // reject unrecognized commands
+ throw new InvalidDocumentException(xmlReader.getName().toString());
+ }
+ break;
+ case END_ELEMENT:
+ return;
+ }
+ }
+ }
+
+ public void createComponent(XMLStreamReader xmlReader) throws XMLStreamException {
+ DeploymentContext deploymentContext = new RootDeploymentContext(null, xmlFactory, null, null);
+ CompositeComponent parent = runtime.getRootComponent();
+ try {
+ ComponentDefinition<?> componentDefinition =
+ (ComponentDefinition<?>) loader.load(parent, null, xmlReader, deploymentContext);
+ Component component = builder.build(parent, componentDefinition, deploymentContext);
+ component.prepare();
+ parent.register(component);
+ } catch (LoaderException e) {
+ // FIXME throw something appropriate
+ throw new AssertionError("FIXME");
+ } catch (BuilderException e) {
+ // FIXME throw something appropriate
+ throw new AssertionError("FIXME");
+ } catch (PrepareException e) {
+ // FIXME throw something appropriate
+ throw new AssertionError("FIXME");
+ } catch (ComponentRegistrationException e) {
+ // FIXME throw something appropriate
+ throw new AssertionError("FIXME");
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessor.java
new file mode 100644
index 0000000000..8309273b3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessor.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Contribution;
+
+public class CompositeContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
+ public static final String CONTENT_TYPE = ContentType.COMPOSITE;
+
+ protected XMLInputFactory xmlFactory;
+ private final LoaderRegistry registry;
+
+ public CompositeContributionProcessor(@Autowire LoaderRegistry registry) {
+ super();
+ this.registry = registry;
+ this.xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
+
+ public void processContent(Contribution contribution, URI artifactURI, InputStream inputStream)
+ throws DeploymentException, IOException {
+ if (artifactURI == null) {
+ throw new IllegalArgumentException("Invalid null source uri.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ try {
+ CompositeClassLoader cl = new CompositeClassLoader(getClass().getClassLoader());
+ cl.addURL(contribution.getLocation());
+ DeploymentContext deploymentContext = new RootDeploymentContext(cl, this.xmlFactory, null,
+ contribution.getArtifact(artifactURI).getLocation());
+
+ CompositeComponentType componentType = this.registry.load(null, null,
+ contribution.getArtifact(artifactURI).getLocation(),
+ CompositeComponentType.class, deploymentContext);
+
+ CompositeImplementation implementation = new CompositeImplementation();
+ implementation.setComponentType(componentType);
+ ComponentDefinition<CompositeImplementation> componentDefinition =
+ new ComponentDefinition<CompositeImplementation>(implementation);
+
+ componentDefinition.setName(componentType.getName());
+
+ contribution.getArtifact(artifactURI).addModelObject(CompositeComponentType.class, null, componentDefinition);
+
+ } catch (LoaderException le) {
+ throw new InvalidComponentDefinitionlException(contribution.getArtifact(artifactURI).getLocation()
+ .toExternalForm(), le);
+ }
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java
new file mode 100644
index 0000000000..3bcfefb1ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessor.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment.contribution;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.core.services.deployment.ContentTypeDescriberImpl;
+import org.apache.tuscany.core.util.FileHelper;
+import org.apache.tuscany.core.util.IOHelper;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+public class FolderContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
+ public static final String CONTENT_TYPE = ContentType.FOLDER;
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
+
+ /**
+ * Recursively traverse a root directory
+ *
+ * @param fileList
+ * @param root
+ * @throws IOException
+ */
+ private void traverse(List<URL> fileList, File root) throws IOException {
+ if (root.isFile()) {
+ fileList.add(root.toURL());
+ } else if (root.isDirectory()) {
+ // FIXME: Maybe we should externalize it as a property
+ // Regular expression to exclude .xxx files
+ File[] files = root.listFiles(FileHelper.getFileFilter("[^\u002e].*", true));
+ for (int i = 0; i < files.length; i++) {
+ traverse(fileList, files[i]);
+ }
+ }
+ }
+
+ /**
+ * Get a list of files from the directory
+ *
+ * @return
+ * @throws IOException
+ */
+ protected List<URL> getArtifacts(URL rootURL) throws DeploymentException,
+ IOException {
+ List<URL> artifacts = new ArrayList<URL>();
+
+ // Assume the root is a jar file
+ File rootFolder;
+
+ try {
+ rootFolder = new File(rootURL.toURI());
+ if (rootFolder.isDirectory()) {
+ this.traverse(artifacts, rootFolder);
+ }
+
+ } catch (URISyntaxException e) {
+ throw new InvalidFolderContributionURIException(rootURL.toExternalForm(), e);
+ }
+
+ return artifacts;
+ }
+
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ throws DeploymentException, IOException {
+ if (contribution == null) {
+ throw new IllegalArgumentException("Invalid null contribution.");
+ }
+
+ if (source == null) {
+ throw new IllegalArgumentException("Invalid null source uri.");
+ }
+
+ URL contributionURL = contribution.getArtifact(source).getLocation();
+
+ for (URL artifactURL : getArtifacts(contributionURL)) {
+ String artifactPath = artifactURL.toExternalForm().substring(contributionURL.toExternalForm().length());
+ URI artifactURI = contribution.getUri().resolve(artifactPath);
+ DeployedArtifact artifact = new DeployedArtifact(artifactURI);
+ artifact.setLocation(artifactURL);
+ contribution.addArtifact(artifact);
+
+ ContentTypeDescriber contentTypeDescriber = new ContentTypeDescriberImpl();
+ String contentType = contentTypeDescriber.getContentType(artifactURL, null);
+
+ // just process scdl and contribution metadata for now
+ if (ContentType.COMPOSITE.equals(contentType)) {
+ InputStream is = artifactURL.openStream();
+ try {
+ this.registry.processContent(contribution, artifactURI, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ is = null;
+ }
+ }
+ }
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ // NOOP
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidComponentDefinitionlException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidComponentDefinitionlException.java
new file mode 100644
index 0000000000..c5c7d8cbf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidComponentDefinitionlException.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.services.deployment.contribution;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidComponentDefinitionlException extends DeploymentException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2724173457894813837L;
+
+ protected InvalidComponentDefinitionlException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidComponentDefinitionlException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidFolderContributionURIException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidFolderContributionURIException.java
new file mode 100644
index 0000000000..0e6ff6b5e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidFolderContributionURIException.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.services.deployment.contribution;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ *
+ */
+public class InvalidFolderContributionURIException extends DeploymentException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1564255850052593282L;
+
+ protected InvalidFolderContributionURIException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidFolderContributionURIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.java
new file mode 100644
index 0000000000..e2d2f12cb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/InvalidPojoComponentDefinitionlException.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.services.deployment.contribution;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidPojoComponentDefinitionlException extends DeploymentException {
+
+ protected InvalidPojoComponentDefinitionlException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidPojoComponentDefinitionlException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java
new file mode 100644
index 0000000000..819c0ce9e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessor.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.core.services.deployment.ContentTypeDescriberImpl;
+import org.apache.tuscany.core.util.IOHelper;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+public class JarContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
+ public static final String CONTENT_TYPE = ContentType.JAR;
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
+
+ /**
+ * Get a list of resources inside the jar
+ *
+ * @return
+ * @throws IOException
+ */
+ protected List<URL> getArtifacts(URL rootURL, InputStream sourceInputStream) throws IOException {
+ List<URL> artifacts = new ArrayList<URL>();
+
+ // Assume the root is a jar file
+ JarInputStream jar = new JarInputStream(sourceInputStream);
+ try {
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+ if (entry.isDirectory()) {
+ continue;
+ }
+
+ // FIXME: Maybe we should externalize the filter as a property
+ if (!entry.getName().startsWith(".")) {
+ artifacts.add(new URL(rootURL, entry.getName()));
+ }
+ }
+ } finally {
+ jar.close();
+ }
+ return artifacts;
+ }
+
+ private URL forceJarURL(URL sourceURL) throws MalformedURLException {
+ if (sourceURL.toString().startsWith("jar:")) {
+ return sourceURL;
+ } else {
+ return new URL("jar:" + sourceURL.toExternalForm() + "!/");
+ }
+
+ }
+
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ throws DeploymentException, IOException {
+ if (contribution == null) {
+ throw new IllegalArgumentException("Invalid null contribution.");
+ }
+
+ if (source == null) {
+ throw new IllegalArgumentException("Invalid null source uri.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ URL sourceURL = contribution.getArtifact(source).getLocation();
+
+ sourceURL = forceJarURL(sourceURL);
+
+ for (URL artifactURL : getArtifacts(sourceURL, inputStream)) {
+ URI artifactURI;
+
+ String artifactPath = artifactURL.toExternalForm().substring(sourceURL.toExternalForm().length());
+ artifactURI = contribution.getUri().resolve(artifactPath);
+ DeployedArtifact artifact = new DeployedArtifact(artifactURI);
+ artifact.setLocation(artifactURL);
+ contribution.addArtifact(artifact);
+
+
+ ContentTypeDescriber contentTypeDescriber = new ContentTypeDescriberImpl();
+ String contentType = contentTypeDescriber.getContentType(artifactURL, null);
+
+ // just process scdl for now
+ if (ContentType.COMPOSITE.equals(contentType)) {
+ InputStream is = IOHelper.getInputStream(artifactURL);
+ try {
+ this.registry.processContent(contribution, artifactURI, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ is = null;
+ }
+ }
+ }
+
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.java
new file mode 100644
index 0000000000..0a95dcc684
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessor.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.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.Introspector;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Contribution;
+import org.osoa.sca.annotations.Constructor;
+
+public class JavaContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
+ public static final String CONTENT_TYPE = ContentType.JAVA;
+ /**
+ * Pojo introspector
+ */
+ private Introspector introspector;
+
+ @Constructor("introspector")
+ public JavaContributionProcessor(@Autowire IntrospectionRegistry introspector) {
+ this.introspector = introspector;
+ }
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
+
+ private String getClazzName(URL clazzURL) {
+ String clazzName;
+
+ clazzName =
+ clazzURL.toExternalForm().substring(clazzURL.toExternalForm().lastIndexOf("!/") + 2,
+ clazzURL.toExternalForm().length() - ".class".length());
+ clazzName = clazzName.replace("/", ".");
+
+ return clazzName;
+ }
+
+ public void processContent(Contribution contribution, URI artifactURI, InputStream inputStream)
+ throws DeploymentException, IOException {
+ if (artifactURI == null) {
+ throw new IllegalArgumentException("Invalid null source uri.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ try {
+ CompositeClassLoader cl = new CompositeClassLoader(getClass().getClassLoader());
+ cl.addURL(contribution.getLocation());
+
+ String clazzName = getClazzName(contribution.getArtifact(artifactURI).getLocation());
+
+ Class clazz = cl.loadClass(clazzName);
+
+ PojoComponentType javaInfo = introspector.introspect(null, clazz, null, null);
+
+ contribution.getArtifact(artifactURI).addModelObject(PojoComponentType.class, null, javaInfo);
+
+ } catch (ClassNotFoundException cnfe) {
+ throw new InvalidPojoComponentDefinitionlException(contribution.getArtifact(artifactURI).getLocation()
+ .toExternalForm(), cnfe);
+ } catch (ProcessingException pe) {
+ throw new InvalidPojoComponentDefinitionlException(contribution.getArtifact(artifactURI).getLocation()
+ .toExternalForm(), pe);
+ }
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ // NOOP
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/MetadataContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/MetadataContributionProcessor.java
new file mode 100644
index 0000000000..63d8320860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/contribution/MetadataContributionProcessor.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.core.services.deployment.contribution;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.core.services.deployment.ContributionLoader;
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.deployer.ContentType;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.Contribution;
+
+public class MetadataContributionProcessor extends ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * Content-type that this processor can handle
+ */
+ public static final String CONTENT_TYPE = ContentType.CONTRIBUTION_METADATA;
+
+ protected XMLInputFactory xmlFactory;
+ protected ContributionLoader contributionLoader;
+
+ public MetadataContributionProcessor() {
+ super();
+ this.xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ this.contributionLoader = new ContributionLoader(null);
+ }
+
+ @Override
+ public String getContentType() {
+ return CONTENT_TYPE;
+ }
+
+ public void processContent(Contribution contribution, URI artifactURI, InputStream inputStream)
+ throws DeploymentException, IOException {
+ if (artifactURI == null) {
+ throw new IllegalArgumentException("Invalid null source uri.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ try {
+ XMLStreamReader xmlReader = this.xmlFactory.createXMLStreamReader(inputStream);
+ Contribution contributionMetadata = this.contributionLoader.load(null, null, xmlReader, null);
+
+ for (QName deployable : contributionMetadata.getDeployables()) {
+ System.out.println("Deployable : " + deployable.toString());
+ }
+
+ } catch (XMLStreamException xmle) {
+ throw new InvalidComponentDefinitionlException(contribution.getArtifact(artifactURI).getLocation()
+ .toExternalForm(), xmle);
+ } catch (LoaderException le){
+ throw new InvalidComponentDefinitionlException(contribution.getArtifact(artifactURI).getLocation()
+ .toExternalForm(), le);
+ }
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/resolver/ComponentDefinitionArtifactResolver.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/resolver/ComponentDefinitionArtifactResolver.java
new file mode 100644
index 0000000000..27586a322e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/resolver/ComponentDefinitionArtifactResolver.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.services.deployment.resolver;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ArtifactResolver;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ArtifactResolverExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+public class ComponentDefinitionArtifactResolver extends ArtifactResolverExtension implements ArtifactResolver {
+
+ public ComponentDefinitionArtifactResolver(@Autowire
+ ArtifactResolverRegistry registry) {
+ super(registry);
+ }
+
+ @Override
+ public Class<?> getType() {
+ return ComponentDefinition.class;
+ }
+
+ public <ComponentDefinition> ComponentDefinition resolve(Contribution contribution,
+ Class<ComponentDefinition> modelClass,
+ String namespace,
+ String name,
+ Map attributes,
+ DeploymentContext context) {
+
+ // generate artifact uri based on it's name
+ URI artifactURI = contribution.getUri().resolve(name);
+ DeployedArtifact artifact = contribution.getArtifact(artifactURI);
+
+ ComponentDefinition componentDefinition =
+ (ComponentDefinition)artifact.getModelObject(CompositeComponentType.class, null);
+ return componentDefinition;
+ }
+
+ public URL resolve(Contribution contribution, String targetNamespace, String location, String baseURI) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/extension/AbstractExtensionDeployer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/extension/AbstractExtensionDeployer.java
new file mode 100644
index 0000000000..cc3339e2b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/extension/AbstractExtensionDeployer.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.extension;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.Deployer;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.builder.BuilderException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractExtensionDeployer {
+ protected Deployer deployer;
+ protected CompositeComponent parent;
+
+ @Autowire
+ public void setDeployer(Deployer deployer) {
+ this.deployer = deployer;
+ }
+
+ @Autowire
+ public void setParent(CompositeComponent parent) {
+ this.parent = parent;
+ }
+
+ protected void deployExtension(File file) {
+ // extension name is file name less any extension
+ String name = file.getName();
+ int dot = name.lastIndexOf('.');
+ if (dot > 0) {
+ name = name.substring(0, dot);
+ }
+ URL url;
+ try {
+ url = file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // toURI should have encoded the URL
+ throw new AssertionError();
+ }
+
+ deployExtension(name, url);
+ }
+
+ protected void deployExtension(String name, URL url) {
+ // FIXME for now, assume this class's ClassLoader is the Tuscany system classloader
+ // FIXME we should really use the one associated with the parent composite
+ CompositeClassLoader extensionCL = new CompositeClassLoader(getClass().getClassLoader());
+
+ // see if the URL points to a composite JAR by looking for a default SCDL file inside it
+ URL scdlLocation;
+ try {
+ scdlLocation = new URL("jar:" + url.toExternalForm() + "!/META-INF/sca/default.scdl");
+ } catch (MalformedURLException e) {
+ // the form of the jar: URL should be correct given url.toExternalForm() worked
+ throw new AssertionError();
+ }
+ try {
+ scdlLocation.openStream().close();
+ // we connected to the SCDL so let's add the JAR file to the classloader
+ extensionCL.addURL(url);
+ } catch (IOException e) {
+ // assume that the URL we were given is not a JAR file so just use the supplied resource
+ scdlLocation = url;
+ }
+
+ // create a ComponentDefinition to represent the component we are going to deploy
+ SystemCompositeImplementation implementation = new SystemCompositeImplementation();
+ implementation.setScdlLocation(scdlLocation);
+ implementation.setClassLoader(extensionCL);
+ ComponentDefinition<SystemCompositeImplementation> definition =
+ new ComponentDefinition<SystemCompositeImplementation>(name, implementation);
+
+ // FIXME: [rfeng] Should we reset the thread context class loader here?
+ // From the debugger with tomcat, the current TCCL is the RealmClassLoader
+ // ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
+ try {
+ // Thread.currentThread().setContextClassLoader(extensionCL);
+ Component component = null;
+ try {
+ component = deployer.deploy(parent, definition);
+ component.start();
+ } catch (BuilderException e) {
+ // FIXME JFM handle the exception
+ e.printStackTrace();
+ } catch (ComponentException e) {
+ // FIXME handle the exception
+ e.printStackTrace();
+ }
+ } catch (LoaderException e) {
+ // FIXME handle the exception
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistry.java
new file mode 100644
index 0000000000..38ce4d16d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistry.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.core.services.host;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.host.ResourceHostRegistry;
+import org.apache.tuscany.spi.host.ResourceResolutionException;
+
+/**
+ * The default implementation of a <code>ResourceRegisty</code> that resolves resources in the <code>SCA://</code>
+ * namespace against its parent composite and delegates resolution to registered <code>ResourceHost</code>s for other
+ * namespaces. The search order for resources resolved by type starts with the SCA namespace and proceeds to hosts in
+ * the order they were registered.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces = {ResourceHost.class, ResourceHostRegistry.class})
+public class DelegatingResourceHostRegistry implements ResourceHost, ResourceHostRegistry {
+ private static final String SCA_PREFIX = "SCA://";
+ private Map<String, ResourceHost> resourceHosts = new HashMap<String, ResourceHost>();
+ private Map<Class<?>, Object> systemResources = new HashMap<Class<?>, Object>();
+ private Map<Key, Object> mappedSystemResources = new HashMap<Key, Object>();
+
+ public DelegatingResourceHostRegistry() {
+ }
+
+ public void registerResourceHost(String uri, ResourceHost host) {
+ resourceHosts.put(uri, host);
+ }
+
+ public void unregisterResourceHost(String uri) {
+ resourceHosts.remove(uri);
+ }
+
+ public void registerResource(Class<?> type, Object resource) {
+ systemResources.put(type, resource);
+ }
+
+ public void registerResource(Class<?> type, String name, Object resource) {
+ mappedSystemResources.put(new Key(type, name), resource);
+ }
+
+ public void unregisterResource(Class<?> type, String name) {
+ mappedSystemResources.remove(new Key(type, name));
+ }
+
+ public void unregisterResource(Class<?> type) {
+ systemResources.remove(type);
+ }
+
+ public <T> T resolveResource(Class<T> type) throws ResourceResolutionException {
+ T instance = type.cast(systemResources.get(type));
+ if (instance == null) {
+ for (ResourceHost host : resourceHosts.values()) {
+ instance = host.resolveResource(type);
+ if (instance != null) {
+ return instance;
+ }
+ }
+ }
+ return instance;
+ }
+
+ public <T> T resolveResource(Class<T> type, String mappedName) throws ResourceResolutionException {
+ if (mappedName.startsWith(SCA_PREFIX)) {
+ String name = mappedName.substring(SCA_PREFIX.length());
+ return type.cast(mappedSystemResources.get(new Key(type, name)));
+ } else {
+ int pos = mappedName.indexOf("://");
+ if (pos == -1) {
+ return type.cast(mappedSystemResources.get(new Key(type, mappedName)));
+ }
+ String uri = mappedName.substring(0, pos + 3);
+ ResourceHost host = resourceHosts.get(uri);
+ if (host == null) {
+ throw new ResourceResolutionException("No resource host for URI", uri);
+ }
+ return host.resolveResource(type, mappedName);
+ }
+ }
+
+ private class Key {
+ private Class<?> clazz;
+ private String name;
+
+ public Key(Class<?> clazz, String name) {
+ this.clazz = clazz;
+ this.name = name;
+ }
+
+ public Key(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Key key = (Key) o;
+
+ if (clazz != null ? !clazz.equals(key.clazz) : key.clazz != null) {
+ return false;
+ }
+ if (name != null ? !name.equals(key.name) : key.name != null) {
+ return false;
+ }
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = clazz != null ? clazz.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ return result;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java
new file mode 100644
index 0000000000..b1a0b67001
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/store/memory/MemoryStore.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.store.memory;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.AbstractEventPublisher;
+import org.apache.tuscany.spi.services.store.DuplicateRecordException;
+import org.apache.tuscany.spi.services.store.RecoveryListener;
+import org.apache.tuscany.spi.services.store.Store;
+import org.apache.tuscany.spi.services.store.StoreExpirationEvent;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+import org.apache.tuscany.spi.services.store.StoreWriteException;
+
+import org.apache.tuscany.api.annotation.Monitor;
+
+/**
+ * Implements a non-durable, non-transactional store using a simple in-memory map
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Store.class)
+@EagerInit
+public class MemoryStore extends AbstractEventPublisher implements Store {
+ private Map<SCAObject, Map<String, Record>> store;
+ // TODO integrate with a core threading scheme
+ private ScheduledExecutorService scheduler;
+ private long reaperInterval = 300000;
+ private StoreMonitor monitor;
+ private long defaultExpirationOffset = 600000; // 10 minutes
+
+ public MemoryStore(@Monitor StoreMonitor monitor) {
+ this.monitor = monitor;
+ this.store = new ConcurrentHashMap<SCAObject, Map<String, Record>>();
+ this.scheduler = Executors.newSingleThreadScheduledExecutor();
+ }
+
+ /**
+ * Returns the maximum default expiration offset for records in the store
+ *
+ * @return the maximum default expiration offset for records in the store
+ */
+ public long getDefaultExpirationOffset() {
+ return defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the maximum default expiration offset for records in the store
+ */
+ @Property
+ public void setDefaultExpirationOffset(long defaultExpirationOffset) {
+ this.defaultExpirationOffset = defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the interval for expired entry scanning to be performed
+ */
+ @Property
+ public void setReaperInterval(long reaperInterval) {
+ this.reaperInterval = reaperInterval;
+ }
+
+ public long getReaperInterval() {
+ return reaperInterval;
+ }
+
+ @Init
+ public void init() {
+ scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS);
+ monitor.start("In-memory store started");
+ }
+
+ @Destroy
+ public void destroy() {
+ scheduler.shutdown();
+ monitor.stop("In-memory store stopped");
+ }
+
+ public void insertRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ map = new ConcurrentHashMap<String, Record>();
+ store.put(owner, map);
+ }
+ if (map.containsKey(id)) {
+ throw new DuplicateRecordException(owner.getCanonicalName(), id);
+ }
+ map.put(id, new Record(object, expiration));
+ }
+
+ public void updateRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ throw new StoreWriteException("Record not found", owner.getCanonicalName(), id);
+ }
+ Record record = map.get(id);
+ if (record == null) {
+ throw new StoreWriteException("Record not found", owner.getCanonicalName(), id);
+ }
+ record.data = object;
+ }
+
+ public Object readRecord(SCAObject owner, String id) {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ return null;
+ }
+ Record record = map.get(id);
+ if (record != null) {
+ return record.data;
+ }
+ return null;
+ }
+
+ public void removeRecords() {
+ store.clear();
+ }
+
+ public void removeRecord(SCAObject owner, String id) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ throw new StoreWriteException("Owner not found", owner.getCanonicalName(), id);
+ }
+ if (map.remove(id) == null) {
+ throw new StoreWriteException("Owner not found", owner.getCanonicalName(), id);
+ }
+ }
+
+ public void recover(RecoveryListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ private class Record {
+ private Object data;
+ private long expiration = NEVER;
+
+ public Record(Object data, long expiration) {
+ this.data = data;
+ this.expiration = expiration;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public long getExpiration() {
+ return expiration;
+ }
+ }
+
+ private class Reaper implements Runnable {
+
+ public void run() {
+ long now = System.currentTimeMillis();
+ for (Map.Entry<SCAObject, Map<String, Record>> entries : store.entrySet()) {
+ for (Map.Entry<String, Record> entry : entries.getValue().entrySet()) {
+ final long expiration = entry.getValue().expiration;
+ if (expiration != NEVER && now >= expiration) {
+ SCAObject owner = entries.getKey();
+ Object instance = entry.getValue().getData();
+ // notify listeners of the expiration
+ StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance);
+ publish(event);
+ entries.getValue().remove(entry.getKey());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jca/JcaWorkScheduler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jca/JcaWorkScheduler.java
new file mode 100644
index 0000000000..79b7bf4ca1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jca/JcaWorkScheduler.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.work.jca;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkEvent;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkListener;
+import javax.resource.spi.work.WorkManager;
+import javax.resource.spi.work.WorkRejectedException;
+
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.services.work.WorkSchedulerException;
+
+/**
+ * A work scheduler implementation based on the JCA SPI work manager.
+ * <p/>
+ * <p/>
+ * This needs a JCA SPI work manager implementation available for scheduling work. Instances can be configured with a
+ * work manager implementation that is injected in. It is the responsibility of the runtime environment to make a work
+ * manager implementaion available. </p>
+ */
+public class JcaWorkScheduler implements WorkScheduler {
+
+ /**
+ * Underlying JCA work manager
+ */
+ private WorkManager jcaWorkManager;
+
+ /**
+ * Initializes the JCA work manager.
+ *
+ * @param jcaWorkManager JCA work manager.
+ */
+ public JcaWorkScheduler(WorkManager jcaWorkManager) {
+
+ if (jcaWorkManager == null) {
+ throw new IllegalArgumentException("Work manager cannot be null");
+ }
+ this.jcaWorkManager = jcaWorkManager;
+
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ public <T extends Runnable> void scheduleWork(T work) {
+ scheduleWork(work, null);
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+
+ if (work == null) {
+ throw new IllegalArgumentException("Work cannot be null");
+ }
+
+ JcaWork<T> jcaWork = new JcaWork<T>(work);
+ try {
+ if (listener == null) {
+ jcaWorkManager.scheduleWork(jcaWork);
+ } else {
+ JcaWorkListener<T> jcaWorkListener = new JcaWorkListener<T>(listener);
+ // TODO Clarify the usage of timeout and execution context
+ jcaWorkManager.scheduleWork(jcaWork, -1, null, jcaWorkListener);
+ }
+ } catch (WorkRejectedException ex) {
+ if (listener != null) {
+ listener.workRejected(work);
+ } else {
+ throw new WorkSchedulerException(ex);
+ }
+ } catch (WorkException ex) {
+ throw new WorkSchedulerException(ex);
+ }
+
+ }
+
+ /*
+ * Worklistener for keeping track of work status callbacks.
+ *
+ */
+ private class JcaWorkListener<T extends Runnable> implements WorkListener {
+
+ // Notification listener
+ private NotificationListener<T> listener;
+
+ /*
+ * Initializes the notification listener.
+ */
+ public JcaWorkListener(NotificationListener<T> listener) {
+ this.listener = listener;
+ }
+
+ /*
+ * Callback when the work is accepted.
+ */
+ public void workAccepted(WorkEvent workEvent) {
+ T work = getWork(workEvent);
+ listener.workAccepted(work);
+ }
+
+ /*
+ * Callback when the work is rejected.
+ */
+ public void workRejected(WorkEvent workEvent) {
+ T work = getWork(workEvent);
+ listener.workRejected(work);
+ }
+
+ /*
+ * Callback when the work is started.
+ */
+ public void workStarted(WorkEvent workEvent) {
+ T work = getWork(workEvent);
+ listener.workStarted(work);
+ }
+
+ /*
+ * Callback when the work is completed.
+ */
+ public void workCompleted(WorkEvent workEvent) {
+ T work = getWork(workEvent);
+ Exception exception = workEvent.getException();
+ if (exception != null) {
+ listener.workFailed(work, exception);
+ } else {
+ listener.workCompleted(work);
+ }
+ }
+
+ /*
+ * Gets the underlying work from the work event.
+ */
+ @SuppressWarnings("unchecked")
+ private T getWork(WorkEvent workEvent) {
+ JcaWork<T> jcaWork = (JcaWork<T>) workEvent.getWork();
+ return jcaWork.getWork();
+ }
+
+ }
+
+ /*
+ * JCA work wrapper.
+ */
+ private class JcaWork<T extends Runnable> implements Work {
+
+ // Work that is being executed.
+ private T work;
+
+ /*
+ * Initializes the work instance.
+ */
+ public JcaWork(T work) {
+ this.work = work;
+ }
+
+ /*
+ * Releases the work.
+ */
+ public void release() {
+ }
+
+ /*
+ * Performs the work.
+ */
+ public void run() {
+ work.run();
+ }
+
+ /*
+ * Returns the completed work.
+ */
+ public T getWork() {
+ return work;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkScheduler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkScheduler.java
new file mode 100644
index 0000000000..8fa8000477
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkScheduler.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.services.work.jsr237;
+
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.services.work.WorkSchedulerException;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+
+/**
+ * A work scheduler implementation based on a JSR 237 work manager.
+ * <p/>
+ * <p/>
+ * This needs a JSR 237 work manager implementation available for scheduling work. Instances can be configured with a
+ * work manager implementation that is injected in. It is the responsibility of the runtime environment to make a work
+ * manager implementaion available. For example, if the managed environment supports work manager the runtime can use
+ * the appropriate lookup mechanism to inject the work manager implementation. </p>
+ */
+@Scope("COMPOSITE")
+public class Jsr237WorkScheduler implements WorkScheduler {
+
+ /**
+ * Underlying JSR-237 work manager
+ */
+ private WorkManager jsr237WorkManager;
+
+ /**
+ * Initializes the JSR 237 work manager.
+ *
+ * @param jsr237WorkManager JSR 237 work manager.
+ */
+ public Jsr237WorkScheduler(@Autowire WorkManager jsr237WorkManager) {
+ if (jsr237WorkManager == null) {
+ throw new IllegalArgumentException("Work manager cannot be null");
+ }
+ this.jsr237WorkManager = jsr237WorkManager;
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ public <T extends Runnable> void scheduleWork(T work) {
+ scheduleWork(work, null);
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+
+ if (work == null) {
+ throw new IllegalArgumentException("Work cannot be null");
+ }
+
+ Jsr237Work<T> jsr237Work = new Jsr237Work<T>(work);
+ try {
+ if (listener == null) {
+ jsr237WorkManager.schedule(jsr237Work);
+ } else {
+ Jsr237WorkListener<T> jsr237WorkListener = new Jsr237WorkListener<T>(listener, work);
+ jsr237WorkManager.schedule(jsr237Work, jsr237WorkListener);
+ }
+ } catch (WorkRejectedException ex) {
+ if (listener != null) {
+ listener.workRejected(work);
+ } else {
+ throw new WorkSchedulerException(ex);
+ }
+ } catch (WorkException ex) {
+ throw new WorkSchedulerException(ex);
+ }
+
+ }
+
+ /*
+ * Worklistener for keeping track of work status callbacks.
+ *
+ */
+ private class Jsr237WorkListener<T extends Runnable> implements WorkListener {
+
+ // Notification listener
+ private NotificationListener<T> listener;
+
+ // Work
+ private T work;
+
+ /*
+ * Initializes the notification listener.
+ */
+ public Jsr237WorkListener(NotificationListener<T> listener, T work) {
+ this.listener = listener;
+ this.work = work;
+ }
+
+ /*
+ * Callback when the work is accepted.
+ */
+ public void workAccepted(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workAccepted(work);
+ }
+
+ /*
+ * Callback when the work is rejected.
+ */
+ public void workRejected(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workRejected(work);
+ }
+
+ /*
+ * Callback when the work is started.
+ */
+ public void workStarted(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workStarted(work);
+ }
+
+ /*
+ * Callback when the work is completed.
+ */
+ public void workCompleted(WorkEvent workEvent) {
+ T work = getWork();
+ Exception exception = workEvent.getException();
+ if (exception != null) {
+ listener.workFailed(work, exception);
+ } else {
+ listener.workCompleted(work);
+ }
+ }
+
+ /*
+ * Gets the underlying work from the work event.
+ */
+ private T getWork() {
+ return work;
+ }
+
+ }
+
+ /*
+ * JCA work wrapper.
+ */
+ private class Jsr237Work<T extends Runnable> implements Work {
+
+ // Work that is being executed.
+ private T work;
+
+ /*
+ * Initializes the work instance.
+ */
+ public Jsr237Work(T work) {
+ this.work = work;
+ }
+
+ /*
+ * Returns the completed work.
+ */
+ public T getWork() {
+ return work;
+ }
+
+ /*
+ * Release the work.
+ */
+ public void release() {
+ }
+
+ /*
+ * Work attributes are not daemon.
+ */
+ public boolean isDaemon() {
+ return false;
+ }
+
+ /*
+ * Runs the work.
+ */
+ public void run() {
+ work.run();
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkEvent.java
new file mode 100644
index 0000000000..c391d0b597
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkEvent.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.services.work.jsr237.workmanager;
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * Default immutable implementation of the <code>WorkEvent</code> class.
+ */
+class DefaultWorkEvent implements WorkEvent {
+
+ // Work item for this event
+ private WorkItem workItem;
+
+ // Exception if something has gone wrong
+ private WorkException exception;
+
+ /**
+ * Instantiates the event.
+ *
+ * @param workItem Work item for this event.
+ */
+ public DefaultWorkEvent(final DefaultWorkItem workItem) {
+ this.workItem = workItem;
+ this.exception = workItem.getException();
+ }
+
+ /**
+ * Returns the work type based on whether the work was accepted, started,
+ * rejected or completed.
+ *
+ * @return Work type.
+ */
+ public int getType() {
+ return workItem.getStatus();
+ }
+
+ /**
+ * Returns the work item associated with this work type.
+ *
+ * @return Work item.
+ */
+ public WorkItem getWorkItem() {
+ return workItem;
+ }
+
+ /**
+ * Returns the exception if the work completed with an exception.
+ *
+ * @return Work exception.
+ */
+ public WorkException getException() {
+ return exception;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkItem.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkItem.java
new file mode 100644
index 0000000000..0adc005bb0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/DefaultWorkItem.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.work.jsr237.workmanager;
+
+import commonj.work.Work;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * An identity based immutable implementation of the <code>WorkItem</code>
+ * interface.
+ *
+ */
+class DefaultWorkItem implements WorkItem {
+
+ // Id scoped for the VM
+ private String id;
+
+ // Status
+ private int status = -1;
+
+ // Result
+ private Work result;
+
+ // Original work
+ private Work originalWork;
+
+ // Exception
+ private WorkException exception;
+
+ /**
+ * Instantiates an id for this item.
+ *
+ * @param id of this work event.
+ */
+ protected DefaultWorkItem(final String id, final Work orginalWork) {
+ this.id = id;
+ this.originalWork = orginalWork;
+ }
+
+ /**
+ * Returns the id.
+ *
+ * @return Id of this item.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the original work.
+ *
+ * @return Original work.
+ */
+ public Work getOriginalWork() {
+ return originalWork;
+ }
+
+ /**
+ * Returns the work result if the work completed.
+ *
+ * @return Work.
+ * @throws WorkException If the work completed with an exception.
+ */
+ public Work getResult() throws WorkException {
+ return result;
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param result Result.
+ */
+ protected void setResult(final Work result) {
+ this.result = result;
+ }
+
+ /**
+ * Returns the exception if work completed with an exception.
+ *
+ * @return Work exception.
+ */
+ protected WorkException getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the exception.
+ *
+ * @param exception Exception.
+ */
+ protected void setException(final WorkException exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * Returns the work type based on whether the work was accepted, started,
+ * rejected or completed.
+ *
+ * @return Work status.
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status Status.
+ */
+ protected void setStatus(final int status) {
+ this.status = status;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @param obj Object to be compared.
+ * @return true if this object is the same as the obj argument; false
+ * otherwise..
+ */
+ public boolean equals(final Object obj) {
+ return (obj != null) && (obj.getClass() == DefaultWorkItem.class) && ((DefaultWorkItem) obj).id.equals(id);
+ }
+
+ /**
+ * Compares this object with the specified object for order. Returns a
+ * negative integer, zero, or a positive integer as this object is less
+ * than, equal to, or greater than the specified object.
+ *
+ * @param o Object to be compared.
+ * @return A negative integer, zero, or a positive integer as this object
+ * is less than, equal to, or greater than the specified object.
+ * @throws ClassCastException needs better documentation.
+ */
+ public int compareTo(final Object o) {
+ if (o.getClass() != DefaultWorkItem.class) {
+ throw new ClassCastException(o.getClass().getName());
+ } else {
+ return ((DefaultWorkItem) o).getId().compareTo(getId());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManager.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManager.java
new file mode 100644
index 0000000000..1a7639b41d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManager.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.work.jsr237.workmanager;
+
+import java.rmi.server.UID;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Property;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+
+/**
+ * A thread-pool based implementation for the JSR-237 work manager.
+ * <p/>
+ * <p/>
+ * This implementation supports only local work.
+ * <p/>
+ * TODO Elaborate the implementation. </p>
+ */
+public class ThreadPoolWorkManager implements WorkManager {
+
+ // Map of work items currently handled by the work manager
+ private Map<DefaultWorkItem, WorkListener> workItems = new ConcurrentHashMap<DefaultWorkItem, WorkListener>();
+
+ // Thread-pool
+ private ExecutorService executor;
+
+ /**
+ * Initializes the thread-pool.
+ *
+ * @param threadPoolSize Thread-pool size.
+ */
+ public ThreadPoolWorkManager(@Property(name = "poolSize") int threadPoolSize) {
+ executor = Executors.newFixedThreadPool(threadPoolSize);
+ }
+
+ /**
+ * Schedules a unit of work asynchronously.
+ *
+ * @param work Work that needs to be scheduled.
+ * @return Work Work item representing the asynchronous work
+ */
+ public WorkItem schedule(Work work) throws WorkException {
+ return schedule(work, null);
+ }
+
+ /**
+ * Schedules a unit of work asynchronously.
+ *
+ * @param work Work that needs to be scheduled.
+ * @param workListener Work listener for callbacks.
+ * @return Work Work item representing the asynchronous work
+ */
+ public WorkItem schedule(Work work, WorkListener workListener) throws WorkRejectedException {
+
+ DefaultWorkItem workItem = new DefaultWorkItem(new UID().toString(), work);
+ if (workListener != null) {
+ workItems.put(workItem, workListener);
+ }
+ workAccepted(workItem, work);
+ if (scheduleWork(work, workItem)) {
+ return workItem;
+ } else {
+ workItem.setStatus(WorkEvent.WORK_REJECTED);
+ if (workListener != null) {
+ workListener.workRejected(new DefaultWorkEvent(workItem));
+ }
+ throw new WorkRejectedException("Unable to schedule work");
+ }
+ }
+
+ /**
+ * Wait for all the specified units of work to finish.
+ *
+ * @param works Units of the work that need to finish.
+ * @param timeout Timeout for waiting for the units of work to finish.
+ */
+ public boolean waitForAll(Collection works, long timeout) {
+ throw new UnsupportedOperationException("waitForAll not supported");
+ }
+
+ /**
+ * Wait for any of the specified units of work to finish.
+ *
+ * @param works Units of the work that need to finish.
+ * @param timeout Timeout for waiting for the units of work to finish.
+ */
+ public Collection waitForAny(Collection works, long timeout) {
+ throw new UnsupportedOperationException("waitForAny not supported");
+ }
+
+ /**
+ * Method provided for subclasses to indicate a work accptance.
+ *
+ * @param workItem Work item representing the work that was accepted.
+ * @param work Work that was accepted.
+ */
+ private void workAccepted(final DefaultWorkItem workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_ACCEPTED);
+ WorkEvent event = new DefaultWorkEvent(workItem);
+ listener.workAccepted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work start.
+ */
+ private void workStarted(final DefaultWorkItem workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_STARTED);
+ WorkEvent event = new DefaultWorkEvent(workItem);
+ listener.workStarted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final DefaultWorkItem workItem, final Work work) {
+ workCompleted(workItem, work, null);
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final DefaultWorkItem workItem, final Work work, final WorkException exception) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_COMPLETED);
+ workItem.setResult(work);
+ workItem.setException(exception);
+ WorkEvent event = new DefaultWorkEvent(workItem);
+ listener.workCompleted(event);
+ workItems.remove(workItem);
+ }
+ }
+
+ /*
+ * Schedules the work using the threadpool.
+ */
+ private boolean scheduleWork(final Work work, final DefaultWorkItem workItem) {
+ try {
+ executor.execute(new DecoratingWork(workItem, work));
+ return true;
+ } catch (RejectedExecutionException ex) {
+ return false;
+ }
+ }
+
+ /*
+ * Class that decorates the original worker so that it can get callbacks when work is done.
+ */
+ private final class DecoratingWork implements Runnable {
+
+ // Work item for this work.
+ private DefaultWorkItem workItem;
+
+ // The original work.
+ private Work decoratedWork;
+
+ /*
+ * Initializes the work item and underlying work.
+ */
+ private DecoratingWork(final DefaultWorkItem workItem, final Work decoratedWork) {
+ this.workItem = workItem;
+ this.decoratedWork = decoratedWork;
+ }
+
+ /*
+ * Overrides the run method.
+ */
+ public void run() {
+ workStarted(workItem, decoratedWork);
+ try {
+ decoratedWork.run();
+ workCompleted(workItem, decoratedWork);
+ } catch (Throwable th) {
+ workCompleted(workItem, decoratedWork, new WorkException(th.getMessage(), th));
+ }
+ }
+
+ }
+
+ @Destroy
+ public void destroy() {
+ executor.shutdown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/test/SCATestCaseRunner.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/test/SCATestCaseRunner.java
new file mode 100644
index 0000000000..191dacdf0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/test/SCATestCaseRunner.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCATestCaseRunner {
+
+ private ClassLoader classLoader;
+ private Class<?> testSuiteClass;
+ private Object testSuite;
+ private Class<?> testResultClass;
+ private Class<?> testCaseClass;
+ private Object testCase;
+
+ private Class<?> beforeAnnotation;
+ private Class<?> beforeClassAnnotation;
+ private Class<?> afterAnnotation;
+ private Class<?> afterClassAnnotation;
+ private Class<?> junit4AdapterClass;
+ private Class<?> junit3TestCaseClass;
+
+ /**
+ * Constructs a new TestCase runner.
+ *
+ * @param testClass
+ */
+ public SCATestCaseRunner(Class testClass) {
+ try {
+ classLoader = (URLClassLoader)testClass.getClassLoader();
+ if (classLoader instanceof URLClassLoader) {
+ URL[] urls = ((URLClassLoader)classLoader).getURLs();
+ classLoader = new URLClassLoader(urls, classLoader.getParent());
+ } else {
+ classLoader = new URLClassLoader(new URL[0], classLoader);
+ }
+
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ testCaseClass = Class.forName(testClass.getName(), true, classLoader);
+ testCase = testCaseClass.newInstance();
+
+ junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, classLoader);
+
+ testSuiteClass = Class.forName("junit.framework.TestSuite", true, classLoader);
+ Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
+ testSuite = testSuiteConstructor.newInstance(testCaseClass);
+
+ testResultClass = Class.forName("junit.framework.TestResult", true, classLoader);
+
+ try {
+ beforeAnnotation = Class.forName("org.junit.Before", true, classLoader);
+ afterAnnotation = Class.forName("org.junit.After", true, classLoader);
+ beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, classLoader);
+ afterClassAnnotation = Class.forName("org.junit.AfterClass", true, classLoader);
+ junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, classLoader);
+ } catch (Exception e) {
+ // Unexpected
+ throw new AssertionError(e);
+ }
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Run the test case
+ */
+ public void run() {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) {
+ Object testResult = testResultClass.newInstance();
+ Method runMethod = testSuiteClass.getMethod("run", testResultClass);
+ runMethod.invoke(testSuite, testResult);
+ } else {
+ Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass);
+ Object testResult = testResultClass.newInstance();
+ Method runMethod = junit4AdapterClass.getMethod("run", testResultClass);
+ runMethod.invoke(junit4Adapter, testResult);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Invoke the setUp method
+ */
+ public void setUp() {
+ execute("setUp");
+ }
+
+ /**
+ * Invoke the before methods
+ */
+ public void before() {
+ execute(beforeAnnotation);
+ }
+
+ /**
+ * Invoke the beforeClass methods
+ */
+ public void beforeClass() {
+ execute(beforeClassAnnotation);
+ }
+
+ /**
+ * Invoke the tearDown method
+ */
+ public void tearDown() {
+ execute("tearDown");
+ }
+
+ /**
+ * Invoke the after methods
+ */
+ public void after() {
+ execute(afterAnnotation);
+ }
+
+ /**
+ * Invoke the afterClass methods
+ */
+ public void afterClass() {
+ execute(afterClassAnnotation);
+ }
+
+ /**
+ * Invoke the specified test method.
+ */
+ public void run(String methodName) {
+ execute(methodName);
+ }
+
+ /**
+ * Invoke the methods annotated with the specified annotation.
+ */
+ private void execute(Class<?> annotationClass) {
+ if (annotationClass == null) {
+ throw new RuntimeException(new NoSuchMethodException());
+ }
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ for (Method method : testCaseClass.getDeclaredMethods()) {
+ for (Annotation annotation : method.getAnnotations()) {
+ if (annotation.annotationType() == annotationClass) {
+ method.invoke(testCase);
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Invoke the specified method
+ */
+ private void execute(String methodName) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ Method setUpMethod = testCaseClass.getDeclaredMethod(methodName);
+ setUpMethod.setAccessible(true);
+ setUpMethod.invoke(testCase);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
new file mode 100644
index 0000000000..a8c57db9d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.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.util;
+
+import java.io.File;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URLClassLoader;
+
+/**
+ * Functions to create & manipulate classloaders.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public final class ClassLoaderHelper {
+ /**
+ * Hide constructor
+ */
+ private ClassLoaderHelper() {
+ }
+
+ /**
+ * Create a classloader for the supplied classpath.
+ *
+ * @param path a list of file/directory names separated by the platform path separator
+ * @param parent the parent for the new classloader
+ * @return a classloader that will load classes from the supplied path
+ */
+ public static ClassLoader createClassLoader(ClassLoader parent, String path) {
+ String[] files = path.split(File.pathSeparator);
+ return createClassLoader(parent, files);
+ }
+
+ /**
+ * Create a classloader for a classpath supplied as individual file names.
+ *
+ * @param files a list of file/directory names
+ * @param parent the parent for the new classloader
+ * @return a classloader that will load classes from the supplied path
+ */
+ public static ClassLoader createClassLoader(ClassLoader parent, String[] files) {
+ URL[] urls = new URL[files.length];
+ for (int i = 0; i < files.length; i++) {
+ try {
+ File file = new File(files[i]);
+ urls[i] = file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // just ignore this value
+ continue;
+ }
+ }
+
+ return new URLClassLoader(urls, parent);
+ }
+
+ /**
+ * Create a classloader for a classpath supplied as a list of files.
+ *
+ * @param files a list of files
+ * @param parent the parent for the new classloader
+ * @return a classloader that will load classes from the supplied path
+ */
+ public static ClassLoader createClassLoader(ClassLoader parent, File[] files) {
+ URL[] urls = new URL[files.length];
+ for (int i = 0; i < files.length; i++) {
+ try {
+ File file = files[i];
+ urls[i] = file.toURI().toURL();
+ } catch (MalformedURLException e) {
+
+ continue;
+ }
+ }
+ return new URLClassLoader(urls, parent);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java
new file mode 100644
index 0000000000..2544c90846
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/FileHelper.java
@@ -0,0 +1,704 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.regex.Pattern;
+
+public class FileHelper {
+ /**
+ * The extension separator character.
+ */
+ private static final char EXTENSION_SEPARATOR = '.';
+
+ /**
+ * The Unix separator character.
+ */
+ private static final char UNIX_SEPARATOR = '/';
+
+ /**
+ * The Windows separator character.
+ */
+ private static final char WINDOWS_SEPARATOR = '\\';
+
+ protected FileHelper() {
+ }
+
+ /**
+ * Returns the index of the last directory separator character.
+ * <p>
+ * This method will handle a file in either Unix or Windows format. The
+ * position of the last forward or backslash is returned.
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to find the last path separator in, null
+ * returns -1
+ * @return the index of the last separator character, or -1 if there is no
+ * such character
+ */
+ public static int indexOfLastSeparator(String filename) {
+ if (filename == null) {
+ return -1;
+ }
+ int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR);
+ int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR);
+ return Math.max(lastUnixPos, lastWindowsPos);
+ }
+
+ /**
+ * Returns the index of the last extension separator character, which is a
+ * dot.
+ * <p>
+ * This method also checks that there is no directory separator after the
+ * last dot. To do this it uses {@link #indexOfLastSeparator(String)} which
+ * will handle a file in either Unix or Windows format.
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to find the last path separator in, null
+ * returns -1
+ * @return the index of the last separator character, or -1 if there is no
+ * such character
+ */
+ public static int indexOfExtension(String filename) {
+ if (filename == null) {
+ return -1;
+ }
+ int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR);
+ int lastSeparator = indexOfLastSeparator(filename);
+ return lastSeparator > extensionPos ? -1 : extensionPos;
+ }
+
+ /**
+ * Gets the name minus the path from a full filename.
+ * <p>
+ * This method will handle a file in either Unix or Windows format. The text
+ * after the last forward or backslash is returned.
+ *
+ * <pre>
+ * a/b/c.txt --&gt; c.txt
+ * a.txt --&gt; a.txt
+ * a/b/c --&gt; c
+ * a/b/c/ --&gt; &quot;&quot;
+ * </pre>
+ *
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param fileName the filename to query, null returns null
+ * @return the name of the file without the path, or an empty string if none
+ * exists
+ */
+ public static String getName(String fileName) {
+ if (fileName == null) {
+ return null;
+ }
+ int index = indexOfLastSeparator(fileName);
+ return fileName.substring(index + 1);
+ }
+
+ /**
+ * Gets the extension of a filename.
+ * <p>
+ * This method returns the textual part of the filename after the last dot.
+ * There must be no directory separator after the dot.
+ *
+ * <pre>
+ * foo.txt --&gt; &quot;txt&quot;
+ * a/b/c.jpg --&gt; &quot;jpg&quot;
+ * a/b.txt/c --&gt; &quot;&quot;
+ * a/b/c --&gt; &quot;&quot;
+ * </pre>
+ *
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to retrieve the extension of.
+ * @return the extension of the file or an empty string if none exists.
+ */
+ public static String getExtension(String filename) {
+ if (filename == null) {
+ return null;
+ }
+ int index = indexOfExtension(filename);
+ if (index == -1) {
+ return "";
+ } else {
+ return filename.substring(index + 1);
+ }
+ }
+
+ /**
+ * Make a directory, including any necessary but nonexistent parent
+ * directories. If there already exists a file with specified name or the
+ * directory cannot be created then an exception is thrown.
+ *
+ * @param directory directory to create, not null
+ * @throws NullPointerException if the directory is null
+ * @throws IOException if the directory cannot be created
+ */
+ public static void forceMkdir(File directory) throws IOException {
+ if (directory.exists()) {
+ if (directory.isFile()) {
+ String message =
+ "File " + directory + " exists and is " + "not a directory. Unable to create directory.";
+ throw new IOException(message);
+ }
+ } else {
+ if (!directory.mkdirs()) {
+ String message = "Unable to create directory " + directory;
+ throw new IOException(message);
+ }
+ }
+ }
+
+ /**
+ * Delete a file. If file is a directory, delete it and all sub-directories.
+ * <p>
+ * The difference between File.delete() and this method are:
+ * <ul>
+ * <li>A directory to be deleted does not have to be empty.</li>
+ * <li>You get exceptions when a file or directory cannot be deleted.
+ * (java.io.File methods returns a boolean)</li>
+ * </ul>
+ *
+ * @param file file or directory to delete, not null
+ * @throws NullPointerException if the directory is null
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void forceDelete(File file) throws IOException {
+ if (file.isDirectory()) {
+ deleteDirectory(file);
+ } else {
+ if (!file.exists()) {
+ throw new FileNotFoundException("File does not exist: " + file);
+ }
+ if (!file.delete()) {
+ String message = "Unable to delete file: " + file;
+ throw new IOException(message);
+ }
+ }
+ }
+
+ /**
+ * Convert from a <code>URL</code> to a <code>File</code>.
+ * <p>
+ * From version 1.1 this method will decode the URL. Syntax such as
+ * <code>file:///my%20docs/file.txt</code> will be correctly decoded to
+ * <code>/my docs/file.txt</code>.
+ *
+ * @param url the file URL to convert, null returns null
+ * @return the equivalent <code>File</code> object, or <code>null</code>
+ * if the URL's protocol is not <code>file</code>
+ * @throws IllegalArgumentException if the file is incorrectly encoded
+ */
+ public static File toFile(URL url) {
+ if (url == null || !url.getProtocol().equals("file")) {
+ return null;
+ } else {
+ String filename = url.getFile().replace('/', File.separatorChar);
+ int pos = 0;
+ while ((pos = filename.indexOf('%', pos)) >= 0) { // NOPMD
+ if (pos + 2 < filename.length()) {
+ String hexStr = filename.substring(pos + 1, pos + 3);
+ char ch = (char)Integer.parseInt(hexStr, 16);
+ filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
+ }
+ }
+ return new File(filename);
+ }
+ }
+
+ public static FileFilter getFileFilter(String regExp, boolean ignoreCase) {
+ return new RegExpFilter(regExp, ignoreCase);
+ }
+
+ /**
+ * A regular-expression based resource filter
+ */
+ public static class RegExpFilter implements FileFilter {
+ private Pattern pattern;
+
+ public RegExpFilter(Pattern pattern) {
+ this.pattern = pattern;
+ }
+
+ public RegExpFilter(String patternStr, boolean ignoreCase) {
+ this.pattern = Pattern.compile(patternStr, ignoreCase ? Pattern.CASE_INSENSITIVE : 0);
+ }
+
+ public boolean accept(File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ /**
+ * Convert wildcard into a regex pattern
+ *
+ * @param str
+ * @return
+ */
+ public static RegExpFilter getWildcardFilter(String str, boolean ignoreCase) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < str.length(); i++) {
+ char ch = str.charAt(i);
+ if (ch == '?') {
+ buffer.append('.');
+ } else if (ch == '*') {
+ buffer.append(".*");
+ } else {
+ buffer.append(ch);
+ }
+ }
+ return new RegExpFilter(buffer.toString(), ignoreCase);
+ }
+
+ }
+
+ /**
+ * Clean a directory without deleting it.
+ *
+ * @param directory directory to clean
+ * @throws IOException in case cleaning is unsuccessful
+ */
+ public static void cleanDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ String message = directory + " does not exist";
+ throw new IllegalArgumentException(message);
+ }
+
+ if (!directory.isDirectory()) {
+ String message = directory + " is not a directory";
+ throw new IllegalArgumentException(message);
+ }
+
+ File[] files = directory.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + directory);
+ }
+
+ IOException exception = null;
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ try {
+ forceDelete(file);
+ } catch (IOException ioe) {
+ exception = ioe;
+ }
+ }
+
+ if (null != exception) {
+ throw exception;
+ }
+ }
+
+ /**
+ * Clean a directory without deleting it.
+ *
+ * @param directory directory to clean, must not be <code>null</code>
+ * @throws NullPointerException if the directory is <code>null</code>
+ * @throws IOException in case cleaning is unsuccessful
+ */
+ private static void cleanDirectoryOnExit(File directory) throws IOException {
+ if (!directory.exists()) {
+ String message = directory + " does not exist";
+ throw new IllegalArgumentException(message);
+ }
+
+ if (!directory.isDirectory()) {
+ String message = directory + " is not a directory";
+ throw new IllegalArgumentException(message);
+ }
+
+ File[] files = directory.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + directory);
+ }
+
+ IOException exception = null;
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ try {
+ forceDeleteOnExit(file);
+ } catch (IOException ioe) {
+ exception = ioe;
+ }
+ }
+
+ if (null != exception) {
+ throw exception;
+ }
+ }
+
+ /**
+ * Copies a whole directory to a new location preserving the file dates.
+ * <p>
+ * This method copies the specified directory and all its child directories
+ * and files to the specified destination. The destination is the new
+ * location and name of the directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the new directory, must not be <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.1
+ */
+ public static void copyDirectory(File srcDir, File destDir) throws IOException {
+ copyDirectory(srcDir, destDir, true);
+ }
+
+ /**
+ * Copies a whole directory to a new location.
+ * <p>
+ * This method copies the contents of the specified source directory to
+ * within the specified destination directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the new directory, must not be <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.1
+ */
+ public static void copyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
+ if (srcDir == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!srcDir.exists()) {
+ throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
+ }
+ if (!srcDir.isDirectory()) {
+ throw new IOException("Source '" + srcDir + "' exists but is not a directory");
+ }
+ if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) {
+ throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same");
+ }
+ doCopyDirectory(srcDir, destDir, preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Copies a directory to within another directory preserving the file dates.
+ * <p>
+ * This method copies the source directory and all its contents to a
+ * directory of the same name in the specified destination directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.2
+ */
+ public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException {
+ if (srcDir == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (!(srcDir.exists() && srcDir.isDirectory())) {
+ throw new IllegalArgumentException("Source '" + destDir + "' is not a directory");
+ }
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!(destDir.exists() && destDir.isDirectory())) {
+ throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
+ }
+ copyDirectory(srcDir, new File(destDir, srcDir.getName()), true);
+ }
+
+ /**
+ * Copies a file to a new location preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to the
+ * specified destination file. The directory holding the destination file is
+ * created if it does not exist. If the destination file exists, then this
+ * method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destFile the new file, must not be <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFileToDirectory(File, File)
+ */
+ public static void copyFile(File srcFile, File destFile) throws IOException {
+ copyFile(srcFile, destFile, true);
+ }
+
+ /**
+ * Copies a file to a new location.
+ * <p>
+ * This method copies the contents of the specified source file to the
+ * specified destination file. The directory holding the destination file is
+ * created if it does not exist. If the destination file exists, then this
+ * method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destFile the new file, must not be <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFileToDirectory(File, File, boolean)
+ */
+ public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
+ if (srcFile == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (destFile == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!srcFile.exists()) {
+ throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
+ }
+ if (srcFile.isDirectory()) {
+ throw new IOException("Source '" + srcFile + "' exists but is a directory");
+ }
+ if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) {
+ throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same");
+ }
+ if (!(destFile.getParentFile() != null && destFile.getParentFile().exists())) {
+ if (!destFile.getParentFile().mkdirs()) {
+ throw new IOException("Destination '" + destFile + "' directory cannot be created");
+ }
+ }
+ if (!(destFile.exists() && destFile.canWrite())) {
+ throw new IOException("Destination '" + destFile + "' exists but is read-only");
+ }
+ doCopyFile(srcFile, destFile, preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Copies a file to a directory preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to a file of
+ * the same name in the specified destination directory. The destination
+ * directory is created if it does not exist. If the destination file
+ * exists, then this method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @throws NullPointerException if source or destination is null
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFile(File, File, boolean)
+ */
+ public static void copyFileToDirectory(File srcFile, File destDir) throws IOException {
+ copyFileToDirectory(srcFile, destDir, true);
+ }
+
+ /**
+ * Copies a file to a directory optionally preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to a file of
+ * the same name in the specified destination directory. The destination
+ * directory is created if it does not exist. If the destination file
+ * exists, then this method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFile(File, File, boolean)
+ * @since Commons IO 1.3
+ */
+ public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!(destDir.exists() && destDir.isDirectory())) {
+ throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
+ }
+ copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Recursively delete a directory.
+ *
+ * @param directory directory to delete
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void deleteDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ return;
+ }
+
+ cleanDirectory(directory);
+ if (!directory.delete()) {
+ String message = "Unable to delete directory " + directory + ".";
+ throw new IOException(message);
+ }
+ }
+
+ /**
+ * Recursively schedule directory for deletion on JVM exit.
+ *
+ * @param directory directory to delete, must not be <code>null</code>
+ * @throws NullPointerException if the directory is <code>null</code>
+ * @throws IOException in case deletion is unsuccessful
+ */
+ private static void deleteDirectoryOnExit(File directory) throws IOException {
+ if (!directory.exists()) {
+ return;
+ }
+
+ cleanDirectoryOnExit(directory);
+ directory.deleteOnExit();
+ }
+
+ /**
+ * Internal copy directory method.
+ *
+ * @param srcDir the validated source directory, must not be
+ * <code>null</code>
+ * @param destDir the validated destination directory, must not be
+ * <code>null</code>
+ * @param preserveFileDate whether to preserve the file date
+ * @throws IOException if an error occurs
+ * @since Commons IO 1.1
+ */
+ private static void doCopyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
+ if (destDir.exists()) {
+ if (!destDir.isDirectory()) {
+ throw new IOException("Destination '" + destDir + "' exists but is not a directory");
+ }
+ } else {
+ if (!destDir.mkdirs()) {
+ throw new IOException("Destination '" + destDir + "' directory cannot be created");
+ }
+ if (preserveFileDate) {
+ destDir.setLastModified(srcDir.lastModified());
+ }
+ }
+ if (!destDir.canWrite()) {
+ throw new IOException("Destination '" + destDir + "' cannot be written to");
+ }
+ // recurse
+ File[] files = srcDir.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + srcDir);
+ }
+ for (int i = 0; i < files.length; i++) {
+ File copiedFile = new File(destDir, files[i].getName());
+ if (files[i].isDirectory()) {
+ doCopyDirectory(files[i], copiedFile, preserveFileDate);
+ } else {
+ doCopyFile(files[i], copiedFile, preserveFileDate);
+ }
+ }
+ }
+
+ /**
+ * Internal copy file method.
+ *
+ * @param srcFile the validated source file, must not be <code>null</code>
+ * @param destFile the validated destination file, must not be
+ * <code>null</code>
+ * @param preserveFileDate whether to preserve the file date
+ * @throws IOException if an error occurs
+ */
+ private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
+ if (destFile.exists() && destFile.isDirectory()) {
+ throw new IOException("Destination '" + destFile + "' exists but is a directory");
+ }
+
+ FileInputStream input = new FileInputStream(srcFile);
+ try {
+ FileOutputStream output = new FileOutputStream(destFile);
+ try {
+ IOHelper.copy(input, output);
+ } finally {
+ IOHelper.closeQuietly(output);
+ }
+ } finally {
+ IOHelper.closeQuietly(input);
+ }
+
+ if (srcFile.length() != destFile.length()) {
+ throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
+ }
+ if (preserveFileDate) {
+ destFile.setLastModified(srcFile.lastModified());
+ }
+ }
+
+ /**
+ * Schedule a file to be deleted when JVM exits. If file is directory delete
+ * it and all sub-directories.
+ *
+ * @param file file or directory to delete, must not be <code>null</code>
+ * @throws NullPointerException if the file is <code>null</code>
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void forceDeleteOnExit(File file) throws IOException {
+ if (file.isDirectory()) {
+ deleteDirectoryOnExit(file);
+ } else {
+ file.deleteOnExit();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java
new file mode 100644
index 0000000000..e3f0ebb5c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/IOHelper.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+public class IOHelper {
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ protected IOHelper() {
+
+ }
+
+ /**
+ * Unconditionally close an <code>InputStream</code>.
+ * <p>
+ * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param input the InputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(InputStream input) {
+ try {
+ if (input != null) {
+ input.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Unconditionally close an <code>OutputStream</code>.
+ * <p>
+ * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param output the OutputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(OutputStream output) {
+ try {
+ if (output != null) {
+ output.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Copy bytes from an <code>InputStream</code> to an
+ * <code>OutputStream</code>.
+ * <p>
+ * This method buffers the input internally, so there is no need to use a
+ * <code>BufferedInputStream</code>.
+ *
+ * @param input the <code>InputStream</code> to read from
+ * @param output the <code>OutputStream</code> to write to
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since Commons IO 1.1
+ */
+ public static int copy(InputStream input, OutputStream output) throws IOException {
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ int count = 0;
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) { // NOPMD
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ return count;
+ }
+
+ public static InputStream getInputStream(URL url) throws IOException {
+ return new SafeURLInputStream(url);
+ }
+
+ /**
+ * This class is a workaround for URL stream issue as illustrated below.
+ * InputStream is=url.getInputStream(); is.close(); // This line doesn't close
+ * the JAR file if the URL is a jar entry like "jar:file:/a.jar!/my.composite" We
+ * also need to turn off the JarFile cache.
+ *
+ * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4950148
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class SafeURLInputStream extends InputStream {
+ private JarFile jarFile;
+ private InputStream is;
+
+ public SafeURLInputStream(URL url) throws IOException {
+ String protocol = url.getProtocol();
+ if (protocol != null && (protocol.equals("jar"))) {
+ JarURLConnection connection = (JarURLConnection)url.openConnection();
+ // We cannot use cache
+ connection.setUseCaches(false);
+ try {
+ is = connection.getInputStream();
+ } catch (IOException e) {
+ throw e;
+ }
+ jarFile = connection.getJarFile();
+ } else {
+ is = url.openStream();
+ }
+ }
+
+ public SafeURLInputStream(JarURLConnection connection) throws IOException {
+ // We cannot use cache
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ jarFile = connection.getJarFile();
+ }
+
+ public int available() throws IOException {
+ return is.available();
+ }
+
+ public void close() throws IOException {
+ is.close();
+ // We need to close the JAR file
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ public synchronized void mark(int readlimit) {
+ is.mark(readlimit);
+ }
+
+ public boolean markSupported() {
+ return is.markSupported();
+ }
+
+ public int read() throws IOException {
+ return is.read();
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ return is.read(b, off, len);
+ }
+
+ public int read(byte[] b) throws IOException {
+ return is.read(b);
+ }
+
+ public synchronized void reset() throws IOException {
+ is.reset();
+ }
+
+ public long skip(long n) throws IOException {
+ return is.skip(n);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java
new file mode 100644
index 0000000000..6b11725481
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/JavaIntrospectionHelper.java
@@ -0,0 +1,439 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Implements various reflection-related operations
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaIntrospectionHelper {
+
+ private static final Class[] EMPTY_CLASS_ARRY = new Class[0];
+
+ /**
+ * Hide the constructor
+ */
+ private JavaIntrospectionHelper() {
+ }
+
+
+ /**
+ * Returns a collection of public, and protected fields declared by a class or one of its supertypes
+ */
+ public static Set<Field> getAllPublicAndProtectedFields(Class clazz) {
+ return getAllPublicAndProtectedFields(clazz, new HashSet<Field>());
+ }
+
+ /**
+ * Recursively evaluates the type hierachy to return all fields that are public or protected
+ */
+ private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields);
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (Field field : declaredFields) {
+ int modifiers = field.getModifiers();
+ if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) {
+ field.setAccessible(true); // ignore Java accessibility
+ fields.add(field);
+ }
+ }
+ return fields;
+ }
+
+ /**
+ * Returns a collection of public and protected methods declared by a class or one of its supertypes. Note that
+ * overriden methods will not be returned in the collection (i.e. only the method override will be). <p/> This
+ * method can potentially be expensive as reflection information is not cached. It is assumed that this method will
+ * be used during a configuration phase.
+ */
+ public static Set<Method> getAllUniquePublicProtectedMethods(Class clazz) {
+ return getAllUniqueMethods(clazz, new HashSet<Method>());
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all unique methods
+ */
+ private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods) {
+ if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) {
+ return methods;
+ }
+ // we first evaluate methods of the subclass and then move to the parent
+ Method[] declaredMethods = pClass.getDeclaredMethods();
+ for (Method declaredMethod : declaredMethods) {
+ int modifiers = declaredMethod.getModifiers();
+ if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) {
+ continue;
+ }
+ if (methods.size() == 0) {
+ methods.add(declaredMethod);
+ } else {
+ List<Method> temp = new ArrayList<Method>();
+ boolean matched = false;
+ for (Method method : methods) {
+ // only add if not already in the set from a supclass (i.e. the
+ // method is not overrided)
+ if (exactMethodMatch(declaredMethod, method)) {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+ // TODO ignore Java accessibility
+ declaredMethod.setAccessible(true);
+ temp.add(declaredMethod);
+ }
+ methods.addAll(temp);
+ temp.clear();
+ }
+ }
+ // evaluate class hierarchy - this is done last to track inherited methods
+ methods = getAllUniqueMethods(pClass.getSuperclass(), methods);
+ return methods;
+ }
+
+ /**
+ * Finds the closest matching field with the given name, that is, a field of the exact specified type or,
+ * alternately, of a supertype.
+ *
+ * @param name the name of the field
+ * @param type the field type
+ * @param fields the collection of fields to search
+ * @return the matching field or null if not found
+ */
+ public static Field findClosestMatchingField(String name, Class type, Set<Field> fields) {
+ Field candidate = null;
+ for (Field field : fields) {
+ if (field.getName().equals(name)) {
+ if (field.getType().equals(type)) {
+ return field; // exact match
+ } else if (field.getType().isAssignableFrom(type)
+ || (field.getType().isPrimitive() && primitiveAssignable(field.getType(), type))) {
+ // We could have the situation where a field parameter is a primitive and the demarshalled value is
+ // an object counterpart (e.g. Integer and int)
+ // @spec issue
+ // either an interface or super class, so keep a reference until
+ // we know there are no closer types
+ candidate = field;
+ }
+ }
+ }
+ if (candidate != null) {
+ return candidate;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Finds the closest matching method with the given name, that is, a method taking the exact parameter types or,
+ * alternately, parameter supertypes.
+ *
+ * @param name the name of the method
+ * @param types the method parameter types
+ * @param methods the collection of methods to search
+ * @return the matching method or null if not found
+ */
+ public static Method findClosestMatchingMethod(String name, Class[] types, Set<Method> methods) {
+ if (types == null) {
+ types = EMPTY_CLASS_ARRY;
+ }
+ Method candidate = null;
+ for (Method method : methods) {
+ if (method.getName().equals(name) && method.getParameterTypes().length == types.length) {
+ Class<?>[] params = method.getParameterTypes();
+ boolean disqualify = false;
+ boolean exactMatch = true;
+ for (int i = 0; i < params.length; i++) {
+ if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) {
+ // no match
+ disqualify = true;
+ exactMatch = false;
+ break;
+ } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) {
+ // not exact match
+ exactMatch = false;
+ }
+ }
+ if (disqualify) {
+ continue;
+ } else if (exactMatch) {
+ return method;
+ } else {
+ candidate = method;
+ }
+ }
+ }
+ if (candidate != null) {
+ return candidate;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Searches a collection of fields for one that matches by name and has a multiplicity type. i.e. a List or Array of
+ * interfaces
+ *
+ * @return a matching field or null
+ */
+ public static Field findMultiplicityFieldByName(String name, Set<Field> fields) {
+ for (Field candidate : fields) {
+ if (candidate.getName().equals(name)
+ && (List.class.isAssignableFrom(candidate.getType()) || (candidate.getType().isArray()
+ && candidate.getType().getComponentType() != null && candidate.getType().getComponentType()
+ .isInterface()))) {
+ return candidate;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Searches a collection of method for one that matches by name and has single parameter of a multiplicity type.
+ * i.e. a List or Array of interfaces
+ *
+ * @return a matching method or null
+ */
+ public static Method findMultiplicityMethodByName(String name, Set<Method> methods) {
+ for (Method candidate : methods) {
+ if (candidate.getName().equals(name)
+ && candidate.getParameterTypes().length == 1
+ && (List.class.isAssignableFrom(candidate.getParameterTypes()[0])
+ || (candidate.getParameterTypes()[0].isArray()
+ && candidate.getParameterTypes()[0].getComponentType() != null
+ && candidate.getParameterTypes()[0].getComponentType().isInterface()))) {
+ return candidate;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Determines if two methods "match" - that is, they have the same method names and exact parameter types (one is
+ * not a supertype of the other)
+ */
+ public static boolean exactMethodMatch(Method method1, Method method2) {
+ if (!method1.getName().equals(method2.getName())) {
+ return false;
+ }
+ Class[] types1 = method1.getParameterTypes();
+ Class[] types2 = method2.getParameterTypes();
+ if (types1.length == 0 && types2.length == 0) {
+ return true;
+ } else if (types1.length == types2.length) {
+ for (int n = 0; n < types1.length; n++) {
+ if (!types1[n].equals(types2[n])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws NoSuchMethodException {
+ return clazz.getConstructor((Class[]) null);
+ }
+
+ /**
+ * Loads a class corresponding to the class name using the current context class loader.
+ *
+ * @throws ClassNotFoundException if the class was not found on the classpath
+ */
+ public static Class loadClass(String pName) throws ClassNotFoundException {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return Class.forName(pName, true, loader);
+ }
+
+ /**
+ * Returns the simple name of a class - i.e. the class name devoid of its package qualifier
+ *
+ * @param implClass the implmentation class
+ */
+ public static String getBaseName(Class<?> implClass) {
+ String baseName = implClass.getName();
+ int lastDot = baseName.lastIndexOf('.');
+ if (lastDot != -1) {
+ baseName = baseName.substring(lastDot + 1);
+ }
+ return baseName;
+ }
+
+ public static boolean isImmutable(Class clazz) {
+ return String.class == clazz
+ || clazz.isPrimitive()
+ || Number.class.isAssignableFrom(clazz)
+ || Boolean.class.isAssignableFrom(clazz)
+ || Character.class.isAssignableFrom(clazz)
+ || Byte.class.isAssignableFrom(clazz);
+ }
+
+ /**
+ * Takes a property name and converts it to a getter method name according to JavaBean conventions. For example,
+ * property <code>foo<code> is returned as <code>getFoo</code>
+ */
+ public static String toGetter(String name) {
+ return "get" + name.toUpperCase().substring(0, 1) + name.substring(1);
+ }
+
+ /**
+ * Takes a setter or getter method name and converts it to a property name according to JavaBean conventions. For
+ * example, <code>setFoo(var)</code> is returned as property <code>foo<code>
+ */
+ public static String toPropertyName(String name) {
+ if (!name.startsWith("set")) {
+ return name;
+ }
+ return Character.toLowerCase(name.charAt(3)) + name.substring(4);
+ }
+
+ /**
+ * Takes a property name and converts it to a setter method name according to JavaBean conventions. For example, the
+ * property <code>foo<code> is returned as <code>setFoo(var)</code>
+ */
+ public static String toSetter(String name) {
+ return "set" + name.toUpperCase().substring(0, 1) + name.substring(1);
+ }
+
+ /**
+ * Compares a two types, assuming one is a primitive, to determine if the other is its object counterpart
+ */
+ private static boolean primitiveAssignable(Class memberType, Class param) {
+ if (memberType == Integer.class) {
+ return param == Integer.TYPE;
+ } else if (memberType == Double.class) {
+ return param == Double.TYPE;
+ } else if (memberType == Float.class) {
+ return param == Float.TYPE;
+ } else if (memberType == Short.class) {
+ return param == Short.TYPE;
+ } else if (memberType == Character.class) {
+ return param == Character.TYPE;
+ } else if (memberType == Boolean.class) {
+ return param == Boolean.TYPE;
+ } else if (memberType == Byte.class) {
+ return param == Byte.TYPE;
+ } else if (param == Integer.class) {
+ return memberType == Integer.TYPE;
+ } else if (param == Double.class) {
+ return memberType == Double.TYPE;
+ } else if (param == Float.class) {
+ return memberType == Float.TYPE;
+ } else if (param == Short.class) {
+ return memberType == Short.TYPE;
+ } else if (param == Character.class) {
+ return memberType == Character.TYPE;
+ } else if (param == Boolean.class) {
+ return memberType == Boolean.TYPE;
+ } else if (param == Byte.class) {
+ return memberType == Byte.TYPE;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the generic types represented in the given type. Usage as follows: <code>
+ * JavaIntrospectionHelper.getGenerics(field.getGenericType());
+ * <p/>
+ * JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); </code>
+ *
+ * @return the generic types in order of declaration or an empty array if the type is not genericized
+ */
+ public static List<? extends Type> getGenerics(Type genericType) {
+ List<Type> classes = new ArrayList<Type>();
+ if (genericType instanceof ParameterizedType) {
+ ParameterizedType ptype = (ParameterizedType) genericType;
+ // get the type arguments
+ Type[] targs = ptype.getActualTypeArguments();
+ for (Type targ : targs) {
+ classes.add(targ);
+ }
+ }
+ return classes;
+ }
+
+ /**
+ * Returns the generic type specified by the class at the given position as in:
+ * <p/>
+ * <code> public class Foo<Bar,Baz>{ //.. }
+ * <p/>
+ * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); <code>
+ * <p/>
+ * will return Baz.
+ */
+ public static Class introspectGeneric(Class<?> clazz, int pos) {
+ assert clazz != null : "No class specified";
+ Type type = clazz.getGenericSuperclass();
+ if (type instanceof ParameterizedType) {
+ Type[] args = ((ParameterizedType) type).getActualTypeArguments();
+ if (args.length <= pos) {
+ throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName());
+ }
+ return (Class) ((ParameterizedType) type).getActualTypeArguments()[pos];
+ } else {
+ Type[] interfaces = clazz.getGenericInterfaces();
+ for (Type itype : interfaces) {
+ if (!(itype instanceof ParameterizedType)) {
+ continue;
+ }
+ ParameterizedType interfaceType = (ParameterizedType) itype;
+ return (Class) interfaceType.getActualTypeArguments()[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the set of interfaces implemented by the given class and its ancestors or a blank set if none
+ */
+ public static Set<Class> getAllInterfaces(Class clazz) {
+ Set<Class> implemented = new HashSet<Class>();
+ getAllInterfaces(clazz, implemented);
+ return implemented;
+ }
+
+ private static void getAllInterfaces(Class clazz, Set<Class> implemented) {
+ Class[] interfaces = clazz.getInterfaces();
+ for (Class interfaze : interfaces) {
+ implemented.add(interfaze);
+ }
+ Class<?> superClass = clazz.getSuperclass();
+ // Object has no superclass so check for null
+ if (superClass != null && !superClass.equals(Object.class)) {
+ getAllInterfaces(superClass, implemented);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java
new file mode 100644
index 0000000000..dad586dd18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/util/ReferenceLoaderHelper.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.spi.loader.IncompatibleOverridingServiceContractException;
+import org.apache.tuscany.spi.loader.InvalidReferenceException;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Functions to help in loading of references
+ */
+
+public final class ReferenceLoaderHelper {
+ /**
+ * Hide constructor
+ */
+ private ReferenceLoaderHelper() {
+ }
+
+ public static void populateRefTargets(AbstractReferenceDefinition refDefn, String concatenatedTargets) throws InvalidReferenceException {
+ StringTokenizer st = new StringTokenizer(concatenatedTargets);
+ while (st.hasMoreTokens()) {
+ try {
+ refDefn.addTarget(new URI(st.nextToken()));
+ } catch (URISyntaxException e) {
+ throw new InvalidReferenceException(e);
+ }
+ }
+ }
+
+ public static void populatePromotedRefs(CompositeReferenceDefinition refDefn, String concatenatedUris) throws InvalidReferenceException {
+ StringTokenizer st = new StringTokenizer(concatenatedUris);
+ while (st.hasMoreTokens()) {
+ try {
+ refDefn.addPromotedReference(new URI(st.nextToken()));
+ } catch (URISyntaxException e) {
+ throw new InvalidReferenceException(e);
+ }
+ }
+ }
+
+ public static boolean isCompatibleMultiplicity(Multiplicity definedMul, Multiplicity overridenMul) {
+ return ((definedMul == overridenMul) ||
+ (definedMul == Multiplicity.ZERO_ONE && overridenMul == Multiplicity.ZERO_N) ||
+ (definedMul == Multiplicity.ZERO_N && overridenMul == Multiplicity.ZERO_ONE) ||
+ (definedMul == Multiplicity.ONE_ONE && overridenMul == Multiplicity.ONE_N) ||
+ (definedMul == Multiplicity.ONE_N && overridenMul == Multiplicity.ONE_ONE));
+ }
+
+ public static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
+ if (definedMul != overridenMul) {
+ switch (definedMul) {
+ case ZERO_N:
+ return overridenMul == Multiplicity.ZERO_ONE;
+ case ONE_N:
+ return overridenMul == Multiplicity.ONE_ONE;
+ default:
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ public static boolean validateMultiplicityAndTargets(Multiplicity multiplicity,
+ List<URI> targets) {
+ int count = targets.size();
+ switch (multiplicity) {
+ case ZERO_N:
+ break;
+ case ZERO_ONE:
+ if (count > 1) {
+ return false;
+ }
+ break;
+ case ONE_ONE:
+ if (count != 1) {
+ return false;
+ }
+ break;
+ case ONE_N:
+ if (count < 1) {
+ return false;
+ }
+ break;
+ }
+ return true;
+ }
+
+ public static void checkInterfaceCompatibility(ServiceContract<?> source,
+ ServiceContract<?> target,
+ boolean ignoreCallback) throws IncompatibleOverridingServiceContractException {
+ if (source == target) {
+ // Shortcut for performance
+ return;
+ }
+
+ //FIXME: we don't go into operations comparison for now since the service contract thta the
+ //interace loader loads does not have operation details as the intropection 'has not been deep'
+ //The JavaInterfaceLoader has set the 'deep' introspection to false....will fix this after
+ //sorting that out.
+
+ if (source.getInteractionScope() != target.getInteractionScope()) {
+ throw new IncompatibleOverridingServiceContractException(
+ "Interaction scopes settings do not match",
+ source, target);
+ }
+
+ for (Operation<?> operation : source.getOperations().values()) {
+ Operation<?> targetOperation = target.getOperation(operation.getName());
+ if (targetOperation == null) {
+ throw new IncompatibleOverridingServiceContractException("Operation not found on target",
+ source, target);
+ }
+ if (!targetOperation.equals(operation)) {
+ throw new IncompatibleOverridingServiceContractException(
+ "Target operations are not compatible",
+ source, target);
+ }
+ }
+
+ if (ignoreCallback) {
+ return;
+ }
+
+ for (Operation<?> operation : source.getCallbackOperations().values()) {
+ Operation<?> targetOperation = target.getCallbackOperations().get(operation.getName());
+ if (targetOperation == null) {
+ throw new IncompatibleOverridingServiceContractException(
+ "Callback operation not found on target",
+ source, target, null,
+ targetOperation);
+ }
+ if (!operation.equals(targetOperation)) {
+ throw new IncompatibleOverridingServiceContractException(
+ "Target callback operation is not compatible",
+ source, target, operation,
+ targetOperation);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.java
new file mode 100644
index 0000000000..c1766fbb6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/BridgingInterceptor.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 org.apache.tuscany.core.wire;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+
+/**
+ * Responsible for bridging an outbound to an inbound invocation chain associated with a source and target respectively
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BridgingInterceptor extends Interceptor {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java
new file mode 100644
index 0000000000..06f0e62f70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.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.wire;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+
+/**
+ * An interceptor applied to the outbound side of a wire that ensures the callback target implements the required
+ * service contract. This is required as callback targets may be set dynamically by service implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackInterfaceInterceptor implements Interceptor {
+ private boolean invokingServiceImplements;
+ private Interceptor next;
+
+ public CallbackInterfaceInterceptor(boolean invokingServiceImplements) {
+ this.invokingServiceImplements = invokingServiceImplements;
+ }
+
+ public Message invoke(Message msg) {
+ // TODO check in the context if a callback object is set, if so invoke next since the setCallback will
+ // perform the check
+ if (!invokingServiceImplements) {
+ throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
+ }
+ return next.invoke(msg);
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.java
new file mode 100644
index 0000000000..45b580d419
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundInvocationChainImpl.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.wire;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+
+/**
+ * Contains a target-side invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public class InboundInvocationChainImpl extends InvocationChainImpl implements InboundInvocationChain {
+
+ /**
+ * Creates an new target-side chain for the given operation
+ */
+ public InboundInvocationChainImpl(Operation operation) {
+ super(operation);
+ }
+
+ public void prepare() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
new file mode 100644
index 0000000000..b529cafbb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Default implementation of an inbound wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class InboundWireImpl implements InboundWire {
+ private QName bindingType = LOCAL_BINDING;
+ private String serviceName;
+ private ServiceContract serviceContract;
+ private OutboundWire targetWire;
+ private String callbackReferenceName;
+ private Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ private Map<Object, Map<Operation<?>, OutboundInvocationChain>> callbackSourceChainMaps =
+ new HashMap<Object, Map<Operation<?>, OutboundInvocationChain>>();
+ private SCAObject container;
+ private AtomicComponent targetComponent;
+ private boolean optimizable;
+
+
+ /**
+ * Creates a local inbound wire
+ */
+ public InboundWireImpl() {
+ }
+
+
+ /**
+ * Creates an inbound wire for the given binding type
+ *
+ * @param bindingType the binding type
+ */
+ public InboundWireImpl(QName bindingType) {
+ this.bindingType = bindingType;
+ }
+
+ public QName getBindingType() {
+ return bindingType;
+ }
+
+ public Object getTargetService() throws TargetResolutionException {
+ // JFM fixme hack
+ if (targetWire == null && targetComponent != null) {
+ return targetComponent.getTargetInstance();
+ }
+ assert targetWire != null;
+ // optimized, no interceptors or handlers on either end
+ return targetWire.getTargetService();
+ }
+
+ public ServiceContract getServiceContract() {
+ return serviceContract;
+ }
+
+ public void setServiceContract(ServiceContract serviceContract) {
+ this.serviceContract = serviceContract;
+ }
+
+ public void addInterface(Class claz) {
+ throw new UnsupportedOperationException("Additional proxy interfaces not yet supported");
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public Map<Operation<?>, InboundInvocationChain> getInvocationChains() {
+ return chains;
+ }
+
+ public void addInvocationChains(Map<Operation<?>, InboundInvocationChain> chains) {
+ this.chains.putAll(chains);
+ }
+
+ public void addInvocationChain(Operation<?> operation, InboundInvocationChain chain) {
+ chains.put(operation, chain);
+ }
+
+ public Map<Operation<?>, OutboundInvocationChain> getSourceCallbackInvocationChains(Object targetAddr) {
+ return callbackSourceChainMaps.get(targetAddr);
+ }
+
+ public void addSourceCallbackInvocationChains(Object targetAddr,
+ Map<Operation<?>, OutboundInvocationChain> chains) {
+ callbackSourceChainMaps.put(targetAddr, chains);
+ }
+
+ public void addSourceCallbackInvocationChain(Object targetAddr,
+ Operation operation,
+ OutboundInvocationChain chain) {
+ Map<Operation<?>, OutboundInvocationChain> chains = callbackSourceChainMaps.get(targetAddr);
+ if (chains == null) {
+ chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ callbackSourceChainMaps.put(targetAddr, chains);
+ }
+ chains.put(operation, chain);
+ }
+
+ public void setTargetWire(OutboundWire wire) {
+ targetWire = wire;
+ }
+
+ public String getCallbackReferenceName() {
+ return callbackReferenceName;
+ }
+
+ public void setCallbackReferenceName(String callbackReferenceName) {
+ this.callbackReferenceName = callbackReferenceName;
+ }
+
+ public boolean isOptimizable() {
+ return optimizable;
+ }
+
+ public void setOptimizable(boolean optimizable) {
+ this.optimizable = optimizable;
+ }
+
+ public SCAObject getContainer() {
+ return container;
+ }
+
+ public void setContainer(SCAObject container) {
+ if (container instanceof AtomicComponent) {
+ targetComponent = (AtomicComponent) container;
+ }
+ this.container = container;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java
new file mode 100644
index 0000000000..92da622d11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatter.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire;
+
+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.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
+
+import org.apache.tuscany.host.monitor.ExceptionFormatter;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+
+/**
+ * Formats {@link org.apache.tuscany.spi.wire.IncompatibleServiceContractException} for JDK logging
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class IncompatibleServiceContractExceptionFormatter implements ExceptionFormatter {
+ private FormatterRegistry factory;
+
+ public IncompatibleServiceContractExceptionFormatter(@Autowire FormatterRegistry factory) {
+ this.factory = factory;
+ factory.register(this);
+ }
+
+ public boolean canFormat(Class<?> type) {
+ return IncompatibleServiceContractException.class.isAssignableFrom(type);
+ }
+
+ @Destroy
+ public void destroy() {
+ factory.unregister(this);
+ }
+
+ public PrintWriter write(PrintWriter writer, Throwable exception) {
+ assert exception instanceof IncompatibleServiceContractException;
+ IncompatibleServiceContractException e = (IncompatibleServiceContractException) exception;
+ e.appendBaseMessage(writer);
+ ServiceContract<?> source = e.getSource();
+ String sourceContractName = null;
+ if (source != null) {
+ sourceContractName = source.getInterfaceName();
+ }
+ Operation<?> sourceOperation = e.getSourceOperation();
+ String sourceOpName = null;
+ if (sourceOperation != null) {
+ sourceOpName = sourceOperation.getName();
+ }
+ if (sourceOpName == null) {
+ writer.write("\nSource Contract: " + sourceContractName);
+ } else {
+ writer.write("\nSource Contract: " + sourceContractName + "/" + sourceOpName);
+ }
+ ServiceContract<?> target = e.getTarget();
+ String targetContractName = null;
+ if (target != null) {
+ targetContractName = target.getInterfaceName();
+ }
+ Operation<?> targetOperation = e.getTargetOperation();
+ String targetOpName = null;
+ if (targetOperation != null) {
+ targetOpName = targetOperation.getName();
+ }
+ if (targetOpName == null) {
+ writer.write("\nTarget Contract: " + targetContractName + "\n");
+ } else {
+ writer.write("\nTarget Contract: " + targetContractName + "/" + targetOpName + "\n");
+
+ }
+ e.appendContextStack(writer);
+ return writer;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java
new file mode 100644
index 0000000000..d93426af4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.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.wire;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Contains functionality common to source- and target- side invocation chains
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InvocationChainImpl implements InvocationChain {
+ protected Operation operation;
+ protected TargetInvoker targetInvoker;
+ protected Interceptor interceptorChainHead;
+ protected Interceptor interceptorChainTail;
+
+
+ // the pointer to a bridged target head interceptor or null if the target has no interceptors
+ protected Interceptor targetInterceptorChainHead;
+
+ public InvocationChainImpl(Operation operation) {
+ assert operation != null : "No operation type specified";
+ this.operation = operation;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setTargetInvoker(TargetInvoker invoker) {
+ this.targetInvoker = invoker;
+ }
+
+ public TargetInvoker getTargetInvoker() {
+ return targetInvoker;
+ }
+
+ public void addInterceptor(Interceptor interceptor) {
+ if (interceptorChainHead == null) {
+ interceptorChainHead = interceptor;
+ } else {
+ interceptorChainTail.setNext(interceptor);
+ }
+ interceptorChainTail = interceptor;
+ }
+
+ public void addInterceptor(int index, Interceptor interceptor) {
+ int i = 0;
+ Interceptor next = interceptorChainHead;
+ Interceptor prev = null;
+ while (next != null && i < index) {
+ prev = next;
+ next = next.getNext();
+ i++;
+ }
+ if (i == index) {
+ if (prev != null) {
+ prev.setNext(interceptor);
+ } else {
+ interceptorChainHead = interceptor;
+ }
+ interceptor.setNext(next);
+ if (next == null) {
+ interceptorChainTail = interceptor;
+ }
+ } else {
+ throw new ArrayIndexOutOfBoundsException(index);
+ }
+ }
+
+ public Interceptor getHeadInterceptor() {
+ return interceptorChainHead;
+ }
+
+ public Interceptor getTailInterceptor() {
+ return interceptorChainTail;
+ }
+
+ public void setTargetInterceptor(Interceptor interceptor) {
+ targetInterceptorChainHead = interceptor;
+ }
+
+ public Interceptor getTargetInterceptor() {
+ return targetInterceptorChainHead;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.java
new file mode 100644
index 0000000000..90b17a930c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvokerInterceptor.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.wire;
+
+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.TargetInvoker;
+
+/**
+ * Serves as a tail interceptor on a target wire chain. This implementation dispatches to the target invoker passed
+ * inside the wire message. Target invokers are passed from the source in order to allow for caching of target
+ * instances.
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.spi.wire.TargetInvoker
+ */
+public class InvokerInterceptor implements Interceptor {
+
+ public InvokerInterceptor() {
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ TargetInvoker invoker = msg.getTargetInvoker();
+ if (invoker == null) {
+ throw new InvocationRuntimeException("No target invoker specified on message");
+ }
+ return invoker.invoke(msg);
+ }
+
+ public void setNext(Interceptor next) {
+ throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain");
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ 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/wire/LoopBackWire.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/LoopBackWire.java
new file mode 100644
index 0000000000..a2cd71cafe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/LoopBackWire.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.wire;
+
+import org.apache.tuscany.spi.component.TargetResolutionException;
+
+/**
+ * A specialized wire that points back to its target container. Used to autowire to parent composites
+ *
+ * @version $Rev$ $Date$
+ */
+public class LoopBackWire extends InboundWireImpl {
+
+ public Object getTargetService() throws TargetResolutionException {
+ return getContainer();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.java
new file mode 100644
index 0000000000..aec281d190
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NoMethodForOperationException.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.wire;
+
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+
+/**
+ * Thrown when an {@link org.apache.tuscany.spi.model.Operation} cannot be mapped to a method on an interface
+ * @version $Rev$ $Date$
+ */
+public class NoMethodForOperationException extends ProxyCreationException {
+ public NoMethodForOperationException() {
+ }
+
+ public NoMethodForOperationException(String message) {
+ super(message);
+ }
+
+ public NoMethodForOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoMethodForOperationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java
new file mode 100644
index 0000000000..a2e6b0379f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptor.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.util.LinkedList;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Bridges interceptors in a non-blocking fashion between an {@link org.apache.tuscany.spi.wire.InboundInvocationChain}
+ * and an {@link org.apache.tuscany.spi.wire.OutboundInvocationChain} by using a {@link
+ * org.apache.tuscany.spi.component.WorkContext}.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class NonBlockingBridgingInterceptor implements BridgingInterceptor {
+
+ private static final Message RESPONSE = new ImmutableMessage();
+
+ private WorkScheduler workScheduler;
+ private WorkContext workContext;
+ private Interceptor next;
+
+ public NonBlockingBridgingInterceptor(WorkScheduler workScheduler, WorkContext workContext) {
+ this.workScheduler = workScheduler;
+ this.workContext = workContext;
+ }
+
+ public NonBlockingBridgingInterceptor(WorkScheduler workScheduler, WorkContext workContext, Interceptor next) {
+ this.workScheduler = workScheduler;
+ this.workContext = workContext;
+ this.next = next;
+ }
+
+ public Message invoke(final Message msg) {
+ // Retrieve conversation id to transfer to new thread
+ // Notice that we cannot clear the conversation id from the current thread
+ final Object conversationID = workContext.getIdentifier(Scope.CONVERSATION);
+ // Schedule the invocation of the next interceptor in a new Work instance
+ try {
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ workContext.setCurrentCorrelationId(null);
+ // if we got a conversation id, transfer it to new thread
+ if (conversationID != null) {
+ workContext.setIdentifier(Scope.CONVERSATION, conversationID);
+ }
+ next.invoke(msg);
+ }
+ });
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return RESPONSE;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ /**
+ * A dummy message passed back on an invocation
+ */
+ private static class ImmutableMessage implements Message {
+
+ public Object getBody() {
+ return null;
+ }
+
+ public void setBody(Object body) {
+ if (body != null) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public void setTargetInvoker(TargetInvoker invoker) {
+ throw new UnsupportedOperationException();
+ }
+
+ public TargetInvoker getTargetInvoker() {
+ return null;
+ }
+
+ public Message getRelatedCallbackMessage() {
+ return null;
+ }
+
+ public Object getFromAddress() {
+ return null;
+ }
+
+ public void setFromAddress(Object fromAddress) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object popFromAddress() {
+ return null;
+ }
+
+ public void pushFromAddress(Object fromAddress) {
+ throw new UnsupportedOperationException();
+ }
+
+ public LinkedList<Object> getCallbackRoutingChain() {
+ return null;
+ }
+
+ public void setCallbackRoutingChain(LinkedList<Object> fromAddresses) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getMessageId() {
+ return null;
+ }
+
+ public void setMessageId(Object messageId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getCorrelationId() {
+ return null;
+ }
+
+ public void setCorrelationId(Object correlationId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFault() {
+ return false;
+ }
+
+ public void setBodyWithFault(Object fault) {
+ throw new UnsupportedOperationException();
+ }
+
+ public short getConversationSequence() {
+ return TargetInvoker.NONE;
+ }
+
+ public void setConversationSequence(short sequence) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.java
new file mode 100644
index 0000000000..4a4b268201
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactory.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.wire;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Returns a target instance directly from a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class OptimizedWireObjectFactory implements ObjectFactory {
+
+ private OutboundWire wire;
+
+ public OptimizedWireObjectFactory(OutboundWire factory) {
+ this.wire = factory;
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ try {
+ return wire.getTargetService();
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.java
new file mode 100644
index 0000000000..a9d83cb7a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundInvocationChainImpl.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.core.wire;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+/**
+ * Contains a outgoing invocation pipeline for a service operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OutboundInvocationChainImpl extends InvocationChainImpl implements OutboundInvocationChain {
+
+ /**
+ * Creates an new outbound chain
+ */
+ public OutboundInvocationChainImpl(Operation operation) {
+ super(operation);
+ }
+
+ public void prepare() {
+ if (interceptorChainHead != null) {
+ if (targetInterceptorChainHead != null) {
+ // Connect source interceptor chain directly to target interceptor chain
+ interceptorChainTail.setNext(targetInterceptorChainHead);
+ }
+ } else {
+ // no source interceptor chain or source handlers, connect to target interceptor chain or channel
+ if (targetInterceptorChainHead != null) {
+ interceptorChainHead = targetInterceptorChainHead;
+ interceptorChainTail = targetInterceptorChainHead;
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
new file mode 100644
index 0000000000..bad92ffe1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Default implementation of an outbound wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class OutboundWireImpl implements OutboundWire {
+ private QName bindingType = LOCAL_BINDING;
+ private ServiceContract serviceContract;
+ private Class<?>[] callbackInterfaces;
+ private Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ private Map<Operation<?>, InboundInvocationChain> callbackTargetChains =
+ new HashMap<Operation<?>, InboundInvocationChain>();
+ private String referenceName;
+ private QualifiedName targetName;
+ private InboundWire targetWire;
+ private SCAObject container;
+ private boolean autowire;
+ private boolean optimizable;
+
+ /**
+ * Creates a local outbound wire
+ */
+ public OutboundWireImpl() {
+ }
+
+ /**
+ * Creates an outbound wire for the given binding type
+ *
+ * @param bindingType the binding type
+ */
+ public OutboundWireImpl(QName bindingType) {
+ this.bindingType = bindingType;
+ }
+
+ public void setOptimizable(boolean optimizable) {
+ this.optimizable = optimizable;
+ }
+
+ public QName getBindingType() {
+ return bindingType;
+ }
+
+ public Object getTargetService() throws TargetResolutionException {
+ if (targetWire == null) {
+ return null;
+ }
+ // optimized, no interceptors or handlers on either end
+ return targetWire.getTargetService();
+ }
+
+ public ServiceContract getServiceContract() {
+ return serviceContract;
+ }
+
+ public void setServiceContract(ServiceContract serviceContract) {
+ this.serviceContract = serviceContract;
+ }
+
+ public void addInterface(Class<?> claz) {
+ throw new UnsupportedOperationException("Additional proxy interfaces not yet supported");
+ }
+
+ public void setCallbackInterface(Class<?> interfaze) {
+ callbackInterfaces = new Class[]{interfaze};
+ }
+
+ public Class<?> getCallbackInterface() {
+ return callbackInterfaces[0];
+ }
+
+ public void addCallbackInterface(Class<?> claz) {
+ throw new UnsupportedOperationException("Additional callback interfaces not yet supported");
+ }
+
+ public Class[] getImplementedCallbackInterfaces() {
+ return callbackInterfaces;
+ }
+
+ public void setTargetWire(InboundWire wire) {
+ this.targetWire = wire;
+ }
+
+ public Map<Operation<?>, OutboundInvocationChain> getInvocationChains() {
+ return chains;
+ }
+
+ public void addInvocationChains(Map<Operation<?>, OutboundInvocationChain> chains) {
+ this.chains.putAll(chains);
+ }
+
+ public void addInvocationChain(Operation<?> operation, OutboundInvocationChain chain) {
+ chains.put(operation, chain);
+ }
+
+ public Map<Operation<?>, InboundInvocationChain> getTargetCallbackInvocationChains() {
+ return callbackTargetChains;
+ }
+
+ public void addTargetCallbackInvocationChains(Map<Operation<?>, InboundInvocationChain> chains) {
+ callbackTargetChains.putAll(chains);
+ }
+
+ public void addTargetCallbackInvocationChain(Operation operation, InboundInvocationChain chain) {
+ callbackTargetChains.put(operation, chain);
+ }
+
+ public String getReferenceName() {
+ return referenceName;
+ }
+
+ public void setReferenceName(String referenceName) {
+ this.referenceName = referenceName;
+ }
+
+ public QualifiedName getTargetName() {
+ return targetName;
+ }
+
+ public void setTargetName(QualifiedName targetName) {
+ this.targetName = targetName;
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public boolean isOptimizable() {
+ return optimizable;
+ }
+
+ public SCAObject getContainer() {
+ return container;
+ }
+
+ public void setContainer(SCAObject container) {
+ this.container = container;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptor.java
new file mode 100644
index 0000000000..f09bda400a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptor.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.wire;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+
+/**
+ * Synchronously bridges interceptors between an {@link org.apache.tuscany.spi.wire.InboundInvocationChain} and an
+ * {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SynchronousBridgingInterceptor implements BridgingInterceptor {
+ private Interceptor next;
+
+ public SynchronousBridgingInterceptor() {
+ }
+
+ public SynchronousBridgingInterceptor(Interceptor next) {
+ this.next = next;
+ }
+
+ public Message invoke(Message msg) {
+ return next.invoke(msg);
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ 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/wire/WireObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.java
new file mode 100644
index 0000000000..c04869e8f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireObjectFactory.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 org.apache.tuscany.core.wire;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.wire.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Uses a wire to return an object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private OutboundWire wire;
+ private WireService wireService;
+ // the cache of proxy interface method to operation mappings
+ private Map<Method, OutboundChainHolder> mappings;
+ private boolean optimizable;
+
+ /**
+ * Constructor.
+ *
+ * @param interfaze the interface to inject on the client
+ * @param wire the backing wire
+ * @param wireService the wire service to create the proxy
+ * @throws NoMethodForOperationException
+ */
+ public WireObjectFactory(Class<T> interfaze, OutboundWire wire, WireService wireService)
+ throws NoMethodForOperationException {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.wireService = wireService;
+ this.mappings = WireUtils.createInterfaceToWireMapping(interfaze, wire);
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ // note optimization must be done lazily as wire object factories are created during the build phase prior
+ // to the outbound and inbound wires being connected
+ if ((optimizable
+ || wire.isOptimizable())
+ && wire.getServiceContract().getInterfaceClass() != null
+ && interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ optimizable = true;
+ try {
+ return interfaze.cast(wire.getTargetService());
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+ // clone the cached mappings
+ Map<Method, OutboundChainHolder> newChains = new HashMap<Method, OutboundChainHolder>(mappings.size());
+ for (Map.Entry<Method, OutboundChainHolder> entry : mappings.entrySet()) {
+ newChains.put(entry.getKey(), entry.getValue().clone());
+ }
+ return interfaze.cast(wireService.createProxy(interfaze, wire, newChains));
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java
new file mode 100644
index 0000000000..80ab5b361a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireServiceExtension.java
@@ -0,0 +1,323 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.core.binding.local.LocalReferenceBinding;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+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.Multiplicity;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
+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.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * Base class for wire service extensions
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WireServiceExtension implements WireService {
+ protected PolicyBuilderRegistry policyRegistry;
+ protected WorkContext context;
+
+ protected WireServiceExtension(WorkContext context, PolicyBuilderRegistry policyRegistry) {
+ this.policyRegistry = policyRegistry;
+ this.context = context;
+ }
+
+ public OutboundInvocationChain createOutboundChain(Operation<?> operation) {
+ return new OutboundInvocationChainImpl(operation);
+ }
+
+ public InboundInvocationChain createInboundChain(Operation<?> operation) {
+ return new InboundInvocationChainImpl(operation);
+ }
+
+ public InboundWire createWire(ServiceDefinition service) {
+ InboundWire wire = new InboundWireImpl();
+ ServiceContract<?> contract = service.getServiceContract();
+ wire.setServiceContract(contract);
+ wire.setServiceName(service.getName());
+ for (Operation<?> operation : contract.getOperations().values()) {
+ InboundInvocationChain chain = createInboundChain(operation);
+ // TODO handle policy
+ chain.addInterceptor(new InvokerInterceptor());
+ wire.addInvocationChain(operation, chain);
+ }
+ if (contract.getCallbackName() != null) {
+ wire.setCallbackReferenceName(service.getCallbackReferenceName());
+ }
+ return wire;
+ }
+
+ public void createWires(AtomicComponent component, ComponentDefinition<?> definition) {
+ Implementation<?> implementation = definition.getImplementation();
+ ComponentType<?, ?, ?> componentType = implementation.getComponentType();
+ // create incoming service wires
+ for (ServiceDefinition service : componentType.getServices().values()) {
+ InboundWire wire = createWire(service);
+ wire.setContainer(component);
+ component.addInboundWire(wire);
+ }
+ // create outgoing reference wires
+ for (ComponentReferenceDefinition refDefn : definition.getReferences().values()) {
+ if (!refDefn.isWiredByImpl()) {
+ List<OutboundWire> wires = createWire(refDefn.getTargets(), refDefn);
+ Multiplicity multiplicity = refDefn.getMultiplicity();
+ if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+ // 0..1 or 1..1
+ for (OutboundWire wire : wires) {
+ wire.setContainer(component);
+ component.addOutboundWire(wire);
+ }
+ } else {
+ // 0..N or 1..N
+ for (OutboundWire wire : wires) {
+ wire.setContainer(component);
+ }
+ component.addOutboundWires(wires);
+ }
+ }
+ }
+ }
+
+ public void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, QualifiedName targetName) {
+ InboundWire inboundWire = new InboundWireImpl(referenceBinding.getBindingType());
+ inboundWire.setServiceContract(contract);
+ inboundWire.setContainer(referenceBinding);
+ for (Operation<?> operation : contract.getOperations().values()) {
+ InboundInvocationChain chain = createInboundChain(operation);
+ inboundWire.addInvocationChain(operation, chain);
+ }
+ OutboundWire outboundWire = new OutboundWireImpl(referenceBinding.getBindingType());
+ outboundWire.setTargetName(targetName);
+
+ // [rfeng] Check if the Reference has the binding contract
+ ServiceContract<?> bindingContract = referenceBinding.getBindingServiceContract();
+ if (bindingContract == null) {
+ bindingContract = contract;
+ }
+ outboundWire.setServiceContract(bindingContract);
+ outboundWire.setContainer(referenceBinding);
+ for (Operation<?> operation : bindingContract.getOperations().values()) {
+ OutboundInvocationChain chain = createOutboundChain(operation);
+ if (referenceBinding instanceof LocalReferenceBinding) {
+ // Not ideal but the local binding case is special as its inbound and outbound wires are connected
+ // before the outbound wire is connected to the reference target. This requires the binding outbound
+ // chain to have an interceptor to connect to from the binding inbound chain. This outbound
+ // interceptor will then be bridged to the head target interceptor
+ chain.addInterceptor(new SynchronousBridgingInterceptor());
+ } else {
+ chain.addInterceptor(new InvokerInterceptor());
+ }
+ outboundWire.addInvocationChain(operation, chain);
+ }
+ // Add target callback chain to outbound wire
+ if (contract.getCallbackName() != null) {
+ outboundWire.setCallbackInterface(contract.getCallbackClass());
+ for (Operation<?> operation : contract.getCallbackOperations().values()) {
+ InboundInvocationChain callbackTargetChain = createInboundChain(operation);
+ // TODO handle policy
+ callbackTargetChain.addInterceptor(new InvokerInterceptor());
+ outboundWire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
+ }
+ }
+ referenceBinding.setInboundWire(inboundWire);
+ referenceBinding.setOutboundWire(outboundWire);
+ }
+
+ public void createWires(ServiceBinding serviceBinding, ServiceContract<?> contract, String targetName) {
+ InboundWire inboundWire = new InboundWireImpl(serviceBinding.getBindingType());
+ // [rfeng] Check if the Reference has the serviceBinding contract
+ ServiceContract<?> bindingContract = serviceBinding.getBindingServiceContract();
+ if (bindingContract == null) {
+ bindingContract = contract;
+ }
+ inboundWire.setServiceContract(bindingContract);
+ inboundWire.setContainer(serviceBinding);
+ for (Operation<?> operation : bindingContract.getOperations().values()) {
+ InboundInvocationChain inboundChain = createInboundChain(operation);
+ inboundChain.addInterceptor(new SynchronousBridgingInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+ }
+
+ OutboundWire outboundWire = new OutboundWireImpl(serviceBinding.getBindingType());
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName(targetName));
+ outboundWire.setContainer(serviceBinding);
+
+ for (Operation<?> operation : contract.getOperations().values()) {
+ OutboundInvocationChain outboundChain = createOutboundChain(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+ }
+
+ // Add target callback chain to outbound wire
+ if (contract.getCallbackName() != null) {
+ outboundWire.setCallbackInterface(contract.getCallbackClass());
+ for (Operation<?> operation : contract.getCallbackOperations().values()) {
+ InboundInvocationChain callbackTargetChain = createInboundChain(operation);
+ // TODO handle policy
+ callbackTargetChain.addInterceptor(new InvokerInterceptor());
+ outboundWire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
+ }
+ }
+ serviceBinding.setInboundWire(inboundWire);
+ serviceBinding.setOutboundWire(outboundWire);
+ }
+
+ /**
+ * Compares two operations for wiring compatibility as defined by the SCA assembly specification, namely: <p/> <ol>
+ * <li>compatibility for the individual method is defined as compatibility of the signature, that is method name,
+ * input types, and output types MUST BE the same. <li>the order of the input and output types also MUST BE the
+ * same. <li>the set of Faults and Exceptions expected by the source MUST BE the same or be a superset of those
+ * specified by the service. </ol>
+ *
+ * @param source the source contract to compare
+ * @param target the target contract to compare
+ * @throws org.apache.tuscany.spi.wire.IncompatibleServiceContractException
+ * if the two contracts don't match
+ */
+ public void checkCompatibility(ServiceContract<?> source, ServiceContract<?> target, boolean ignoreCallback)
+ throws IncompatibleServiceContractException {
+ if (source == target) {
+ // Shortcut for performance
+ return;
+ }
+// TODO: TUSCANY-1111, this test fails when wiring java to wsdl
+// if (source.isRemotable() != target.isRemotable()) {
+// throw new IncompatibleServiceContractException("Remotable settings do not match", source, target);
+// }
+ if (source.getInteractionScope() != target.getInteractionScope()) {
+ throw new IncompatibleServiceContractException("Interaction scopes settings do not match", source, target);
+ }
+
+ for (Operation<?> operation : source.getOperations().values()) {
+ Operation<?> targetOperation = target.getOperation(operation.getName());
+ if (targetOperation == null) {
+ throw new IncompatibleServiceContractException("Operation not found on target", source, target);
+ }
+ if (!targetOperation.equals(operation)) {
+ throw new IncompatibleServiceContractException("Target operations are not compatible", source, target);
+ }
+ }
+
+ if (ignoreCallback) {
+ return;
+ }
+
+ for (Operation<?> operation : source.getCallbackOperations().values()) {
+ Operation<?> targetOperation = target.getCallbackOperations().get(operation.getName());
+ if (targetOperation == null) {
+ throw new IncompatibleServiceContractException("Callback operation not found on target",
+ source,
+ target,
+ null,
+ targetOperation);
+ }
+ if (!operation.equals(targetOperation)) {
+ throw new IncompatibleServiceContractException("Target callback operation is not compatible",
+ source,
+ target,
+ operation,
+ targetOperation);
+ }
+ }
+ }
+
+
+ /**
+ * Creates a wire for flowing outbound invocations from a reference
+ *
+ * @param target the reference definition
+ * @param definition the reference target configuration
+ * @return the wire the outbound wire
+ */
+ protected List<OutboundWire> createWire(List<URI> targetUris, ComponentReferenceDefinition definition) {
+ ServiceContract<?> contract = definition.getServiceContract();
+ List<OutboundWire> outboundWires = new ArrayList<OutboundWire>();
+ if (definition.getAssociatedCompTypeRefDefn().isAutowire() || definition.isAutowire()) {
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setAutowire(true);
+ wire.setServiceContract(contract);
+ wire.setReferenceName(definition.getName());
+ for (Operation<?> operation : contract.getOperations().values()) {
+ // TODO handle policy
+ OutboundInvocationChain chain = createOutboundChain(operation);
+ wire.addInvocationChain(operation, chain);
+ }
+ if (contract.getCallbackName() != null) {
+ wire.setCallbackInterface(contract.getCallbackClass());
+ for (Operation<?> operation : contract.getCallbackOperations().values()) {
+ InboundInvocationChain callbackTargetChain = createInboundChain(operation);
+ // TODO handle policy
+ callbackTargetChain.addInterceptor(new InvokerInterceptor());
+ wire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
+ }
+ }
+ outboundWires.add(wire);
+ } else {
+ for (URI uri : targetUris) {
+ OutboundWire wire = new OutboundWireImpl();
+ QualifiedName qName = new QualifiedName(uri.toString());
+ wire.setTargetName(qName);
+ wire.setServiceContract(contract);
+ wire.setReferenceName(definition.getName());
+ for (Operation<?> operation : contract.getOperations().values()) {
+ // TODO handle policy
+ OutboundInvocationChain chain = createOutboundChain(operation);
+ wire.addInvocationChain(operation, chain);
+
+ }
+ if (contract.getCallbackName() != null) {
+ wire.setCallbackInterface(contract.getCallbackClass());
+ for (Operation<?> operation : contract.getCallbackOperations().values()) {
+ InboundInvocationChain callbackTargetChain = createInboundChain(operation);
+ // TODO handle policy
+ callbackTargetChain.addInterceptor(new InvokerInterceptor());
+ wire.addTargetCallbackInvocationChain(operation, callbackTargetChain);
+ }
+ }
+ outboundWires.add(wire);
+ }
+ }
+ return outboundWires;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java
new file mode 100644
index 0000000000..73aa34e6bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.SCAObject;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+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.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Utilities for operating on wires
+ *
+ * @version $Rev$ $Date$
+ */
+public final class WireUtils {
+
+ private WireUtils() {
+ }
+
+ /**
+ * Maps invocation chains on a wire to corresponding methods
+ *
+ * @param wire the wire containing the invocation chains to map
+ * @param methods the methods to map to
+ * @return a collection containing the method to invocation chain mapping
+ * @throws NoMethodForOperationException
+ */
+ public static Map<Method, InboundInvocationChain> createInboundMapping(InboundWire wire, Method[] methods)
+ throws NoMethodForOperationException {
+ Map<Method, InboundInvocationChain> chains = new HashMap<Method, InboundInvocationChain>();
+ for (Map.Entry<Operation<?>, InboundInvocationChain> entry : wire.getInvocationChains().entrySet()) {
+ Operation<?> operation = entry.getKey();
+ InboundInvocationChain chain = entry.getValue();
+ Method method = findMethod(operation, methods);
+ if (method == null) {
+ throw new NoMethodForOperationException(operation.getName());
+ }
+ chains.put(method, chain);
+ }
+ return chains;
+ }
+
+
+ /**
+ * Maps methods on an interface to operations on a wire
+ *
+ * @param interfaze the interface to map from
+ * @param wire the wire to map to
+ * @return a collection of method to operation mappings
+ * @throws NoMethodForOperationException
+ */
+ public static Map<Method, OutboundChainHolder> createInterfaceToWireMapping(Class<?> interfaze, OutboundWire wire)
+ throws NoMethodForOperationException {
+ Map<Operation<?>, OutboundInvocationChain> invocationChains = wire.getInvocationChains();
+ Map<Method, OutboundChainHolder> chains = new HashMap<Method, OutboundChainHolder>(invocationChains.size());
+ Method[] methods = interfaze.getMethods();
+ for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : invocationChains.entrySet()) {
+ Operation operation = entry.getKey();
+ Method method = findMethod(operation, methods);
+ if (method == null) {
+ throw new NoMethodForOperationException(operation.getName());
+ }
+ chains.put(method, new OutboundChainHolder(entry.getValue()));
+ }
+ return chains;
+ }
+
+ /**
+ * Determines if the given wire is optimizable, i.e. its invocation chains may be bypassed during an invocation.
+ * This is typically calculated during the connect phase to optimize away invocation chains.
+ *
+ * @param wire the wire
+ * @return true if the wire is optimizable
+ */
+ public static boolean isOptimizable(OutboundWire wire) {
+ for (OutboundInvocationChain chain : wire.getInvocationChains().values()) {
+ if (chain.getHeadInterceptor() != null) {
+ Interceptor current = chain.getHeadInterceptor();
+ if (current == null) {
+ break;
+ }
+ while (current != null) {
+ if (!current.isOptimizable()) {
+ return false;
+ }
+ current = current.getNext();
+ }
+ }
+ }
+ // if there is a callback, the wire is never optimizable since the callback target needs to be disambiguated
+ return wire.getTargetCallbackInvocationChains().isEmpty();
+ }
+
+ /**
+ * Determines if the given wire is optimizable, i.e. its invocation chains may be bypassed during an invocation.
+ * This is typically calculated during the connect phase to optimize away invocation chains.
+ *
+ * @param wire the wire
+ * @return true if the wire is optimizable
+ */
+ public static boolean isOptimizable(InboundWire wire) {
+ SCAObject container = wire.getContainer();
+ if (!(container instanceof Component) || !((Component) container).isOptimizable()) {
+ return false;
+ }
+ for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
+ if (chain.getHeadInterceptor() != null) {
+ Interceptor current = chain.getHeadInterceptor();
+ while (current != null) {
+ if (!current.isOptimizable()) {
+ return false;
+ }
+ current = current.getNext();
+ }
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java
new file mode 100644
index 0000000000..741ef21794
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandler.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire.jdk;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReactivationException;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findOperation;
+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;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+
+
+/**
+ * Responsible for invoking on an outbound wire associated with a callback. The handler retrieves the correct outbound
+ * callback wire from the work context.
+ * <p/>
+ * TODO cache target invoker
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandler extends AbstractOutboundInvocationHandler
+ implements WireInvocationHandler, InvocationHandler, Externalizable, SCAExternalizable {
+ private transient WorkContext context;
+ private transient InboundWire wire;
+ private String serviceName;
+
+ /**
+ * Constructor used for deserialization only
+ */
+ public JDKCallbackInvocationHandler() {
+ }
+
+ public JDKCallbackInvocationHandler(InboundWire wire, WorkContext context) {
+ this.context = context;
+ this.wire = wire;
+ this.serviceName = wire.getServiceName();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getParameterTypes().length == 0 && "toString".equals(method.getName())) {
+ return "[Proxy - " + Integer.toHexString(hashCode()) + "]";
+ } else if (method.getDeclaringClass().equals(Object.class)
+ && "equals".equals(method.getName())) {
+ // TODO implement
+ throw new UnsupportedOperationException();
+ } else if (Object.class.equals(method.getDeclaringClass())
+ && "hashCode".equals(method.getName())) {
+ return hashCode();
+ // TODO beter hash algorithm
+ }
+ Object correlationId = context.getCurrentCorrelationId();
+ context.setCurrentCorrelationId(null);
+ LinkedList<Object> callbackRoutingChain = (LinkedList<Object>) context.getCurrentCallbackRoutingChain().clone();
+ if (callbackRoutingChain == null) {
+ throw new AssertionError("Missing stack of from addresses");
+ }
+ 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<Operation<?>, OutboundInvocationChain> sourceCallbackInvocationChains =
+ wire.getSourceCallbackInvocationChains(targetAddress);
+ Operation operation = findOperation(method, sourceCallbackInvocationChains.keySet());
+ OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation);
+ TargetInvoker invoker = chain.getTargetInvoker();
+
+ try {
+ return invoke(chain, invoker, args, correlationId, callbackRoutingChain);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof NoRegisteredCallbackException) {
+ throw t;
+ }
+ throw e;
+ }
+ }
+
+
+ public Object invoke(Method method, Object[] args) throws Throwable {
+ return invoke(null, method, args);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(serviceName);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ serviceName = (String) in.readObject();
+ }
+
+ public void setWorkContext(WorkContext context) {
+ this.context = context;
+ }
+
+ public void reactivate() throws ReactivationException {
+ AtomicComponent owner = context.getCurrentAtomicComponent();
+ if (owner == null) {
+ throw new ReactivationException("Current atomic component not set on work context");
+ }
+ wire = owner.getInboundWire(serviceName);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandler.java
new file mode 100644
index 0000000000..d0d82484e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandler.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire.jdk;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReactivationException;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.TargetInvocationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.AbstractInboundInvocationHandler;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+
+import org.apache.tuscany.core.wire.WireUtils;
+
+
+/**
+ * Receives a request from a proxy and performs an invocation on an {@link org.apache.tuscany.spi.wire.InboundWire} via
+ * an {@link InboundInvocationChain}
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JDKInboundInvocationHandler extends AbstractInboundInvocationHandler
+ implements WireInvocationHandler, InvocationHandler, Externalizable, SCAExternalizable {
+ private static final long serialVersionUID = -307902641125881043L;
+
+ /*
+ * an association of an operation to chain holder. The holder contains the invocation chain
+ * and a local clone of the master TargetInvoker. TargetInvokers will be cloned by the handler and placed in the
+ * holder if they are cacheable. This allows optimizations such as avoiding target resolution when a source refers
+ * to a target of greater scope since the target reference can be maintained by the invoker. When a target invoker
+ * is not cacheable, the master associated with the wire chains will be used.
+ */
+ private transient Map<Method, ChainHolder> chains;
+ private transient WorkContext context;
+ private String serviceName;
+ private Class<?> interfaze;
+
+ /**
+ * Constructor used for deserialization only
+ */
+ public JDKInboundInvocationHandler() {
+ }
+
+ public JDKInboundInvocationHandler(Class<?> interfaze, InboundWire wire, WorkContext context) {
+ this.context = context;
+ this.serviceName = wire.getServiceName();
+ this.interfaze = interfaze;
+ init(interfaze, wire);
+ }
+
+ public void setWorkContext(WorkContext context) {
+ this.context = context;
+ }
+
+ /**
+ * Dispatches a client request made on a proxy
+ */
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ ChainHolder holder = chains.get(method);
+ if (holder == null) {
+ if (method.getParameterTypes().length == 0 && "toString".equals(method.getName())) {
+ return "[Proxy - " + Integer.toHexString(hashCode()) + "]";
+ } else if (method.getDeclaringClass().equals(Object.class)
+ && "equals".equals(method.getName())) {
+ // TODO implement
+ throw new UnsupportedOperationException();
+ } else if (Object.class.equals(method.getDeclaringClass())
+ && "hashCode".equals(method.getName())) {
+ return hashCode();
+ // TODO beter hash algorithm
+ }
+ throw new TargetInvocationException("Operation not configured", method.getName());
+ }
+ InboundInvocationChain chain = holder.chain;
+ TargetInvoker invoker;
+ if (holder.cachedInvoker == null) {
+ assert chain != null;
+ if (chain.getTargetInvoker() == null) {
+ String name = chain.getOperation().getName();
+ throw new TargetInvocationException("No target invoker configured for operation", name);
+ }
+ if (chain.getTargetInvoker().isCacheable()) {
+ // clone and store the invoker locally
+ holder.cachedInvoker = (TargetInvoker) chain.getTargetInvoker().clone();
+ invoker = holder.cachedInvoker;
+ } else {
+ invoker = chain.getTargetInvoker();
+ }
+ } else {
+ assert chain != null;
+ invoker = chain.getTargetInvoker();
+ }
+ context.setCurrentCorrelationId(null);
+ return invoke(chain, invoker, args);
+ }
+
+
+ public Object invoke(Method method, Object[] args) throws Throwable {
+ return invoke(null, method, args);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(serviceName);
+ out.writeObject(interfaze);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ serviceName = (String) in.readObject();
+ interfaze = (Class<?>) in.readObject();
+ }
+
+ public void reactivate() throws ReactivationException {
+ // TODO this method will be extremely slow - look to optimize
+ AtomicComponent owner = context.getCurrentAtomicComponent();
+ if (owner == null) {
+ throw new ReactivationException("Current atomic component not set on work context");
+ }
+ InboundWire wire = owner.getInboundWire(serviceName);
+ init(interfaze, wire);
+ }
+
+ private void init(Class<?> interfaze, InboundWire wire) {
+ this.chains = new HashMap<Method, ChainHolder>();
+ Method[] methods = interfaze.getMethods();
+ Map<Method, InboundInvocationChain> invocationChains = WireUtils.createInboundMapping(wire, methods);
+ for (Map.Entry<Method, InboundInvocationChain> entry : invocationChains.entrySet()) {
+ this.chains.put(entry.getKey(), new ChainHolder(entry.getValue()));
+ }
+ }
+
+ /**
+ * A holder used to associate an wire chain with a local copy of a target invoker that was previously cloned from
+ * the chain master
+ */
+ private class ChainHolder {
+ InboundInvocationChain chain;
+ TargetInvoker cachedInvoker;
+
+ public ChainHolder(InboundInvocationChain config) {
+ this.chain = config;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java
new file mode 100644
index 0000000000..99cfb3c627
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire.jdk;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReactivationException;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetInvocationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import static org.apache.tuscany.spi.model.InteractionScope.CONVERSATIONAL;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.AbstractOutboundInvocationHandler;
+import org.apache.tuscany.spi.wire.OutboundChainHolder;
+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.WireInvocationHandler;
+
+import org.apache.tuscany.core.implementation.PojoAtomicComponent;
+import org.apache.tuscany.core.wire.NoMethodForOperationException;
+import org.apache.tuscany.core.wire.WireUtils;
+
+
+/**
+ * Receives a request from a proxy and performs an invocation on an {@link org.apache.tuscany.spi.wire.OutboundWire} via
+ * an {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JDKOutboundInvocationHandler extends AbstractOutboundInvocationHandler
+ implements WireInvocationHandler, InvocationHandler, Externalizable, SCAExternalizable {
+ private static final long serialVersionUID = -6155278451964527325L;
+
+ /*
+ * an association of an operation to chain holder. The holder contains an invocation chain
+ * and a local clone of the master TargetInvoker. TargetInvokers will be cloned by the handler and placed in the
+ * holder if they are cacheable. This allows optimizations such as avoiding target resolution when a source refers
+ * to a target of greater scope since the target reference can be maintained by the invoker. When a target invoker
+ * is not cacheable, the master associated with the wire chains will be used.
+ */
+ private transient Map<Method, OutboundChainHolder> chains;
+ private transient WorkContext workContext;
+ private transient Object fromAddress;
+ private transient boolean wireContainerIsAtomicComponent;
+ private transient boolean contractHasCallback;
+ private transient boolean callbackIsImplemented;
+ private transient String callbackClassName;
+ private transient boolean contractIsRemotable;
+ private transient boolean contractIsConversational;
+ private transient String convIdForRemotableTarget;
+ private transient String convIdFromThread;
+ private String referenceName;
+ private Class<?> interfaze;
+
+ /**
+ * Constructor used for deserialization only
+ */
+ public JDKOutboundInvocationHandler() {
+ }
+
+ public JDKOutboundInvocationHandler(Class<?> interfaze, OutboundWire wire, WorkContext workContext)
+ throws NoMethodForOperationException {
+ this.workContext = workContext;
+ this.interfaze = interfaze;
+ init(interfaze, wire, null);
+ }
+
+ public JDKOutboundInvocationHandler(Class<?> interfaze,
+ OutboundWire wire,
+ Map<Method, OutboundChainHolder> mapping,
+ WorkContext workContext)
+ throws NoMethodForOperationException {
+ this.workContext = workContext;
+ this.interfaze = interfaze;
+ init(interfaze, wire, mapping);
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ OutboundChainHolder holder = chains.get(method);
+ if (holder == null) {
+ if (method.getParameterTypes().length == 0 && "toString".equals(method.getName())) {
+ return "[Proxy - " + Integer.toHexString(hashCode()) + "]";
+ } else if (method.getDeclaringClass().equals(Object.class)
+ && "equals".equals(method.getName())) {
+ // TODO implement
+ throw new UnsupportedOperationException();
+ } else if (Object.class.equals(method.getDeclaringClass())
+ && "hashCode".equals(method.getName())) {
+ return hashCode();
+ // TODO beter hash algorithm
+ }
+ throw new TargetInvocationException("Operation not configured", method.getName());
+ }
+ OutboundInvocationChain chain = holder.getChain();
+ TargetInvoker invoker;
+
+ if (holder.getCachedInvoker() == null) {
+ assert chain != null;
+ if (chain.getTargetInvoker() == null) {
+ String name = chain.getOperation().getName();
+ throw new TargetInvocationException("No target invoker configured for operation", name);
+ }
+ if (chain.getTargetInvoker().isCacheable()) {
+ // clone and store the invoker locally
+ holder.setCachedInvoker((TargetInvoker) chain.getTargetInvoker().clone());
+ invoker = holder.getCachedInvoker();
+ } else {
+ invoker = chain.getTargetInvoker();
+ }
+ } else {
+ assert chain != null;
+ invoker = chain.getTargetInvoker();
+ }
+
+ if (wireContainerIsAtomicComponent && contractHasCallback && !callbackIsImplemented) {
+ throw new NoRegisteredCallbackException("Instance is does not implement callback: "
+ + callbackClassName);
+ }
+
+ if (contractIsConversational) {
+ assert workContext != null : "Work context cannot be null for conversational invocation";
+ // Check for a conv id on thread and remember it
+ convIdFromThread = (String) workContext.getIdentifier(Scope.CONVERSATION);
+ if (contractIsRemotable) {
+ if (convIdForRemotableTarget == null) {
+ convIdForRemotableTarget = createConversationID();
+ }
+ // Always use the conv id for this target
+ workContext.setIdentifier(Scope.CONVERSATION, convIdForRemotableTarget);
+ } else if (convIdFromThread == null) {
+ String newConvId = createConversationID();
+ workContext.setIdentifier(Scope.CONVERSATION, newConvId);
+ }
+ }
+
+ Object result = invoke(chain, invoker, args, null, null);
+ if (contractIsConversational && contractIsRemotable) {
+ // Make sure we restore the remembered conv id to continue propagating
+ workContext.setIdentifier(Scope.CONVERSATION, convIdFromThread);
+ }
+ return result;
+ }
+
+ public Object invoke(Method method, Object[] args) throws Throwable {
+ return invoke(null, method, args);
+ }
+
+ protected Object getFromAddress() {
+ return contractHasCallback ? fromAddress : null;
+ }
+
+ public void setWorkContext(WorkContext context) {
+ workContext = context;
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(referenceName);
+ out.writeObject(interfaze);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ referenceName = (String) in.readObject();
+ interfaze = (Class<?>) in.readObject();
+ }
+
+ public void reactivate() throws ReactivationException {
+ AtomicComponent owner = workContext.getCurrentAtomicComponent();
+ if (owner == null) {
+ throw new ReactivationException("Current atomic component not set on work context");
+ }
+ List<OutboundWire> wires = owner.getOutboundWires().get(referenceName);
+ if (wires == null) {
+ throw new ReactivationException("Reference wire not found", referenceName, owner.getName());
+ }
+ // TODO handle multiplicity
+ OutboundWire wire = wires.get(0);
+ try {
+ init(interfaze, wire, null);
+ } catch (NoMethodForOperationException e) {
+ throw new ReactivationException(e);
+ }
+ }
+
+ private void init(Class<?> interfaze, OutboundWire wire, Map<Method, OutboundChainHolder> mapping)
+ throws NoMethodForOperationException {
+ ServiceContract contract = wire.getServiceContract();
+ this.referenceName = wire.getReferenceName();
+ SCAObject wireContainer = wire.getContainer();
+ this.fromAddress = (wireContainer == null) ? null : wireContainer.getName();
+ this.contractIsConversational = contract.getInteractionScope().equals(CONVERSATIONAL);
+ this.contractIsRemotable = contract.isRemotable();
+ this.contractHasCallback = contract.getCallbackClass() != null;
+ if (contractHasCallback) {
+ this.callbackClassName = contract.getCallbackClass().getName();
+ } else {
+ this.callbackClassName = null;
+ }
+ // FIXME JFM this should be done during the callback and not be dependent on PojoAtomicComponent
+ this.wireContainerIsAtomicComponent = wireContainer instanceof PojoAtomicComponent;
+ if (wireContainerIsAtomicComponent && contractHasCallback) {
+ this.callbackIsImplemented =
+ ((PojoAtomicComponent) wireContainer).implementsCallback(contract.getCallbackClass());
+ } else {
+ this.callbackIsImplemented = false;
+ }
+ if (mapping == null) {
+ chains = WireUtils.createInterfaceToWireMapping(interfaze, wire);
+ } else {
+ chains = mapping;
+ }
+ }
+
+ // TODO Temporary fix to return a string with a UUID
+ private String createConversationID() {
+ return UUID.randomUUID().toString();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
new file mode 100644
index 0000000000..e15b851351
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.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.core.wire.jdk;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+
+import org.apache.tuscany.core.wire.WireServiceExtension;
+
+/**
+ * the default implementation of a wire service that uses JDK dynamic proxies
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@EagerInit
+public class JDKWireService extends WireServiceExtension {
+
+ public JDKWireService() {
+ super(null, null);
+ }
+
+ @Constructor
+ public JDKWireService(@Autowire WorkContext context, @Autowire PolicyBuilderRegistry policyRegistry) {
+ super(context, policyRegistry);
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException {
+ assert interfaze != null;
+ assert wire != null;
+ if (wire instanceof InboundWire) {
+ InboundWire inbound = (InboundWire) wire;
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(interfaze, inbound, context);
+ ClassLoader cl = interfaze.getClassLoader();
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
+ } else if (wire instanceof OutboundWire) {
+ OutboundWire outbound = (OutboundWire) wire;
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(interfaze, outbound, context);
+ ClassLoader cl = interfaze.getClassLoader();
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
+ } else {
+ throw new ProxyCreationException("Invalid wire type", wire.getClass().getName());
+ }
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, OutboundChainHolder> mapping)
+ throws ProxyCreationException {
+ assert interfaze != null;
+ assert wire != null;
+ assert mapping != null;
+ if (wire instanceof InboundWire) {
+ InboundWire inbound = (InboundWire) wire;
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(interfaze, inbound, context);
+ ClassLoader cl = interfaze.getClassLoader();
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
+ } else if (wire instanceof OutboundWire) {
+ OutboundWire outbound = (OutboundWire) wire;
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(interfaze, outbound, context);
+ ClassLoader cl = interfaze.getClassLoader();
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
+ } else {
+ throw new ProxyCreationException("Invalid wire type", wire.getClass().getName());
+ }
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException {
+ ClassLoader cl = interfaze.getClassLoader();
+ JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, context);
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
+ }
+
+ public WireInvocationHandler createHandler(Class<?> interfaze, Wire wire) {
+ assert wire != null;
+ if (wire instanceof InboundWire) {
+ InboundWire inbound = (InboundWire) wire;
+ return new JDKInboundInvocationHandler(interfaze, inbound, context);
+ } else if (wire instanceof OutboundWire) {
+ OutboundWire outbound = (OutboundWire) wire;
+ return new JDKOutboundInvocationHandler(interfaze, outbound, context);
+ } else {
+ throw new ProxyCreationException("Invalid wire type", wire.getClass().getName());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/META-INF/tuscany/default-system.composite b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/META-INF/tuscany/default-system.composite
new file mode 100644
index 0000000000..e77a4fcb06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/META-INF/tuscany/default-system.composite
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="default-system">
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployer">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl" />
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl" />
+ </component>
+
+ <!-- Wire service -->
+ <component name="wireService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireService" />
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl" />
+ </component>
+
+ <!-- Store infrastructure -->
+ <component name="store">
+ <system:implementation.system class="org.apache.tuscany.core.services.store.memory.MemoryStore" />
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl" />
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl" />
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl" />
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry" />
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl" />
+ </component>
+
+ <component name="wirePostProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl" />
+ </component>
+
+ <!-- Default scopes -->
+ <component name="scope.module">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.CompositeScopeObjectFactory" />
+ </component>
+ <component name="scope.stateless">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.StatelessScopeObjectFactory" />
+ </component>
+ <component name="scope.request">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.RequestScopeObjectFactory" />
+ </component>
+
+ <component name="scope.conversational">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ConversationalScopeObjectFactory" />
+ </component>
+
+ <!-- service for resolving artifacts against the user's local Maven repository -->
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository" />
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <!-- WorkScheduler service -->
+ <component name="workManager">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager" />
+ <property name="poolSize">10</property>
+ </component>
+
+ <component name="workScheduler">
+ <system:implementation.system class="org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler" />
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl" />
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl" />
+ </component>
+
+ <component name="wireLoader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.WireLoader" />
+ </component>
+
+ <!-- include loader configuration -->
+ <include name="org.apache.tuscany.launcher.Loader" scdlResource="org/apache/tuscany/core/loader.scdl" />
+
+ <!-- include implementation processor configuration -->
+ <include name="org.apache.tuscany.launcher.Implementation" scdlResource="org/apache/tuscany/core/implementation.scdl" />
+
+ <!-- Java interface definition language -->
+ <include name="org.apache.tuscany.launcher.InterfaceJava" scdlResource="org/apache/tuscany/core/interfaceJava.scdl" />
+
+ <!-- include omposite implementation type -->
+ <include name="org.apache.tuscany.launcher.Composite" scdlResource="org/apache/tuscany/core/composite.scdl" />
+
+ <!-- System implementation type -->
+ <include name="org.apache.tuscany.launcher.SystemImplementation"
+ scdlResource="org/apache/tuscany/core/systemImplementation.scdl" />
+
+ <!-- Java implementation type -->
+ <include name="org.apache.tuscany.launcher.JavaImplementation"
+ scdlResource="org/apache/tuscany/core/javaImplementation.scdl" />
+
+ <!-- Data Binding -->
+ <include name="org.apache.tuscany.launcher.DataBinding" scdlResource="org/apache/tuscany/core/databinding.scdl" />
+
+ <!-- Logging formatters -->
+ <include name="org.apache.tuscany.launcher.Formatters" scdlResource="org/apache/tuscany/core/formatters.scdl" />
+
+ <!-- Deployment -->
+ <include name="org.apache.tuscany.launcher.Deployment" scdlResource="org/apache/tuscany/core/deployment.scdl" />
+
+ <!-- the local binding -->
+ <component name="localBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingLoader" />
+ </component>
+
+ <component name="localBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.binding.local.LocalBindingBuilder" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/composite.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/composite.scdl
new file mode 100644
index 0000000000..b51c9e4f68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/composite.scdl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Composite">
+
+ <!-- Composite implementation type -->
+ <component name="composite.loader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.CompositeLoader"/>
+ </component>
+ <component name="composite.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.ImplementationCompositeLoader"/>
+ </component>
+ <component name="composite.dependencyLoader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.DependencyLoader"/>
+ </component>
+ <component name="composite.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.CompositeComponentTypeLoader"/>
+ </component>
+ <component name="composite.builder">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.CompositeBuilder"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/databinding.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/databinding.scdl
new file mode 100644
index 0000000000..b2b0173191
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/databinding.scdl
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.DataBinding">
+
+ <component name="databinding.wirePostProcessor" initLevel="50">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.DataBindingWirePostProcessor" />
+ </component>
+
+ <component name="databinding.javaInterfaceProcessor">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.DataBindingJavaInterfaceProcessor" />
+ </component>
+
+ <!-- [rfeng] HACK: Make sure the passByValue interceptor is added before the databinding interceptor -->
+ <component name="databinding.passByValueWirePostProcessor" initLevel="80">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.PassByValueWirePostProcessor" />
+ </component>
+
+ <!-- DataBinding registry -->
+ <component name="databinding.registry">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.DataBindingRegistryImpl" />
+ </component>
+
+ <!-- DataBinding registry -->
+ <component name="databinding.mediator">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.MediatorImpl" />
+ </component>
+
+ <!-- Transformer registry -->
+ <component name="databinding.transformerRegistry" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.TransformerRegistryImpl" />
+ </component>
+
+ <component name="dataType.loader">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.DataTypeLoader" />
+ </component>
+
+ <component name="databinding.dom">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.DOMDataBinding" />
+ </component>
+
+ <component name="databinding.xmlString">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.XMLStringDataBinding" />
+ </component>
+
+ <!-- Group databindings -->
+ <component name="databinding.group.xml">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.XMLGroupDataBinding" />
+ </component>
+
+<!-- Comment out the stax databinding as it's covered in the databinding.group.xml -->
+<!--
+ <component name="databinding.stax">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.StAXDataBinding" />
+ </component>
+-->
+ <component name="databinding.javabeans">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.javabeans.JavaBeansDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+
+ <component name="transformer.Input2InputTransformer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.Input2InputTransformer" />
+ </component>
+
+ <component name="transformer.Exception2ExceptionTransformer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.Exception2ExceptionTransformer" />
+ </component>
+
+ <component name="transformer.Output2OutputTransformer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.Output2OutputTransformer" />
+ </component>
+
+ <component name="transformer.Group2GroupTransformer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.Group2GroupTransformer" />
+ </component>
+
+ <component name="transformer.InputSource2Node">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.InputSource2Node" />
+ </component>
+
+ <component name="transformer.InputSource2SAX">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.InputSource2SAX" />
+ </component>
+
+ <component name="transformer.InputStream2Node">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.InputStream2Node" />
+ </component>
+
+ <component name="transformer.InputStream2SAX">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.InputStream2SAX" />
+ </component>
+
+ <component name="transformer.DOMNode2JavaBean">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.javabeans.DOMNode2JavaBeanTransformer" />
+ </component>
+
+ <component name="transformer.Node2OutputStream">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Node2OutputStream" />
+ </component>
+
+ <component name="transformer.Node2String">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Node2String" />
+ </component>
+
+ <component name="transformer.Node2Writer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Node2Writer" />
+ </component>
+
+ <component name="transformer.Node2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Node2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.JavaBean2DOMNode">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.javabeans.JavaBean2DOMNodeTransformer" />
+ </component>
+
+ <component name="transformer.Reader2Node">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Reader2Node" />
+ </component>
+
+ <component name="transformer.Reader2SAX">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Reader2SAX" />
+ </component>
+
+ <component name="transformer.SAX2DOMPipe">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.SAX2DOMPipe" />
+ </component>
+
+ <component name="transformer.Source2ResultTransformer">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Source2ResultTransformer" />
+ </component>
+
+ <component name="transformer.StreamDataPipe">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.StreamDataPipe" />
+ </component>
+
+ <component name="transformer.String2Node">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.String2Node" />
+ </component>
+
+ <component name="transformer.String2SAX">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.String2SAX" />
+ </component>
+
+ <component name="transformer.String2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.String2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.Writer2ReaderDataPipe">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.Writer2ReaderDataPipe" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2Node">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.XMLStreamReader2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2SAX">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.XMLStreamReader2SAX" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2String">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.xml.XMLStreamReader2String" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl
new file mode 100644
index 0000000000..64f40ac566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/deployment.scdl
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Deployment-related system components
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Deployment">
+
+ <!-- Contribution Service -->
+ <component name="contributionDirectoryWatcher" initLevel="100">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionDirectoryWatcher" />
+ <property name="path">target/deployables</property>
+ </component>
+ <component name="contributionService" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionServiceImpl" />
+ </component>
+ <component name="contributionRepository" initLevel="40">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionRepositoryImpl" />
+ </component>
+
+ <!-- contribution processor registry and processors -->
+ <component name="contributionProcessorRegistry" initLevel="35">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContributionProcessorRegistryImpl" />
+ </component>
+
+ <component name="contentTypeDescriber" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ContentTypeDescriberImpl" />
+ </component>
+ <component name="JarContributionProcessor" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.JarContributionProcessor" />
+ </component>
+ <component name="FolderContributionProcessor" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.FolderContributionProcessor" />
+ </component>
+ <component name="JavaContributionProcessor" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.JavaContributionProcessor" />
+ </component>
+ <component name="CompositeContributionProcessor" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.contribution.CompositeContributionProcessor" />
+ </component>
+
+ <!-- contribution resolver registry and resolvers -->
+ <component name="artifactResolverRegistry" initLevel="35">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.ArtifactResolverRegistryImpl" />
+ </component>
+
+ <component name="ComponentDefinitionArtifactResolver" initLevel="30">
+ <system:implementation.system class="org.apache.tuscany.core.services.deployment.resolver.ComponentDefinitionArtifactResolver" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/formatters.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/formatters.scdl
new file mode 100644
index 0000000000..194bdd27fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/formatters.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Formatter configurations for JDK logging.
+
+ $Rev: 476250 $ $Date: 2006-11-17 10:56:22 -0800 (Fri, 17 Nov 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Formatters">
+
+ <component name="LoaderExceptionFormatter">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderExceptionFormatter"/>
+ </component>
+
+ <component name="IncompatibleServiceContractExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.wire.IncompatibleServiceContractExceptionFormatter"/>
+ </component>
+
+ <component name="WireExceptionExceptionFormatter">
+ <system:implementation.system
+ class="org.apache.tuscany.core.builder.WiringExceptionFormatter"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/implementation.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/implementation.scdl
new file mode 100644
index 0000000000..9d4a3dbeda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/implementation.scdl
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Implementation">
+
+ <!-- Foundation implementation processors -->
+ <component name="implementation.ImplementationProcessorService">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl"/>
+ </component>
+ <component name="implementation.Constructor">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ConstructorProcessor"/>
+ </component>
+ <component name="implementation.Destroy">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.DestroyProcessor"/>
+ </component>
+ <component name="implementation.Init">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.InitProcessor"/>
+ </component>
+ <component name="implementation.EagerInit">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.EagerInitProcessor"/>
+ </component>
+ <component name="implementation.Scope">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ScopeProcessor"/>
+ </component>
+ <component name="implementation.AllowsPassByReference">
+ <system:implementation.system
+ class="org.apache.tuscany.core.implementation.processor.AllowsPassByReferenceProcessor"/>
+ </component>
+ <component name="implementation.Property">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.PropertyProcessor"/>
+ </component>
+ <component name="implementation.Reference">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ReferenceProcessor"/>
+ </component>
+ <component name="implementation.Service">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ServiceProcessor"/>
+ </component>
+ <component name="implementation.HeuristicPojo">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.HeuristicPojoProcessor"/>
+ </component>
+ <component name="implementation.Monitor">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.MonitorProcessor"/>
+ </component>
+ <component name="implementation.Resource">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ResourceProcessor"/>
+ </component>
+ <component name="implementation.Conversation">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ConversationProcessor"/>
+ </component>
+ <component name="implementation.ContextProcessor">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.processor.ContextProcessor"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl
new file mode 100644
index 0000000000..40e5070e69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/interfaceJava.scdl
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Configuration for Java IDL support.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.InterfaceJava">
+
+ <component name="interfaceJava.interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl"/>
+ </component>
+ <component name="interfaceJava.loader">
+ <system:implementation.system class="org.apache.tuscany.core.idl.java.InterfaceJavaLoader"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl
new file mode 100644
index 0000000000..b53b01480f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/javaImplementation.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.JavaImplementation">
+
+ <!-- Java implementation type -->
+ <component name="java.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.java.JavaImplementationLoader"/>
+ </component>
+ <component name="java.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.java.JavaComponentTypeLoader"/>
+ </component>
+ <component name="java.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.java.JavaComponentBuilder"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/loader.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/loader.scdl
new file mode 100644
index 0000000000..cfc0382895
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/loader.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default loader configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.Loader">
+
+ <!-- Foundation element loader implementations -->
+ <component name="elementLoader.component">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ComponentLoader"/>
+ </component>
+ <component name="elementLoader.componentType">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ComponentTypeElementLoader"/>
+ </component>
+ <component name="elementLoader.include">
+ <system:implementation.system class="org.apache.tuscany.core.loader.IncludeLoader"/>
+ </component>
+ <component name="elementLoader.property">
+ <system:implementation.system class="org.apache.tuscany.core.loader.PropertyLoader"/>
+ </component>
+ <component name="elementLoader.reference">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ReferenceLoader"/>
+ </component>
+ <component name="elementLoader.service">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ServiceLoader"/>
+ </component>
+ <component name="elementLoader.wire">
+ <system:implementation.system class="org.apache.tuscany.core.loader.WireLoader"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl
new file mode 100644
index 0000000000..f4c2c456ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/main/resources/org/apache/tuscany/core/systemImplementation.scdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.core.SystemImplementation">
+
+ <!-- System implementation type -->
+ <component name="system.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.system.loader.SystemComponentTypeLoader"/>
+ </component>
+
+ <component name="system.compositeComponentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.system.loader.SystemCompositeComponentTypeLoader"/>
+ </component>
+ <component name="system.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.system.loader.SystemImplementationLoader"/>
+ </component>
+ <component name="system.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.system.builder.SystemComponentBuilder"/>
+ </component>
+ <component name="system.compositeBuilder">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.SystemCompositeBuilder"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.java
new file mode 100644
index 0000000000..8dc0023332
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvokerTestCase.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.binding.local;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+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;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.mock.wire.MockTargetInvoker;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractLocalTargetInvokerTestCase extends TestCase {
+
+ public void testInvokerWithInterceptor() throws Throwable {
+ AbstractLocalTargetInvoker invoker = new MockTargetInvoker();
+ Interceptor interceptor = EasyMock.createMock(Interceptor.class);
+ interceptor.invoke(EasyMock.isA(Message.class));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ Message msg = (Message) EasyMock.getCurrentArguments()[0];
+ if (msg.getTargetInvoker() == null) {
+ fail("Target invoker not set");
+ }
+ return null;
+ }
+ });
+ EasyMock.replay(interceptor);
+ OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
+ EasyMock.replay(chain);
+ invoker.invoke(chain, EasyMock.createNiceMock(TargetInvoker.class), new MessageImpl());
+ EasyMock.verify(chain);
+ EasyMock.verify(interceptor);
+ }
+
+ public void testShortCircuitInvoke() throws Throwable {
+ AbstractLocalTargetInvoker invoker = new MockTargetInvoker();
+ TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl());
+ EasyMock.replay(targetInvoker);
+ OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(null);
+ EasyMock.replay(chain);
+ invoker.invoke(chain, targetInvoker, new MessageImpl());
+ EasyMock.verify(chain);
+ EasyMock.verify(targetInvoker);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.java
new file mode 100644
index 0000000000..90f02e80a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingBuilderTestCase.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.binding.local;
+
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalBindingBuilderTestCase extends TestCase {
+
+ public void testBuild() throws Exception {
+ LocalBindingBuilder builder = new LocalBindingBuilder();
+ ServiceDefinition def = new ServiceDefinition();
+ def.setName("foo");
+ ServiceBinding binding = builder.build(null, def, null, null);
+ assertEquals(LocalServiceBinding.class, binding.getClass());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.java
new file mode 100644
index 0000000000..1633d5f8ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalBindingLoaderTestCase.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 javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalBindingLoaderTestCase extends TestCase {
+ private LocalBindingLoader loader;
+
+ public void testParse() throws Exception {
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn("foo");
+ EasyMock.replay(reader);
+ LocalBindingDefinition definition = loader.load(null, null, reader, null);
+ assertEquals(new URI("foo"), definition.getTargetUri());
+ EasyMock.verify(reader);
+ }
+
+ public void testNoUri() throws Exception {
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn(null);
+ EasyMock.replay(reader);
+ LocalBindingDefinition definition = loader.load(null, null, reader, null);
+ assertNull(definition.getTargetUri());
+ EasyMock.verify(reader);
+ }
+
+ public void testBadUri() throws Exception {
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getAttributeValue(null, "uri")).andReturn("foo foo");
+ EasyMock.replay(reader);
+ try {
+ loader.load(null, null, reader, null);
+ fail();
+ } catch (LoaderException e) {
+ // expected
+ }
+ EasyMock.verify(reader);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ loader = new LocalBindingLoader(null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java
new file mode 100644
index 0000000000..1976170f54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java
@@ -0,0 +1,86 @@
+package org.apache.tuscany.core.binding.local;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+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.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalCallbackTargetInvokerInvocationExceptionTestCase extends TestCase {
+ private InboundWire wire;
+ private Message message;
+ private OutboundInvocationChain chain;
+ private LocalCallbackTargetInvoker invoker;
+
+ /**
+ * Verfies an InvocationTargetException thrown when invoking the target is propagated to the client correctly and
+ * the originating error is unwrapped
+ */
+ public void testThrowableTargetInvocation() throws Exception {
+ Message response = invoker.invoke(message);
+ assertTrue(response.isFault());
+ Object body = response.getBody();
+ assertTrue(SomeException.class.equals(body.getClass()));
+ EasyMock.verify(wire);
+ EasyMock.verify(chain);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Object targetAddress = new Object();
+ message = new MessageImpl();
+ message.pushFromAddress(targetAddress);
+ message.setBody("foo");
+ Message response = new MessageImpl();
+ response.setBody("response");
+ Operation<Type> operation = new Operation<Type>("echo", null, null, null);
+ Interceptor head = new ErrorInterceptor();
+ chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(null);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(head);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getSourceCallbackInvocationChains(targetAddress)).andReturn(chains);
+ EasyMock.replay(wire);
+ invoker = new LocalCallbackTargetInvoker(operation, wire);
+ }
+
+ private class SomeException extends Exception {
+
+ }
+
+ private class ErrorInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ msg.setBodyWithFault(new SomeException());
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java
new file mode 100644
index 0000000000..123f32d66a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.binding.local;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+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.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalCallbackTargetInvokerTestCase extends TestCase {
+ private InboundWire wire;
+ private Message message;
+ private OutboundInvocationChain chain;
+ private Interceptor head;
+ private LocalCallbackTargetInvoker invoker;
+
+ /**
+ * Verfies the normal execution path through a callback
+ */
+ public void testNormalPathMessageInvocation() throws Exception {
+ Message response = invoker.invoke(message);
+ assertEquals("response", response.getBody());
+ EasyMock.verify(wire);
+ EasyMock.verify(chain);
+ EasyMock.verify(head);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Object targetAddress = new Object();
+ message = new MessageImpl();
+ message.pushFromAddress(targetAddress);
+ message.setBody("foo");
+ Message response = new MessageImpl();
+ response.setBody("response");
+ Operation<Type> operation = new Operation<Type>("echo", null, null, null);
+ head = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(head.invoke(EasyMock.isA(Message.class))).andReturn(response);
+ EasyMock.replay(head);
+ chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(null);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(head);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getSourceCallbackInvocationChains(targetAddress)).andReturn(chains);
+ EasyMock.replay(wire);
+
+ invoker = new LocalCallbackTargetInvoker(operation, wire);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java
new file mode 100644
index 0000000000..9c1bbc616e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.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.core.binding.local;
+
+import java.lang.reflect.Type;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+import java.util.Map;
+
+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.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalCallbackTargetInvokerThrowableTestCase extends TestCase {
+ private InboundWire wire;
+ private Message message;
+ private OutboundInvocationChain chain;
+ private Interceptor head;
+ private LocalCallbackTargetInvoker invoker;
+
+ /**
+ * Verfies an exception thrown in the target is propagated to the client correctly
+ */
+ public void testThrowableTargetInvocation() throws Exception {
+ Message response = invoker.invoke(message);
+ assertTrue(response.isFault());
+ Object body = response.getBody();
+ if (!(body instanceof UndeclaredThrowableException)) {
+ fail(); // EasyMock wraps the Throwable in an UndeclaredThrowableException
+ }
+ UndeclaredThrowableException e = (UndeclaredThrowableException) body;
+ assertTrue(InsidiousException.class.equals(e.getUndeclaredThrowable().getClass()));
+ EasyMock.verify(wire);
+ EasyMock.verify(chain);
+ EasyMock.verify(head);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ Object targetAddress = new Object();
+ message = new MessageImpl();
+ message.pushFromAddress(targetAddress);
+ message.setBody("foo");
+ Message response = new MessageImpl();
+ response.setBody("response");
+ Operation<Type> operation = new Operation<Type>("echo", null, null, null);
+ head = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(head.invoke(EasyMock.isA(Message.class))).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ throw new InsidiousException(); // andThrow() does not seem to work here
+ }
+ });
+ EasyMock.replay(head);
+ chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(null);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(head);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getSourceCallbackInvocationChains(targetAddress)).andReturn(chains);
+ EasyMock.replay(wire);
+ invoker = new LocalCallbackTargetInvoker(operation, wire);
+ }
+
+ private class InsidiousException extends Throwable {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java
new file mode 100644
index 0000000000..a313d341ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+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;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LocalTargetInvokerTestCase extends TestCase {
+ private ServiceContract<Object> serviceContract;
+ private Operation<Object> operation;
+
+ public void testInvoke() {
+ TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl());
+ EasyMock.replay(targetInvoker);
+ OutboundInvocationChain chain = EasyMock.createNiceMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(targetInvoker);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ OutboundWire wire = EasyMock.createNiceMock(OutboundWire.class);
+ wire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(chains);
+ EasyMock.expect(wire.getServiceContract()).andReturn(serviceContract);
+ EasyMock.replay(wire);
+ TargetInvoker invoker = new LocalTargetInvoker(operation, wire);
+ Message msg = invoker.invoke(new MessageImpl());
+ assertFalse(msg.isFault());
+ EasyMock.verify(targetInvoker);
+ }
+
+ public void testCallbackSetInvoke() {
+ ServiceContract<?> contract = new ServiceContract<Object>() {
+
+ };
+ contract.setCallbackClass(Object.class);
+ TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl());
+ EasyMock.replay(targetInvoker);
+ OutboundInvocationChain chain = EasyMock.createNiceMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(targetInvoker);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ SCAObject container = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(container.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(container);
+ OutboundWire wire = EasyMock.createNiceMock(OutboundWire.class);
+ EasyMock.expect(wire.getContainer()).andReturn(container).atLeastOnce();
+ wire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(chains);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract);
+ EasyMock.replay(wire);
+ TargetInvoker invoker = new LocalTargetInvoker(operation, wire);
+ Message msg = EasyMock.createMock(Message.class);
+ msg.pushFromAddress(EasyMock.eq("foo"));
+ EasyMock.replay(msg);
+ invoker.invoke(msg);
+ EasyMock.verify(msg);
+ EasyMock.verify(targetInvoker);
+ }
+
+ public void testFaultInvoke() {
+ TargetInvoker targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invoke(EasyMock.isA(Message.class))).andThrow(new TestException());
+ EasyMock.replay(targetInvoker);
+ OutboundInvocationChain chain = EasyMock.createNiceMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(targetInvoker);
+ EasyMock.replay(chain);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(operation, chain);
+ OutboundWire wire = EasyMock.createNiceMock(OutboundWire.class);
+ wire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(chains);
+ EasyMock.expect(wire.getServiceContract()).andReturn(serviceContract);
+ EasyMock.replay(wire);
+ TargetInvoker invoker = new LocalTargetInvoker(operation, wire);
+ Message msg = invoker.invoke(new MessageImpl());
+ assertTrue(msg.isFault());
+ assertTrue(msg.getBody() instanceof TestException);
+ EasyMock.verify(targetInvoker);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ serviceContract = new ServiceContract<Object>() {
+ };
+ operation = new Operation<Object>("foo", null, null, null);
+ }
+
+
+ private class TestException extends RuntimeException {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/BootstrapperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/BootstrapperTestCase.java
new file mode 100644
index 0000000000..728902e82b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/BootstrapperTestCase.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.bootstrap;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.deployer.DeployerImpl;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+
+/**
+ * Verifies the default bootstrapper can be instantiated
+ *
+ * @version $Rev$ $Date$
+ */
+public class BootstrapperTestCase extends TestCase {
+ private Bootstrapper bootstrapper;
+
+ public void testDeployerBootstrap() {
+ DeployerImpl deployer = (DeployerImpl) bootstrapper.createDeployer();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ bootstrapper = new DefaultBootstrapper(new NullMonitorFactory(), null, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java
new file mode 100644
index 0000000000..b828262d6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AbstractConnectorImplTestCase.java
@@ -0,0 +1,306 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+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.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.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+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.MessageImpl;
+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.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.binding.local.LocalReferenceBinding;
+import org.apache.tuscany.core.binding.local.LocalServiceBinding;
+import org.apache.tuscany.core.implementation.composite.ServiceImpl;
+import org.apache.tuscany.core.mock.binding.MockServiceBinding;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractConnectorImplTestCase extends TestCase {
+ protected static final String TARGET = "target";
+ protected static final QualifiedName TARGET_NAME = new QualifiedName(TARGET);
+ protected static final String TARGET_SERVICE = "FooService";
+ protected static final QualifiedName TARGET_SERVICE_NAME = new QualifiedName("target/FooService");
+ protected static final String RESPONSE = "response";
+
+ protected ConnectorImpl connector;
+ protected ServiceContract contract;
+ protected Operation<Type> operation;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WireService wireService = new JDKWireService(null, null);
+ connector = new ConnectorImpl(wireService, null, null, null);
+ contract = new JavaServiceContract(Foo.class);
+ operation = new Operation<Type>("bar", null, null, null);
+ }
+
+ protected AtomicComponent createAtomicTarget() throws Exception {
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new InvokerInterceptor());
+ InboundWire targetWire = new InboundWireImpl();
+ targetWire.setServiceContract(contract);
+ targetWire.addInvocationChain(operation, chain);
+
+ MockInvoker mockInvoker = new MockInvoker();
+
+ // create the target
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.getName()).andReturn(TARGET).anyTimes();
+ EasyMock.expect(target.isOptimizable()).andReturn(false).anyTimes();
+ EasyMock.expect(target.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ EasyMock.expect(target.isSystem()).andReturn(false).atLeastOnce();
+ target.getInboundWire(EasyMock.eq(TARGET_SERVICE));
+ EasyMock.expectLastCall().andReturn(targetWire).atLeastOnce();
+ target.createTargetInvoker(EasyMock.eq(TARGET_SERVICE), EasyMock.eq(operation), EasyMock.eq(targetWire));
+ EasyMock.expectLastCall().andReturn(mockInvoker);
+ EasyMock.replay(target);
+ targetWire.setContainer(target);
+ return target;
+ }
+
+ protected AtomicComponent createAtomicSource(CompositeComponent parent) throws Exception {
+ // create the outbound wire and chain from the source component
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setTargetName(TARGET_SERVICE_NAME);
+ outboundWire.setServiceContract(contract);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ Map<String, List<OutboundWire>> outboundWires = new HashMap<String, List<OutboundWire>>();
+ List<OutboundWire> list = new ArrayList<OutboundWire>();
+ list.add(outboundWire);
+ outboundWires.put(TARGET_SERVICE, list);
+
+ // create the source
+ AtomicComponent source = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(source.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.expect(source.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.expect(source.getParent()).andReturn(parent).atLeastOnce();
+ EasyMock.expect(source.getOutboundWires()).andReturn(outboundWires).atLeastOnce();
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ source.getInboundWires();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList());
+ EasyMock.replay(source);
+
+ outboundWire.setContainer(source);
+ return source;
+ }
+
+
+ protected Service createServiceNonLocalBinding() throws WireConnectException {
+ QName qName = new QName("foo", "bar");
+ ServiceBinding serviceBinding = new MockServiceBinding();
+ InboundInvocationChain targetInboundChain = new InboundInvocationChainImpl(operation);
+ targetInboundChain.addInterceptor(new SynchronousBridgingInterceptor());
+ InboundWire serviceInboundWire = new InboundWireImpl(qName);
+ serviceInboundWire.setServiceContract(contract);
+ serviceInboundWire.addInvocationChain(operation, targetInboundChain);
+ serviceInboundWire.setContainer(serviceBinding);
+
+ OutboundInvocationChain targetOutboundChain = new OutboundInvocationChainImpl(operation);
+ // place an invoker interceptor on the end
+ targetOutboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundWire targetOutboundWire = new OutboundWireImpl(qName);
+ targetOutboundWire.setServiceContract(contract);
+ targetOutboundWire.addInvocationChain(operation, targetOutboundChain);
+ targetOutboundWire.setContainer(serviceBinding);
+
+ serviceBinding.setInboundWire(serviceInboundWire);
+ serviceBinding.setOutboundWire(targetOutboundWire);
+ // manually connect the service chains
+ connector.connect(targetInboundChain, targetOutboundChain);
+ Service service = new ServiceImpl(TARGET, null, contract);
+ service.addServiceBinding(serviceBinding);
+ return service;
+ }
+
+ /**
+ * Creates a service configured with the local binding and places an invoker interceptor on the end of each outbound
+ * chain for invocation testing without needing to wire the service to a target
+ *
+ * @throws org.apache.tuscany.core.builder.WireConnectException
+ *
+ */
+ protected Service createLocalService(CompositeComponent parent) throws WireConnectException {
+ LocalServiceBinding serviceBinding = new LocalServiceBinding(TARGET, parent);
+ InboundInvocationChain targetInboundChain = new InboundInvocationChainImpl(operation);
+ targetInboundChain.addInterceptor(new SynchronousBridgingInterceptor());
+ InboundWire localServiceInboundWire = new InboundWireImpl();
+ localServiceInboundWire.setServiceContract(contract);
+ localServiceInboundWire.addInvocationChain(operation, targetInboundChain);
+ localServiceInboundWire.setContainer(serviceBinding);
+
+ OutboundInvocationChain targetOutboundChain = new OutboundInvocationChainImpl(operation);
+ // place an invoker interceptor on the end
+ targetOutboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundWire targetOutboundWire = new OutboundWireImpl();
+ targetOutboundWire.setServiceContract(contract);
+ targetOutboundWire.addInvocationChain(operation, targetOutboundChain);
+ targetOutboundWire.setContainer(serviceBinding);
+
+ serviceBinding.setInboundWire(localServiceInboundWire);
+ serviceBinding.setOutboundWire(targetOutboundWire);
+ // manually connect the service chains
+ connector.connect(targetInboundChain, targetOutboundChain);
+ Service service = new ServiceImpl(TARGET, null, contract);
+ service.addServiceBinding(serviceBinding);
+ return service;
+ }
+
+ protected ReferenceBinding createLocalReferenceBinding(QualifiedName target)
+ throws TargetInvokerCreationException {
+ ReferenceBinding referenceBinding = new LocalReferenceBinding("local", null);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ InboundWire referenceInboundWire = new InboundWireImpl();
+ referenceInboundWire.setServiceContract(contract);
+ referenceInboundWire.setContainer(referenceBinding);
+ referenceInboundWire.addInvocationChain(operation, inboundChain);
+
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ // Outbound chains always contains at least one interceptor
+ outboundChain.addInterceptor(new SynchronousBridgingInterceptor());
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(target);
+ outboundWire.addInvocationChain(operation, outboundChain);
+ outboundWire.setContainer(referenceBinding);
+
+ referenceBinding.setInboundWire(referenceInboundWire);
+ referenceBinding.setOutboundWire(outboundWire);
+
+ return referenceBinding;
+ }
+
+ protected InboundWire createLocalInboundWire(CompositeComponent parent) throws WireConnectException {
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new SynchronousBridgingInterceptor());
+ InboundWire wire = new InboundWireImpl();
+ wire.setServiceContract(contract);
+ LocalReferenceBinding referenceBinding = new LocalReferenceBinding("", parent);
+ wire.setContainer(referenceBinding);
+ wire.addInvocationChain(operation, chain);
+
+ OutboundInvocationChain targetOutboundChain = new OutboundInvocationChainImpl(operation);
+ // place an invoker interceptor on the end
+ targetOutboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundWire targetOutboundWire = new OutboundWireImpl();
+ targetOutboundWire.setServiceContract(contract);
+ targetOutboundWire.addInvocationChain(operation, targetOutboundChain);
+ referenceBinding.setInboundWire(wire);
+ referenceBinding.setOutboundWire(targetOutboundWire);
+ // manually connect the service chains
+ connector.connect(chain, targetOutboundChain);
+ return wire;
+ }
+
+ protected static class MockInvoker implements TargetInvoker {
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ return null;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ Message resp = new MessageImpl();
+ resp.setBody(RESPONSE);
+ return resp;
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ }
+
+ protected static class MockInterceptor implements Interceptor {
+ private Interceptor next;
+ private boolean invoked;
+
+ public Message invoke(Message msg) {
+ invoked = true;
+ return next.invoke(msg);
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public boolean isInvoked() {
+ return invoked;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+ protected interface Foo {
+ String echo();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AtomicConnectorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AtomicConnectorTestCase.java
new file mode 100644
index 0000000000..f89ba7ea8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/AtomicConnectorTestCase.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+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.core.implementation.composite.ServiceImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AtomicConnectorTestCase extends AbstractConnectorImplTestCase {
+
+ public void testConnectSynchronousServiceWiresToAtomicTarget() throws Exception {
+ AtomicComponent target = createAtomicTarget();
+
+ // create the parent composite
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.getChild("target")).andReturn(target);
+ EasyMock.replay(parent);
+
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.addInvocationChain(operation, inboundChain);
+ inboundWire.setServiceContract(contract);
+
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setTargetName(TARGET_SERVICE_NAME);
+ outboundWire.addInvocationChain(operation, outboundChain);
+ outboundWire.setServiceContract(contract);
+
+ // create the binding
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getName()).andReturn("source");
+ binding.setService(EasyMock.isA(Service.class));
+ EasyMock.expect(binding.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.expect(binding.getInboundWire()).andReturn(inboundWire).atLeastOnce();
+ EasyMock.expect(binding.getOutboundWire()).andReturn(outboundWire);
+ EasyMock.expect(binding.getScope()).andReturn(Scope.SYSTEM);
+ EasyMock.replay(binding);
+
+ outboundWire.setContainer(binding);
+ inboundWire.setContainer(binding);
+
+ Service service = new ServiceImpl("foo", parent, null);
+ service.addServiceBinding(binding);
+
+ connector.connect(service);
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(inboundChain.getTargetInvoker());
+ Message resp = inboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ EasyMock.verify(binding);
+ }
+
+ public void testConnectNonBlockingServiceWiresToAtomicTarget() throws Exception {
+ // JFM FIXME
+ }
+
+ public void testConnectCallbackServiceWiresToAtomicTarget() throws Exception {
+ // JFM FIXME
+ }
+
+ /**
+ * Verifies connecting a wire from an atomic component to a target atomic component with one synchronous operation
+ */
+ public void testConnectAtomicComponentToAtomicComponentSyncWire() throws Exception {
+
+ AtomicComponent target = createAtomicTarget();
+ // create the parent composite
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.getChild("target")).andReturn(target);
+ EasyMock.replay(parent);
+ AtomicComponent source = createAtomicSource(parent);
+ connector.connect(source);
+
+ MessageImpl msg = new MessageImpl();
+ Map<String, List<OutboundWire>> wires = source.getOutboundWires();
+ OutboundWire wire = wires.get(TARGET_SERVICE).get(0);
+ OutboundInvocationChain chain = wire.getInvocationChains().get(operation);
+ msg.setTargetInvoker(chain.getTargetInvoker());
+ Message resp = chain.getHeadInterceptor().invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java
new file mode 100644
index 0000000000..16f2846921
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryNoBindingsTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.builder;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+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.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.binding.local.LocalBindingBuilder;
+import org.apache.tuscany.core.binding.local.LocalBindingDefinition;
+import org.apache.tuscany.core.binding.local.LocalReferenceBinding;
+import org.apache.tuscany.core.binding.local.LocalServiceBinding;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BuilderRegistryNoBindingsTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+ private CompositeComponent parent;
+ private BuilderRegistry registry;
+
+ public void testNoServiceBindings() throws Exception {
+ ServiceBinding binding = EasyMock.createNiceMock(ServiceBinding.class);
+ EasyMock.replay(binding);
+ ServiceDefinition definition = new ServiceDefinition("foo", null, false);
+ definition.setTarget(new URI("foo"));
+ Service service = registry.build(parent, definition, deploymentContext);
+ assertEquals(1, service.getServiceBindings().size());
+ assertTrue(service.getServiceBindings().get(0) instanceof LocalServiceBinding);
+ }
+
+ public void testReferenceBindingBuilderDispatch() throws Exception {
+ ReferenceBinding binding = EasyMock.createNiceMock(ReferenceBinding.class);
+ EasyMock.replay(binding);
+ AbstractReferenceDefinition definition = new ComponentTypeReferenceDefinition("foo", null, Multiplicity.ONE_ONE);
+ Reference reference = registry.build(parent, definition, deploymentContext);
+ assertEquals(1, reference.getReferenceBindings().size());
+ assertTrue(reference.getReferenceBindings().get(0) instanceof LocalReferenceBinding);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ EasyMock.replay(parent);
+ registry = new BuilderRegistryImpl(null, null);
+ registry.register(LocalBindingDefinition.class, new LocalBindingBuilder());
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
new file mode 100644
index 0000000000..572babf817
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.builder;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.builder.BindingBuilder;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.ComponentBuilder;
+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.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.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.Implementation;
+import static org.apache.tuscany.spi.model.Multiplicity.ONE_ONE;
+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 junit.framework.TestCase;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BuilderRegistryTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+ //private BuilderRegistryImpl registry;
+ private CompositeComponent parent;
+
+ public void testRegistration() throws Exception {
+ MockBuilder builder = new MockBuilder();
+ BuilderRegistry registry = new BuilderRegistryImpl(null, null);
+ registry.register(CompositeImplementation.class, builder);
+ CompositeImplementation implementation = new CompositeImplementation();
+ ComponentDefinition<CompositeImplementation> componentDefinition =
+ new ComponentDefinition<CompositeImplementation>(implementation);
+ componentDefinition.getImplementation().setComponentType(new CompositeComponentType());
+ registry.build(parent, componentDefinition, deploymentContext);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testServiceBindingBuilderDispatch() throws Exception {
+ WireService wireService = EasyMock.createMock(WireService.class);
+ wireService.createWires(EasyMock.isA(ServiceBinding.class),
+ (ServiceContract) EasyMock.isNull(), EasyMock.isA(String.class)
+ );
+ EasyMock.expectLastCall().times(2);
+ EasyMock.replay(wireService);
+ BuilderRegistry registry = new BuilderRegistryImpl(null, wireService);
+ ServiceBinding binding = EasyMock.createNiceMock(ServiceBinding.class);
+ EasyMock.replay(binding);
+ BindingBuilder<MockBindingDefinition> builder = EasyMock.createMock(BindingBuilder.class);
+ EasyMock.expect(builder.build(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(ServiceDefinition.class),
+ EasyMock.isA(MockBindingDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andReturn(binding).times(2);
+ EasyMock.replay(builder);
+ registry.register(MockBindingDefinition.class, builder);
+ ServiceDefinition definition = new ServiceDefinition("foo", null, false);
+ definition.addBinding(new MockBindingDefinition());
+ definition.addBinding(new MockBindingDefinition());
+ definition.setTarget(new URI("foo"));
+ Service service = registry.build(parent, definition, deploymentContext);
+ assertEquals(2, service.getServiceBindings().size());
+ EasyMock.verify(wireService);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testReferenceBindingBuilderDispatch() throws Exception {
+ WireService wireService = EasyMock.createMock(WireService.class);
+ wireService.createWires(EasyMock.isA(ReferenceBinding.class),
+ (ServiceContract) EasyMock.isNull(), (QualifiedName) EasyMock.isNull()
+ );
+ EasyMock.expectLastCall().times(2);
+ EasyMock.replay(wireService);
+ BuilderRegistry registry = new BuilderRegistryImpl(null, wireService);
+ ReferenceBinding binding = EasyMock.createNiceMock(ReferenceBinding.class);
+ EasyMock.replay(binding);
+ BindingBuilder<MockBindingDefinition> builder = EasyMock.createMock(BindingBuilder.class);
+ EasyMock.expect(builder.build(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(AbstractReferenceDefinition.class),
+ EasyMock.isA(MockBindingDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andReturn(binding).times(2);
+ EasyMock.replay(builder);
+ registry.register(MockBindingDefinition.class, builder);
+ AbstractReferenceDefinition definition = new ComponentTypeReferenceDefinition("foo", null, ONE_ONE);
+ definition.addBinding(new MockBindingDefinition());
+ definition.addBinding(new MockBindingDefinition());
+ Reference reference = registry.build(parent, definition, deploymentContext);
+ assertEquals(2, reference.getReferenceBindings().size());
+ EasyMock.verify(wireService);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testComponentImplementationDispatch() throws Exception {
+ ScopeRegistry scopeRegistry = EasyMock.createMock(ScopeRegistry.class);
+ ScopeContainer scopeContainer = EasyMock.createNiceMock(ScopeContainer.class);
+ EasyMock.expect(scopeRegistry.getScopeContainer(EasyMock.isA(Scope.class))).andReturn(scopeContainer);
+ EasyMock.replay(scopeRegistry);
+ WireService wireService = EasyMock.createMock(WireService.class);
+ wireService.createWires(EasyMock.isA(AtomicComponent.class),
+ EasyMock.isA(ComponentDefinition.class));
+ EasyMock.replay(wireService);
+ BuilderRegistry registry = new BuilderRegistryImpl(scopeRegistry, wireService);
+
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ ComponentBuilder<FooImplementation> builder = EasyMock.createMock(ComponentBuilder.class);
+ EasyMock.expect(builder.build(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(ComponentDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andReturn(component);
+ EasyMock.replay(builder);
+ registry.register(FooImplementation.class, builder);
+
+ FooImplementation impl = new FooImplementation();
+ impl.setComponentType(new ComponentType());
+ ComponentDefinition<FooImplementation> definition = new ComponentDefinition<FooImplementation>("foo", impl);
+ Component ret = registry.build(parent, definition, deploymentContext);
+ assertNotNull(ret);
+ EasyMock.verify(wireService);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testNoConversationalContract() throws Exception {
+ ScopeRegistry scopeRegistry = EasyMock.createMock(ScopeRegistry.class);
+ ScopeContainer scopeContainer = EasyMock.createNiceMock(ScopeContainer.class);
+ EasyMock.expect(scopeRegistry.getScopeContainer(EasyMock.isA(Scope.class))).andReturn(scopeContainer);
+ EasyMock.replay(scopeRegistry);
+ WireService wireService = EasyMock.createMock(WireService.class);
+ wireService.createWires(EasyMock.isA(AtomicComponent.class),
+ EasyMock.isA(ComponentDefinition.class));
+ EasyMock.replay(wireService);
+ BuilderRegistry registry = new BuilderRegistryImpl(scopeRegistry, wireService);
+
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ ComponentBuilder<FooImplementation> builder = EasyMock.createMock(ComponentBuilder.class);
+ EasyMock.expect(builder.build(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(ComponentDefinition.class),
+ EasyMock.isA(DeploymentContext.class))).andReturn(component);
+ EasyMock.replay(builder);
+ registry.register(FooImplementation.class, builder);
+
+ FooImplementation impl = new FooImplementation();
+ ComponentType componentType = new ComponentType();
+ componentType.setImplementationScope(Scope.CONVERSATION);
+ impl.setComponentType(componentType);
+ ComponentDefinition<FooImplementation> definition = new ComponentDefinition<FooImplementation>("foo", impl);
+ try {
+ registry.build(parent, definition, deploymentContext);
+ fail("Should throw NoConversationalContractException");
+ } catch (NoConversationalContractException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ EasyMock.replay(parent);
+ }
+
+ private class MockBuilder implements ComponentBuilder<CompositeImplementation> {
+ public Component build(CompositeComponent parent,
+ ComponentDefinition componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+ return null;
+ }
+ }
+
+ private class MockBindingDefinition extends BindingDefinition {
+ public Object clone() {
+ MockBindingDefinition mockClone = new MockBindingDefinition();
+ mockClone.setTargetUri(URI.create(this.getTargetUri().toString()));
+ return mockClone;
+ }
+ }
+
+ private class FooImplementation extends Implementation<ComponentType> {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
new file mode 100644
index 0000000000..fc5daa6b12
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Type;
+import java.util.Collections;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+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.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;
+
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectorImplTestCase extends AbstractConnectorImplTestCase {
+
+ public void testConnectTargetNotFound() throws Exception {
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.getName()).andReturn("parent");
+ parent.getChild(EasyMock.isA(String.class));
+ EasyMock.expectLastCall().andReturn(null);
+ EasyMock.replay(parent);
+ try {
+ AtomicComponent source = createAtomicSource(parent);
+ connector.connect(source);
+ fail();
+ } catch (TargetServiceNotFoundException e) {
+ // expected
+ }
+ }
+
+ public void testOutboundToInboundOptimization() throws Exception {
+ AtomicComponent container = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.expect(container.isSystem()).andReturn(true);
+ EasyMock.replay(container);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.setTargetWire(EasyMock.eq(inboundWire));
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.replay(outboundWire);
+
+ connector.connect(outboundWire, inboundWire, true);
+ EasyMock.verify(outboundWire);
+ }
+
+ /**
+ * Verifies that stateless targets with a destructor are not optimized as the destructor callback event must be
+ * issued by the TargetInvoker after it dispatches to the target
+ */
+ public void testOutboundToInboundNoOptimizationBecauseStatelessDestructor() throws Exception {
+ AtomicComponent container = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.expect(container.isSystem()).andReturn(false);
+ EasyMock.expect(container.getScope()).andReturn(Scope.STATELESS);
+ EasyMock.expect(container.isDestroyable()).andReturn(true);
+ EasyMock.replay(container);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ outboundWire.getTargetCallbackInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.replay(outboundWire);
+
+ connector.connect(outboundWire, inboundWire, true);
+ EasyMock.verify(outboundWire);
+ }
+
+ public void testOutboundToInboundNoOptimizationAtomic() throws Exception {
+ AtomicComponent container = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.expect(container.isSystem()).andReturn(false);
+ EasyMock.expect(container.getScope()).andReturn(Scope.STATELESS);
+ EasyMock.expect(container.isOptimizable()).andReturn(false);
+ EasyMock.replay(container);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).atLeastOnce();
+ outboundWire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ outboundWire.getTargetCallbackInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ EasyMock.replay(outboundWire);
+
+ connector.connect(outboundWire, inboundWire, true);
+ EasyMock.verify(outboundWire);
+ }
+
+ public void testOutboundToInboundNoOptimizationNonAtomicTarget() throws Exception {
+ ReferenceBinding container = EasyMock.createNiceMock(ReferenceBinding.class);
+ EasyMock.expect(container.isSystem()).andReturn(false);
+ EasyMock.replay(container);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ outboundWire.getTargetCallbackInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.replay(outboundWire);
+
+ connector.connect(outboundWire, inboundWire, true);
+ EasyMock.verify(outboundWire);
+ }
+
+ public void testOutboundToInboundChainConnect() throws Exception {
+ TargetInvoker invoker = new MockInvoker();
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ Interceptor interceptor = outboundChain.getHeadInterceptor();
+ assertTrue(interceptor instanceof SynchronousBridgingInterceptor);
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testOutboundToInboundChainConnectNoInboundInterceptor() {
+ TargetInvoker invoker = new MockInvoker();
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ try {
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ fail();
+ } catch (WireConnectException e) {
+ // expected
+ }
+ }
+
+ public void testInboundToOutboundChainConnect() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ connector.connect(inboundChain, outboundChain);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ assertTrue(interceptor instanceof SynchronousBridgingInterceptor);
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testInboundToOutboundChainConnectNoOutboundInterceptors() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ try {
+ connector.connect(inboundChain, outboundChain);
+ fail();
+ } catch (WireConnectException e) {
+ // expected
+ }
+ }
+
+ public void testInboundOutboundSystemWireOptimization() throws Exception {
+ SCAObject container = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(container.isSystem()).andReturn(true);
+ EasyMock.replay(container);
+ InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
+ inboundWire.setTargetWire(EasyMock.isA(OutboundWire.class));
+ EasyMock.expect(inboundWire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.replay(inboundWire);
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(container);
+ connector.connect(inboundWire, outboundWire, true);
+ EasyMock.verify(inboundWire);
+ EasyMock.verify(container);
+ }
+
+ public void testOutboundInboundSystemWireOptimization() throws Exception {
+ SCAObject container = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(container.isSystem()).andReturn(true);
+ EasyMock.replay(container);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.setTargetWire(EasyMock.isA(InboundWire.class));
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.replay(outboundWire);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ connector.connect(outboundWire, inboundWire, true);
+ EasyMock.verify(outboundWire);
+ EasyMock.verify(container);
+ }
+
+ public void testIncompatibleInboundOutboundWiresConnect() throws Exception {
+ Operation<Type> operation = new Operation<Type>("bar", null, null, null);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.addInvocationChain(operation, new InboundInvocationChainImpl(operation));
+ OutboundWire outboundWire = new OutboundWireImpl();
+ try {
+ connector.connect(inboundWire, outboundWire, false);
+ fail();
+ } catch (IncompatibleInterfacesException e) {
+ // expected
+ }
+
+ }
+
+ public void testIncompatibleOutboundInboundWiresConnect() throws Exception {
+ SCAObject container = EasyMock.createNiceMock(SCAObject.class);
+ EasyMock.expect(container.isSystem()).andReturn(false);
+ EasyMock.replay(container);
+ Operation<Type> operation = new Operation<Type>("bar", null, null, null);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(container);
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(container);
+ outboundWire.addInvocationChain(operation, new OutboundInvocationChainImpl(operation));
+ try {
+ connector.connect(outboundWire, inboundWire, false);
+ fail();
+ } catch (IncompatibleInterfacesException e) {
+ // expected
+ }
+
+ }
+
+ public void testIsOptimizable() {
+ assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.STATELESS));
+ assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.STATELESS, Scope.CONVERSATION));
+ assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.REQUEST));
+ assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.SESSION));
+ assertTrue(connector.isOptimizable(Scope.STATELESS, Scope.SYSTEM));
+
+ assertTrue(connector.isOptimizable(Scope.COMPOSITE, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.CONVERSATION));
+ assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.REQUEST));
+ assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.COMPOSITE, Scope.STATELESS));
+ assertTrue(connector.isOptimizable(Scope.COMPOSITE, Scope.SYSTEM));
+
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.CONVERSATION));
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.REQUEST));
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.STATELESS));
+ assertFalse(connector.isOptimizable(Scope.CONVERSATION, Scope.SYSTEM));
+
+ assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.REQUEST, Scope.CONVERSATION));
+ assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.REQUEST));
+ assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.REQUEST, Scope.STATELESS));
+ assertTrue(connector.isOptimizable(Scope.REQUEST, Scope.SYSTEM));
+
+ assertTrue(connector.isOptimizable(Scope.SESSION, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.SESSION, Scope.CONVERSATION));
+ assertFalse(connector.isOptimizable(Scope.SESSION, Scope.REQUEST));
+ assertTrue(connector.isOptimizable(Scope.SESSION, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.SESSION, Scope.STATELESS));
+ assertTrue(connector.isOptimizable(Scope.SESSION, Scope.SYSTEM));
+
+ assertTrue(connector.isOptimizable(Scope.SYSTEM, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.CONVERSATION));
+ assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.REQUEST));
+ assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.SYSTEM, Scope.STATELESS));
+ assertTrue(connector.isOptimizable(Scope.SYSTEM, Scope.SYSTEM));
+
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.COMPOSITE));
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.CONVERSATION));
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.REQUEST));
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.SESSION));
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.STATELESS));
+ assertFalse(connector.isOptimizable(Scope.UNDEFINED, Scope.SYSTEM));
+
+ }
+
+ public void testInvalidConnectObject() throws Exception {
+ try {
+ connector.connect(EasyMock.createNiceMock(SCAObject.class));
+ fail();
+ } catch (AssertionError e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java
new file mode 100644
index 0000000000..857b17eff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.builder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+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.WirePostProcessorRegistry;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectorPostProcessTestCase extends TestCase {
+
+ public void testInboundToOutboundPostProcessCalled() throws Exception {
+ OutboundWire owire = createNiceMock(OutboundWire.class);
+ replay(owire);
+ InboundWire iwire = createNiceMock(InboundWire.class);
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ expect(iwire.getInvocationChains()).andReturn(chains);
+ replay(iwire);
+ WirePostProcessorRegistry registry = createMock(WirePostProcessorRegistry.class);
+ registry.process(EasyMock.eq(iwire), EasyMock.eq(owire));
+ replay(registry);
+ WireService wireService = createMock(WireService.class);
+ wireService.checkCompatibility((ServiceContract<?>) EasyMock.anyObject(),
+ (ServiceContract<?>) EasyMock.anyObject(), EasyMock.eq(false));
+ expectLastCall().anyTimes();
+ replay(wireService);
+ ConnectorImpl connector = new ConnectorImpl(wireService, registry, null, null);
+ connector.connect(iwire, owire, false);
+ verify(registry);
+ }
+
+ public void testOutboundToInboundPostProcessCalled() throws Exception {
+ AtomicComponent source = createNiceMock(AtomicComponent.class);
+ expect(source.getName()).andReturn("Component");
+ replay(source);
+
+ AtomicComponent target = createNiceMock(AtomicComponent.class);
+ expect(target.getName()).andReturn("Component");
+ replay(target);
+
+ OutboundWire owire = createNiceMock(OutboundWire.class);
+ EasyMock.expect(owire.getContainer()).andReturn(source);
+
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ expect(owire.getInvocationChains()).andReturn(chains);
+ Map<Operation<?>, InboundInvocationChain> ichains = new HashMap<Operation<?>, InboundInvocationChain>();
+ expect(owire.getTargetCallbackInvocationChains()).andReturn(ichains);
+ replay(owire);
+ InboundWire iwire = createNiceMock(InboundWire.class);
+ expect(iwire.getSourceCallbackInvocationChains("Component")).andReturn(chains);
+ EasyMock.expect(iwire.getContainer()).andReturn(target);
+ replay(iwire);
+ WirePostProcessorRegistry registry = createMock(WirePostProcessorRegistry.class);
+ registry.process(EasyMock.eq(owire), EasyMock.eq(iwire));
+ replay(registry);
+ WireService wireService = createMock(WireService.class);
+ wireService.checkCompatibility((ServiceContract<?>) EasyMock.anyObject(),
+ (ServiceContract<?>) EasyMock.anyObject(), EasyMock.eq(false));
+ expectLastCall().anyTimes();
+ replay(wireService);
+ ConnectorImpl connector = new ConnectorImpl(wireService, registry, null, null);
+
+ connector.connect(owire, iwire, false);
+ verify(registry);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.java
new file mode 100644
index 0000000000..40ddc837c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IllegalCallbackExceptionTestCase.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.core.builder;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IllegalCallbackExceptionTestCase extends TestCase {
+
+ public void testInstantiation() throws Exception {
+ IllegalCallbackException e = new IllegalCallbackException("message",
+ "identifier",
+ "source name",
+ "ref name",
+ "target name",
+ "service name");
+ assertEquals("message", e.getMessage());
+ assertEquals("identifier", e.getIdentifier());
+ assertEquals("source name", e.getSourceName());
+ assertEquals("ref name", e.getReferenceName());
+ assertEquals("target name", e.getTargetName());
+ assertEquals("service name", e.getTargetServiceName());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java
new file mode 100644
index 0000000000..4676dbb7cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.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.core.builder;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+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;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and {@link
+ * org.apache.tuscany.spi.wire.InboundInvocationChain}s
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class InboundtoOutboundConnectTestCase extends TestCase {
+ private Operation operation;
+ private ConnectorImpl connector;
+
+ public void testNoInterceptors() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ TargetInvoker invoker = EasyMock.createNiceMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl());
+ EasyMock.replay(invoker);
+ connector.connect(inboundChain, outboundChain);
+ inboundChain.setTargetInvoker(invoker);
+ inboundChain.prepare();
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ inboundChain.getHeadInterceptor().invoke(msg);
+ EasyMock.verify(invoker);
+ }
+
+
+ /**
+ * Verifies an invocation with a single source interceptor
+ */
+ public void testSourceInterceptor() throws Exception {
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(interceptor);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = EasyMock.createNiceMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(invoker);
+ assertEquals(0, interceptor.getCount());
+ connector.connect(inboundChain, outboundChain);
+ inboundChain.setTargetInvoker(invoker);
+ inboundChain.prepare();
+ msg.setTargetInvoker(inboundChain.getTargetInvoker());
+ assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ EasyMock.verify(invoker);
+ }
+
+ /**
+ * Verifies an invocation with a single target interceptor
+ */
+ public void testTargetInterceptor() throws Exception {
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(interceptor);
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = EasyMock.createNiceMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(invoker);
+ assertEquals(0, interceptor.getCount());
+ connector.connect(inboundChain, outboundChain);
+ inboundChain.setTargetInvoker(invoker);
+ inboundChain.prepare();
+ msg.setTargetInvoker(inboundChain.getTargetInvoker());
+ assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ EasyMock.verify(invoker);
+ }
+
+ /**
+ * Verifies an invocation with a source and target interceptor
+ */
+ public void testSourceTargetInterceptor() throws Exception {
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(sourceInterceptor);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(targetInterceptor);
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = EasyMock.createNiceMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(invoker);
+ assertEquals(0, sourceInterceptor.getCount());
+ assertEquals(0, targetInterceptor.getCount());
+ connector.connect(inboundChain, outboundChain);
+ inboundChain.setTargetInvoker(invoker);
+ inboundChain.prepare();
+ msg.setTargetInvoker(inboundChain.getTargetInvoker());
+ assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, sourceInterceptor.getCount());
+ assertEquals(1, targetInterceptor.getCount());
+ EasyMock.verify(invoker);
+ }
+
+ public void testOptimizeSet() throws Exception {
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = EasyMock.createNiceMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(invoker);
+ connector.connect(inboundChain, outboundChain);
+ inboundChain.setTargetInvoker(invoker);
+ inboundChain.prepare();
+ msg.setTargetInvoker(inboundChain.getTargetInvoker());
+ assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
+ EasyMock.verify(invoker);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ connector = new ConnectorImpl();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(SimpleTarget.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+ operation = contract.getOperations().get("echo");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.java
new file mode 100644
index 0000000000..7fa6633258
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/IncompatibleInterfacesExceptionTestCase.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 junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleInterfacesExceptionTestCase extends TestCase {
+
+ public void testInstantiation() throws Exception {
+ IncompatibleInterfacesException e = new IncompatibleInterfacesException("message",
+ "source name",
+ "ref name",
+ "target name",
+ "service name");
+ assertEquals("message", e.getMessage());
+ assertEquals("source name", e.getSourceName());
+ assertEquals("ref name", e.getReferenceName());
+ assertEquals("target name", e.getTargetName());
+ assertEquals("service name", e.getTargetServiceName());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.java
new file mode 100644
index 0000000000..c34be84745
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InvalidTargetTypeExceptionTestCase.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 junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidTargetTypeExceptionTestCase extends TestCase {
+
+ public void testInstantiation() throws Exception {
+ InvalidTargetTypeException e = new InvalidTargetTypeException("message",
+ "source name",
+ "ref name",
+ "target name",
+ "service name");
+ assertEquals("message", e.getMessage());
+ assertEquals("source name", e.getSourceName());
+ assertEquals("ref name", e.getReferenceName());
+ assertEquals("target name", e.getTargetName());
+ assertEquals("service name", e.getTargetServiceName());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java
new file mode 100644
index 0000000000..0806708056
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/LocalReferenceWiringTestCase.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Collections;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.Service;
+import org.apache.tuscany.spi.model.Scope;
+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.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl;
+import org.apache.tuscany.core.implementation.composite.ReferenceImpl;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * Verifies various wiring "scenarios" or paths through the connector
+ *
+ * @version $Rev$ $Date$
+ */
+public class LocalReferenceWiringTestCase extends AbstractConnectorImplTestCase {
+ protected ReferenceBinding referenceBinding;
+ private Reference reference;
+
+ /**
+ * Verifies the case where the outbound reference wire is connected to a target atomic component that is a sibling
+ * to the reference's parent composite. This wiring scenario occurs when a reference is configured with the local
+ * binding.
+ */
+ public void testConnectLocalReferenceBindingToAtomicComponentService() throws Exception {
+ final AtomicComponent atomicComponent = createAtomicTarget();
+ CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+ topComposite.getChild(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return atomicComponent;
+ }
+ });
+ EasyMock.replay(topComposite);
+ CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+ reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+ parent.register(reference);
+ // connect to the target
+ connector.connect(parent);
+ // connect the internal reference chains
+ connector.connect(reference);
+ InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
+ Interceptor interceptor = chain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ /**
+ * Verifies the case where the outbound reference wire is connected to a target composite service that is a sibling
+ * to the reference's parent composite. This wiring scenario occurs when a reference is configured with the local
+ * binding.
+ */
+ public void testConnectLocalReferenceBindingToCompositeService() throws Exception {
+ final CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+
+ topComposite.getInboundWire(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return createLocalInboundWire(topComposite);
+ }
+ });
+ final Service service = createLocalService(topComposite);
+ topComposite.getChild(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return service;
+ }
+ });
+ EasyMock.replay(topComposite);
+
+ CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+ reference = createLocalReference(parent, TARGET_NAME);
+ parent.register(reference);
+ connector.connect(parent);
+ connector.connect(reference);
+ InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
+ Interceptor interceptor = chain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ /**
+ * Verfies an exception if the target composite service (a sibling to the reference's parent) does not have a local
+ * binding
+ */
+ public void testConnectLocalReferenceBindingToCompositeServiceNoMatchingBinding() throws Exception {
+ final Service service = createServiceNonLocalBinding();
+ CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(topComposite.getName()).andReturn("foo");
+ topComposite.getChild(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return service;
+ }
+ });
+ EasyMock.replay(topComposite);
+
+ CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+ reference = createLocalReference(parent, TARGET_NAME);
+ parent.register(reference);
+ try {
+ connector.connect(parent);
+ fail();
+ } catch (NoCompatibleBindingsException e) {
+ // expected
+ }
+ }
+
+ /**
+ * Verifies a connection to a service offered by a sibling composite of the reference's parent
+ *
+ * @throws Exception
+ */
+ public void testConnectLocalReferenceBindingToSiblingCompositeService() throws Exception {
+ final CompositeComponent sibling = EasyMock.createMock(CompositeComponent.class);
+ final InboundWire localServiceInboundWire = createLocalInboundWire(sibling);
+ EasyMock.expect(sibling.getName()).andReturn("sibling").atLeastOnce();
+ sibling.getInboundWires();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.expect(sibling.isSystem()).andReturn(false).atLeastOnce();
+ sibling.getInboundWire(TARGET_SERVICE);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return localServiceInboundWire;
+ }
+ });
+ EasyMock.expect(sibling.getScope()).andReturn(Scope.SYSTEM).anyTimes();
+ EasyMock.replay(sibling);
+
+ CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(topComposite.getName()).andReturn("foo").atLeastOnce();
+ topComposite.getChild(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return sibling;
+ }
+ });
+ EasyMock.replay(topComposite);
+
+ CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+ reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+ parent.register(reference);
+ parent.register(sibling);
+ connector.connect(parent);
+ connector.connect(reference);
+ InboundInvocationChain chain = referenceBinding.getInboundWire().getInvocationChains().get(operation);
+ Interceptor interceptor = chain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testConnectLocalReferenceBindingToSiblingCompositeServiceNoMatchingBinding() throws Exception {
+ try {
+ final CompositeComponent sibling = EasyMock.createMock(CompositeComponent.class);
+ sibling.getInboundWire(TARGET_SERVICE);
+ EasyMock.expectLastCall().andReturn(null);
+ EasyMock.expect(sibling.getName()).andReturn("sibling").atLeastOnce();
+ EasyMock.expect(sibling.getScope()).andReturn(Scope.SYSTEM).atLeastOnce();
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return null;
+ }
+ });
+ EasyMock.replay(sibling);
+
+ CompositeComponent topComposite = EasyMock.createMock(CompositeComponent.class);
+ topComposite.getChild(TARGET);
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ return sibling;
+ }
+ });
+ EasyMock.expect(topComposite.getName()).andReturn("top").atLeastOnce();
+ EasyMock.replay(topComposite);
+
+ CompositeComponent parent = new CompositeComponentImpl("parent", topComposite, connector, null);
+
+ reference = createLocalReference(parent, TARGET_SERVICE_NAME);
+ parent.register(reference);
+ connector.connect(parent);
+ fail();
+ } catch (TargetServiceNotFoundException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+
+ private Reference createLocalReference(CompositeComponent parent, QualifiedName target) throws Exception {
+ referenceBinding = createLocalReferenceBinding(target);
+ Reference reference = new ReferenceImpl("foo", parent, contract);
+ reference.addReferenceBinding(referenceBinding);
+ return reference;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardNonBlockingCallbackConnectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardNonBlockingCallbackConnectionTestCase.java
new file mode 100644
index 0000000000..896a98b773
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardNonBlockingCallbackConnectionTestCase.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.ServiceContract;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+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.Interceptor;
+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;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies connections with non-blocking forward and callback invocations
+ *
+ * @version $Rev$ $Date$
+ */
+public class NonBlockingForwardNonBlockingCallbackConnectionTestCase extends TestCase {
+ private Operation<Type> operation;
+ private Operation<Type> callbackOperation;
+ private ServiceContract<Type> contract;
+ private ConnectorImpl connector;
+
+ public void testNonBlockingForwardAndNonBlockingCallbackAtomicToAtomic() throws Exception {
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(target.getName()).andReturn("target").anyTimes();
+ EasyMock.expect(target.createTargetInvoker(EasyMock.eq("service"),
+ EasyMock.isA(Operation.class),
+ EasyMock.isA(InboundWire.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(target);
+
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(target);
+ inboundWire.setServiceContract(contract);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new NonBlockingForwardNonBlockingCallbackConnectionTestCase.MockInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ AtomicComponent source = createSource();
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(source);
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName("target/service"));
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ InboundInvocationChain callbackInboundChain = new InboundInvocationChainImpl(callbackOperation);
+ callbackInboundChain
+ .addInterceptor(new NonBlockingForwardNonBlockingCallbackConnectionTestCase.MockInterceptor());
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(callbackOperation, callbackInboundChain);
+ outboundWire.addTargetCallbackInvocationChains(chains);
+
+ connector.connect(outboundWire, inboundWire, true);
+
+ // test the forward request
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ Message ret = outboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals(null, ret.getBody());
+
+ // test the callback
+ msg = new MessageImpl();
+ msg.setBody("callback");
+ Map<Operation<?>, OutboundInvocationChain> callbackChains =
+ inboundWire.getSourceCallbackInvocationChains("source");
+ OutboundInvocationChain callbackInvocationChain = callbackChains.get(callbackOperation);
+ ret = callbackInvocationChain.getHeadInterceptor().invoke(msg);
+ assertEquals(null, ret.getBody());
+
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WorkContext context = new WorkContextImpl();
+ WireService wireService = new JDKWireService(null, null);
+ WorkScheduler scheduler = new MockWorkScheduler();
+ connector = new ConnectorImpl(wireService, null, scheduler, context);
+ operation = new Operation<Type>("bar", null, null, null);
+ operation.setNonBlocking(true);
+ callbackOperation = new Operation<Type>("callback", null, null, null);
+ callbackOperation.setNonBlocking(true);
+ contract = new JavaServiceContract();
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("callback", callbackOperation);
+ contract.setCallbackOperations(ops);
+ }
+
+ private AtomicComponent createSource() throws Exception {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(component.createTargetInvoker(EasyMock.eq("callback"),
+ EasyMock.isA(Operation.class),
+ (InboundWire) EasyMock.isNull())).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+ private class MockWorkScheduler implements WorkScheduler {
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ work.run();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardSyncCallbackConnectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardSyncCallbackConnectionTestCase.java
new file mode 100644
index 0000000000..0e425b73bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/NonBlockingForwardSyncCallbackConnectionTestCase.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Type;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.WireService;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.services.work.NotificationListener;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.apache.tuscany.core.component.WorkContextImpl;
+
+/**
+ * Verifies connections with non-blocking forward and synchronous callback invocations
+ *
+ * @version $Rev$ $Date$
+ */
+public class NonBlockingForwardSyncCallbackConnectionTestCase extends TestCase {
+ private Operation<Type> operation;
+ private Operation<Type> callbackOperation;
+ private ServiceContract<Type> contract;
+ private ConnectorImpl connector;
+
+ public void testNonBlockingForwardAndSyncCallbackAtomicToAtomic() throws Exception {
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(target.getName()).andReturn("target").anyTimes();
+ EasyMock.expect(target.createTargetInvoker(EasyMock.eq("service"),
+ EasyMock.isA(Operation.class),
+ EasyMock.isA(InboundWire.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(target);
+
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(target);
+ inboundWire.setServiceContract(contract);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new NonBlockingForwardSyncCallbackConnectionTestCase.MockInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ AtomicComponent source = createSource();
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(source);
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName("target/service"));
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ InboundInvocationChain callbackInboundChain = new InboundInvocationChainImpl(callbackOperation);
+ callbackInboundChain.addInterceptor(new NonBlockingForwardSyncCallbackConnectionTestCase.MockInterceptor());
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(callbackOperation, callbackInboundChain);
+ outboundWire.addTargetCallbackInvocationChains(chains);
+
+ connector.connect(outboundWire, inboundWire, true);
+
+ // test the forward request
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ Message ret = outboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals(null, ret.getBody());
+
+ // test the callback
+ msg = new MessageImpl();
+ msg.setBody("callback");
+ Map<Operation<?>, OutboundInvocationChain> callbackChains =
+ inboundWire.getSourceCallbackInvocationChains("source");
+ OutboundInvocationChain callbackInvocationChain = callbackChains.get(callbackOperation);
+ ret = callbackInvocationChain.getHeadInterceptor().invoke(msg);
+ assertEquals("callback", ret.getBody());
+
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WorkContext context = new WorkContextImpl();
+ WireService wireService = new JDKWireService(null, null);
+ WorkScheduler scheduler = new NonBlockingForwardSyncCallbackConnectionTestCase.MockWorkScheduler();
+ connector = new ConnectorImpl(wireService, null, scheduler, context);
+ operation = new Operation<Type>("bar", null, null, null);
+ operation.setNonBlocking(true);
+ callbackOperation = new Operation<Type>("callback", null, null, null);
+ contract = new JavaServiceContract();
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("callback", callbackOperation);
+ contract.setCallbackOperations(ops);
+ }
+
+ private AtomicComponent createSource() throws Exception {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(component.createTargetInvoker(EasyMock.eq("callback"),
+ EasyMock.isA(Operation.class),
+ (InboundWire) EasyMock.isNull())).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+ private class MockWorkScheduler implements WorkScheduler {
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ work.run();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java
new file mode 100644
index 0000000000..2c8e2c3fa8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.Interceptor;
+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;
+import static org.apache.tuscany.spi.wire.TargetInvoker.NONE;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and {@link
+ * org.apache.tuscany.spi.wire.InboundInvocationChain}s
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class OutboundToInboundConnectTestCase extends TestCase {
+
+ public void testNoInterceptorsNoHandlers() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ InboundInvocationChain inboundChain = setupTarget(null);
+ OutboundInvocationChain outboundChain = setupSource(null);
+ String[] val = new String[]{"foo"};
+ TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+ expect(invoker.invokeTarget(EasyMock.eq(val), EasyMock.eq(NONE))).andReturn(val);
+ replay(invoker);
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ inboundChain.prepare();
+ assertEquals(val, outboundChain.getTargetInvoker().invokeTarget(val, NONE));
+ verify(invoker);
+ }
+
+
+ /**
+ * Verifies an invocation with a single source interceptor
+ */
+ public void testSourceInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ OutboundInvocationChain outboundChain = setupSource(interceptors);
+ InboundInvocationChain inboundChain = setupTarget(null);
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+ expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ replay(invoker);
+ assertEquals(0, interceptor.getCount());
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ inboundChain.prepare();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ verify(invoker);
+ }
+
+ /**
+ * Verifies an invocation with a single target interceptor
+ */
+ public void testTargetInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ List<Interceptor> interceptors = new ArrayList<Interceptor>();
+ interceptors.add(interceptor);
+ OutboundInvocationChain outboundChain = setupSource(null);
+ InboundInvocationChain inboundChain = setupTarget(interceptors);
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+ expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ replay(invoker);
+ assertEquals(0, interceptor.getCount());
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ inboundChain.prepare();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, interceptor.getCount());
+ verify(invoker);
+ }
+
+ /**
+ * Verifies an invocation with a source and target interceptor
+ */
+ public void testSourceTargetInterceptor() throws Exception {
+ ConnectorImpl connector = new ConnectorImpl();
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ List<Interceptor> sourceInterceptors = new ArrayList<Interceptor>();
+ sourceInterceptors.add(sourceInterceptor);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ List<Interceptor> targetInterceptors = new ArrayList<Interceptor>();
+ targetInterceptors.add(targetInterceptor);
+ OutboundInvocationChain outboundChain = setupSource(sourceInterceptors);
+ InboundInvocationChain inboundChain = setupTarget(targetInterceptors);
+ Message msg = new MessageImpl();
+ TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+ expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+ replay(invoker);
+ assertEquals(0, sourceInterceptor.getCount());
+ assertEquals(0, targetInterceptor.getCount());
+ connector.connect(outboundChain, inboundChain, invoker, false);
+ inboundChain.prepare();
+ msg.setTargetInvoker(outboundChain.getTargetInvoker());
+ assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
+ assertEquals(1, sourceInterceptor.getCount());
+ assertEquals(1, targetInterceptor.getCount());
+ verify(invoker);
+ }
+
+
+ public InboundInvocationChain setupTarget(List<Interceptor> interceptors) {
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(SimpleTarget.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+ Operation operation = contract.getOperations().get("echo");
+ InboundInvocationChainImpl chain = new InboundInvocationChainImpl(operation);
+ if (interceptors != null) {
+ for (Interceptor interceptor : interceptors) {
+ chain.addInterceptor(interceptor);
+ }
+ }
+ chain.addInterceptor(new InvokerInterceptor()); // add tail interceptor
+ return chain;
+ }
+
+ public OutboundInvocationChain setupSource(List<Interceptor> interceptors) {
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(SimpleTarget.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+ Operation operation = contract.getOperations().get("echo");
+ OutboundInvocationChainImpl chain = new OutboundInvocationChainImpl(operation);
+ if (interceptors != null) {
+ for (Interceptor interceptor : interceptors) {
+ chain.addInterceptor(interceptor);
+ }
+ }
+ return chain;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ReferenceConnectorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ReferenceConnectorTestCase.java
new file mode 100644
index 0000000000..d3e7263045
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ReferenceConnectorTestCase.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.component.AtomicComponent;
+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.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+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.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.core.implementation.composite.ReferenceImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceConnectorTestCase extends AbstractConnectorImplTestCase {
+ private AtomicComponent source;
+ private CompositeComponent parent;
+
+ public void testConnectReferenceWiresNoInboundInterceptors() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setServiceContract(contract);
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ // Outbound chains always contains at least one interceptor
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(TARGET_SERVICE_NAME);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ ReferenceBinding referenceBinding = EasyMock.createMock(ReferenceBinding.class);
+ referenceBinding.setReference(EasyMock.isA(Reference.class));
+ EasyMock.expect(referenceBinding.createTargetInvoker(contract, operation)).andReturn(null);
+ EasyMock.expect(referenceBinding.getInboundWire()).andReturn(inboundWire);
+ EasyMock.expect(referenceBinding.getOutboundWire()).andReturn(outboundWire);
+ EasyMock.expect(referenceBinding.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.replay(referenceBinding);
+ inboundWire.setContainer(referenceBinding);
+ outboundWire.setContainer(referenceBinding);
+
+ Reference reference = new ReferenceImpl("foo", parent, contract);
+ reference.addReferenceBinding(referenceBinding);
+
+ connector.connect(reference);
+
+ EasyMock.verify(referenceBinding);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testConnectReferenceWiresWithInboundInterceptors() throws Exception {
+ MockInterceptor inboundInterceptor = new MockInterceptor();
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(inboundInterceptor);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setServiceContract(contract);
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ // Outbound always contains at lease one interceptor
+ outboundChain.addInterceptor(new InvokerInterceptor());
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(TARGET_SERVICE_NAME);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ ReferenceBinding referenceBinding = EasyMock.createMock(ReferenceBinding.class);
+ referenceBinding.setReference(EasyMock.isA(Reference.class));
+ EasyMock.expect(referenceBinding.createTargetInvoker(contract, operation)).andReturn(null);
+ EasyMock.expect(referenceBinding.getInboundWire()).andReturn(inboundWire);
+ EasyMock.expect(referenceBinding.getOutboundWire()).andReturn(outboundWire);
+ EasyMock.expect(referenceBinding.isSystem()).andReturn(false);
+ EasyMock.replay(referenceBinding);
+ inboundWire.setContainer(referenceBinding);
+ outboundWire.setContainer(referenceBinding);
+
+ Reference reference = new ReferenceImpl("foo", parent, contract);
+ reference.addReferenceBinding(referenceBinding);
+
+ connector.connect(reference);
+
+ EasyMock.verify(referenceBinding);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ assertTrue(inboundInterceptor.isInvoked());
+ }
+
+ public void testOutboundWireToInboundReferenceTarget() throws Exception {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo");
+ EasyMock.replay(component);
+
+ ReferenceBinding target = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(target.isSystem()).andReturn(false);
+ EasyMock.expect(target.createTargetInvoker(EasyMock.isA(ServiceContract.class), EasyMock.isA(Operation.class)))
+ .andReturn(new MockInvoker());
+ EasyMock.replay(target);
+
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new InvokerInterceptor());
+ InboundWire targetWire = new InboundWireImpl();
+ targetWire.setServiceContract(contract);
+ targetWire.addInvocationChain(operation, inboundChain);
+ targetWire.setContainer(target);
+
+ // create the outbound wire and chain from the source component
+ OutboundInvocationChain sourceChain = new OutboundInvocationChainImpl(operation);
+ OutboundWire sourceWire = new OutboundWireImpl();
+ sourceWire.setServiceContract(contract);
+ sourceWire.setTargetName(TARGET_SERVICE_NAME);
+ sourceWire.addInvocationChain(operation, sourceChain);
+ sourceWire.setContainer(component);
+ sourceWire.setContainer(source);
+
+ connector.connect(sourceWire, targetWire, false);
+ Interceptor interceptor = sourceChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ source = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(source);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ServiceConnectorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ServiceConnectorTestCase.java
new file mode 100644
index 0000000000..0ccab5bfea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ServiceConnectorTestCase.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.component.AtomicComponent;
+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.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+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.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.core.implementation.composite.ReferenceImpl;
+import org.apache.tuscany.core.implementation.composite.ServiceImpl;
+import org.apache.tuscany.core.mock.binding.MockServiceBinding;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceConnectorTestCase extends AbstractConnectorImplTestCase {
+ private CompositeComponent parent;
+ private InboundInvocationChain inboundChain;
+ private ServiceBinding sourceServiceBinding;
+
+ public void testConnectServiceToAtomicComponent() throws Exception {
+ configureAtomicTarget();
+ Service sourceService = new ServiceImpl("foo", parent, contract);
+ sourceService.addServiceBinding(sourceServiceBinding);
+ connector.connect(sourceService);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testConnectServiceToChildCompositeService() throws Exception {
+ configureChildCompositeServiceTarget();
+ Service sourceService = new ServiceImpl("foo", parent, contract);
+ sourceService.addServiceBinding(sourceServiceBinding);
+ connector.connect(sourceService);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ public void testConnectServiceToReference() throws Exception {
+ configureReferenceTarget();
+ Service sourceService = new ServiceImpl("foo", parent, contract);
+ sourceService.addServiceBinding(sourceServiceBinding);
+ connector.connect(sourceService);
+ Interceptor interceptor = inboundChain.getHeadInterceptor();
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(new MockInvoker());
+ Message resp = interceptor.invoke(msg);
+ assertEquals(RESPONSE, resp.getBody());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ inboundChain = new InboundInvocationChainImpl(operation);
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setServiceContract(contract);
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ // Outbound chains always contains at least one interceptor
+ outboundChain.addInterceptor(new SynchronousBridgingInterceptor());
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(TARGET_SERVICE_NAME);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ sourceServiceBinding = new MockServiceBinding();
+ sourceServiceBinding.setInboundWire(inboundWire);
+ sourceServiceBinding.setOutboundWire(outboundWire);
+ inboundWire.setContainer(sourceServiceBinding);
+ outboundWire.setContainer(sourceServiceBinding);
+
+ }
+
+ private void configureAtomicTarget() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new InvokerInterceptor());
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setServiceContract(contract);
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ AtomicComponent atomicTarget = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(atomicTarget.getInboundWire(EasyMock.isA(String.class))).andReturn(inboundWire).atLeastOnce();
+ EasyMock.expect(atomicTarget.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.expect(atomicTarget.isSystem()).andReturn(false);
+ EasyMock.expect(atomicTarget.createTargetInvoker(EasyMock.isA(String.class),
+ EasyMock.isA(Operation.class),
+ EasyMock.isA(InboundWire.class))).andReturn(new MockInvoker());
+ EasyMock.replay(atomicTarget);
+
+ inboundWire.setContainer(atomicTarget);
+
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ EasyMock.expect(parent.getChild(TARGET)).andReturn(atomicTarget);
+ EasyMock.replay(parent);
+ }
+
+ private void configureChildCompositeServiceTarget() throws Exception {
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new InvokerInterceptor());
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setServiceContract(contract);
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ CompositeComponent compositeTarget = EasyMock.createMock(CompositeComponent.class);
+ Service service = createLocalService(compositeTarget);
+ ServiceBinding binding = service.getServiceBindings().get(0);
+ EasyMock.expect(compositeTarget.getInboundWire(TARGET_SERVICE)).andReturn(binding.getInboundWire());
+ EasyMock.expect(compositeTarget.getScope()).andReturn(Scope.SYSTEM).anyTimes();
+ EasyMock.replay(compositeTarget);
+
+ inboundWire.setContainer(compositeTarget);
+
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ EasyMock.expect(parent.getChild(TARGET)).andReturn(compositeTarget);
+ EasyMock.replay(parent);
+ }
+
+
+ private void configureReferenceTarget() throws Exception {
+ ReferenceBinding binding = createLocalReferenceBinding(TARGET_NAME);
+ Reference referenceTarget = new ReferenceImpl(TARGET, parent, contract);
+ referenceTarget.addReferenceBinding(binding);
+ // put a terminating interceptor on the outbound wire of the reference for testing an invocation
+ binding.getOutboundWire().getInvocationChains().get(operation).addInterceptor(new InvokerInterceptor());
+ connector.connect(binding.getInboundWire(), binding.getOutboundWire(), true);
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ EasyMock.expect(parent.getChild(TARGET)).andReturn(referenceTarget);
+ EasyMock.replay(parent);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/SynchronousForwardCallbackConnectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/SynchronousForwardCallbackConnectionTestCase.java
new file mode 100644
index 0000000000..9beca64444
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/SynchronousForwardCallbackConnectionTestCase.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.builder;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
+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.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
+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;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies connections with synchronous forward and callback invocations
+ *
+ * @version $Rev$ $Date$
+ */
+public class SynchronousForwardCallbackConnectionTestCase extends TestCase {
+ private Operation<Type> operation;
+ private Operation<Type> callbackOperation;
+ private ServiceContract<Type> contract;
+ private ConnectorImpl connector;
+
+ public void testSyncForwardAndCallbackAtomicToAtomic() throws Exception {
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(target.getName()).andReturn("target").anyTimes();
+ EasyMock.expect(target.createTargetInvoker(EasyMock.eq("service"),
+ EasyMock.isA(Operation.class),
+ EasyMock.isA(InboundWire.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(target);
+
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(target);
+ inboundWire.setServiceContract(contract);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new MockInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ AtomicComponent source = createSource();
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(source);
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName("target/service"));
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ InboundInvocationChain callbackInboundChain = new InboundInvocationChainImpl(callbackOperation);
+ callbackInboundChain.addInterceptor(new MockInterceptor());
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(callbackOperation, callbackInboundChain);
+ outboundWire.addTargetCallbackInvocationChains(chains);
+
+ connector.connect(outboundWire, inboundWire, true);
+
+ // test the forward request
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ Message ret = outboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals("foo", ret.getBody());
+
+ // test the callback
+ msg = new MessageImpl();
+ msg.setBody("callback");
+ Map<Operation<?>, OutboundInvocationChain> callbackChains =
+ inboundWire.getSourceCallbackInvocationChains("source");
+ OutboundInvocationChain callbackInvocationChain = callbackChains.get(callbackOperation);
+ ret = callbackInvocationChain.getHeadInterceptor().invoke(msg);
+ assertEquals("callback", ret.getBody());
+
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ }
+
+ public void testSyncForwardAndCallbackAtomicToReferenceBinding() throws Exception {
+ ReferenceBinding target = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(target.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(target.createTargetInvoker(EasyMock.isA(ServiceContract.class),
+ EasyMock.isA(Operation.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(target);
+
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(target);
+ inboundWire.setServiceContract(contract);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new MockInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ AtomicComponent source = createSource();
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(source);
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName("target/service"));
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ InboundInvocationChain callbackInboundChain = new InboundInvocationChainImpl(callbackOperation);
+ callbackInboundChain.addInterceptor(new MockInterceptor());
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(callbackOperation, callbackInboundChain);
+ outboundWire.addTargetCallbackInvocationChains(chains);
+
+ connector.connect(outboundWire, inboundWire, true);
+ // test the forward request
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ Message ret = outboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals("foo", ret.getBody());
+
+ // test the callback
+ msg = new MessageImpl();
+ msg.setBody("callback");
+ Map<Operation<?>, OutboundInvocationChain> callbackChains =
+ inboundWire.getSourceCallbackInvocationChains("source");
+ OutboundInvocationChain callbackInvocationChain = callbackChains.get(callbackOperation);
+ ret = callbackInvocationChain.getHeadInterceptor().invoke(msg);
+ assertEquals("callback", ret.getBody());
+
+ EasyMock.verify(target);
+ EasyMock.verify(source);
+ }
+
+ public void testSyncForwardAndCallbackReferenceBindingToServiceBinding() throws Exception {
+ ReferenceBinding source = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(source.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(source.createTargetInvoker(EasyMock.isA(ServiceContract.class),
+ EasyMock.isA(Operation.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(source);
+
+ ServiceBinding target = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(target.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(target.createTargetInvoker(EasyMock.isA(ServiceContract.class),
+ EasyMock.isA(Operation.class))).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(target);
+
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(target);
+ inboundWire.setServiceContract(contract);
+ InboundInvocationChain inboundChain = new InboundInvocationChainImpl(operation);
+ inboundChain.addInterceptor(new MockInterceptor());
+ inboundWire.addInvocationChain(operation, inboundChain);
+
+ OutboundWire outboundWire = new OutboundWireImpl();
+ outboundWire.setContainer(source);
+ outboundWire.setServiceContract(contract);
+ outboundWire.setTargetName(new QualifiedName("target/service"));
+ OutboundInvocationChain outboundChain = new OutboundInvocationChainImpl(operation);
+ outboundWire.addInvocationChain(operation, outboundChain);
+
+ InboundInvocationChain callbackInboundChain = new InboundInvocationChainImpl(callbackOperation);
+ callbackInboundChain.addInterceptor(new MockInterceptor());
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(callbackOperation, callbackInboundChain);
+ outboundWire.addTargetCallbackInvocationChains(chains);
+
+ connector.connect(outboundWire, inboundWire, true);
+ // test the forward request
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ Message ret = outboundChain.getHeadInterceptor().invoke(msg);
+ assertEquals("foo", ret.getBody());
+
+ // test the callback
+ msg = new MessageImpl();
+ msg.setBody("callback");
+ Map<Operation<?>, OutboundInvocationChain> callbackChains =
+ inboundWire.getSourceCallbackInvocationChains("source");
+ OutboundInvocationChain callbackInvocationChain = callbackChains.get(callbackOperation);
+ ret = callbackInvocationChain.getHeadInterceptor().invoke(msg);
+ assertEquals("callback", ret.getBody());
+
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WireService wireService = new JDKWireService(null, null);
+ connector = new ConnectorImpl(wireService, null, null, null);
+ operation = new Operation<Type>("bar", null, null, null);
+ callbackOperation = new Operation<Type>("callback", null, null, null);
+ contract = new JavaServiceContract();
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("callback", callbackOperation);
+ contract.setCallbackOperations(ops);
+ }
+
+ private AtomicComponent createSource() throws Exception {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).anyTimes();
+ EasyMock.expect(component.createTargetInvoker(EasyMock.eq("callback"),
+ EasyMock.isA(Operation.class),
+ (InboundWire) EasyMock.isNull())).andReturn(EasyMock.createNiceMock(TargetInvoker.class));
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.java
new file mode 100644
index 0000000000..b6ecd952e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/TargetServiceNotFoundExceptionTestCase.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 junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetServiceNotFoundExceptionTestCase extends TestCase {
+
+ public void testInstantiation() throws Exception {
+ TargetServiceNotFoundException e = new TargetServiceNotFoundException("message",
+ "source name",
+ "ref name",
+ "target name",
+ "service name");
+ assertEquals("message", e.getMessage());
+ assertEquals("source name", e.getSourceName());
+ assertEquals("ref name", e.getReferenceName());
+ assertEquals("target name", e.getTargetName());
+ assertEquals("service name", e.getTargetServiceName());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.java
new file mode 100644
index 0000000000..359733a4fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImplTestCase.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.builder;
+
+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;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WirePostProcessorRegistryImplTestCase extends TestCase {
+
+ public void testRegisterUnregister() throws Exception {
+ WirePostProcessorRegistry registry = new WirePostProcessorRegistryImpl();
+ OutboundWire owire = EasyMock.createMock(OutboundWire.class);
+ InboundWire iwire = EasyMock.createMock(InboundWire.class);
+ WirePostProcessor processor = createMock(WirePostProcessor.class);
+ processor.process(EasyMock.eq(owire), EasyMock.eq(iwire));
+ EasyMock.replay(processor);
+ registry.register(processor);
+ registry.process(owire, iwire);
+ registry.unregister(processor);
+ registry.process(owire, iwire);
+ verify(processor);
+ }
+
+ public void testProcessInboundToOutbound() throws Exception {
+ WirePostProcessorRegistry registry = new WirePostProcessorRegistryImpl();
+ OutboundWire owire = EasyMock.createMock(OutboundWire.class);
+ InboundWire iwire = EasyMock.createMock(InboundWire.class);
+ WirePostProcessor processor = createMock(WirePostProcessor.class);
+ processor.process(EasyMock.eq(iwire), EasyMock.eq(owire));
+ EasyMock.replay(processor);
+ registry.register(processor);
+ registry.process(iwire, owire);
+ verify(processor);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.java
new file mode 100644
index 0000000000..0269fd07e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/WiringExceptionFormatterTestCase.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.builder;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WiringExceptionFormatterTestCase extends TestCase {
+ WiringExceptionFormatter formatter = new WiringExceptionFormatter(EasyMock.createNiceMock(FormatterRegistry.class));
+
+ public void testFormat() throws Exception {
+ WiringException e = new MockWiringException("message",
+ "identifier",
+ "source name",
+ "ref name",
+ "target name",
+ "service name");
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ String buffer = writer.toString();
+ assertTrue(buffer.indexOf("message") >= 0);
+ assertTrue(buffer.indexOf("identifier") >= 0);
+ assertTrue(buffer.indexOf("source name") >= 0);
+ assertTrue(buffer.indexOf("ref name") >= 0);
+ assertTrue(buffer.indexOf("target name") >= 0);
+ assertTrue(buffer.indexOf("service name") >= 0);
+ }
+
+
+ public void testFormatNulls() throws Exception {
+ WiringException e = new MockWiringException("message",
+ "identifier",
+ "source name",
+ null,
+ "target name",
+ null);
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ String buffer = writer.toString();
+ assertTrue(buffer.indexOf("message") >= 0);
+ assertTrue(buffer.indexOf("identifier") >= 0);
+ assertTrue(buffer.indexOf("source name") >= 0);
+ assertTrue(buffer.indexOf("target name") >= 0);
+ }
+
+ private class MockWiringException extends WiringException {
+
+ public MockWiringException(String message, String
+ identifier,
+ String sourceName,
+ String referenceName,
+ String targetName,
+ String serviceName) {
+ super(message, identifier);
+ setSourceName(sourceName);
+ setReferenceName(referenceName);
+ setTargetName(targetName);
+ setTargetServiceName(serviceName);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/WorkContextImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/WorkContextImplTestCase.java
new file mode 100644
index 0000000000..aee910ddaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/WorkContextImplTestCase.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.component;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkContextImplTestCase extends TestCase {
+
+ public void testPushPopServiceNames() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ context.pushServiceName("foo");
+ context.pushServiceName("bar");
+ assertEquals("bar", context.getCurrentServiceName());
+ assertEquals("bar", context.popServiceName());
+ assertEquals("foo", context.getCurrentServiceName());
+ assertEquals("foo", context.popServiceName());
+ assertNull(context.getCurrentServiceName());
+ }
+
+ public void testGetCurrentServiceNamesNull() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ assertNull(context.getCurrentServiceName());
+ }
+
+ public void testPopCurrentServiceNamesNull() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ assertNull(context.popServiceName());
+ }
+
+ public void testClearServiceNames() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ context.pushServiceName("foo");
+ context.pushServiceName("bar");
+ context.clearServiceNames();
+ assertNull(context.getCurrentServiceName());
+ }
+
+ public void testClearServiceNamesNull() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ context.clearServiceNames();
+ assertNull(context.getCurrentServiceName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.java
new file mode 100644
index 0000000000..79b9757c2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/event/EventTestCase.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.component.event;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EventTestCase extends TestCase {
+
+ private CompositeComponent component;
+
+ public void testCompositeStart() {
+ CompositeStart event = new CompositeStart(this, component);
+ assertEquals(component, event.getComposite());
+ }
+
+ public void testCompositeStop() {
+ CompositeStop event = new CompositeStop(this, component);
+ assertEquals(component, event.getComposite());
+ }
+
+ public void testHttpSessionStart() {
+ Object id = new Object();
+ HttpSessionEvent event = new HttpSessionStart(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getId());
+ }
+
+ public void testHttpSessionEnd() {
+ Object id = new Object();
+ HttpSessionEvent event = new HttpSessionEnd(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getId());
+ }
+
+ public void testRequestStart() {
+ RequestStart event = new RequestStart(this);
+ assertEquals(this, event.getSource());
+ }
+
+ public void testReequestEnd() {
+ RequestEnd event = new RequestEnd(this);
+ assertEquals(this, event.getSource());
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ component = EasyMock.createNiceMock(CompositeComponent.class);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.java
new file mode 100644
index 0000000000..f8f8dd5f60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/AbstractScopeContainerTestCase.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 org.apache.tuscany.spi.component.AtomicComponent;
+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;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractScopeContainerTestCase extends TestCase {
+
+ public void testFireListener() {
+ TestContainer container = new TestContainer("foo");
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ Event event = new TestEvent();
+ listener.onEvent(EasyMock.eq(event));
+ EasyMock.replay(listener);
+ container.addListener(listener);
+ container.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testRemoveListener() {
+ TestContainer container = new TestContainer("foo");
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ Event event = new TestEvent();
+ container.addListener(listener);
+ container.removeListener(listener);
+ container.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testFalseFilterListener() {
+ TestContainer container = new TestContainer("foo");
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ Event event = new TestEvent();
+ EasyMock.replay(listener);
+ container.addListener(new FalseFilter(), listener);
+ container.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testTrueFilterListener() {
+ TestContainer container = new TestContainer("foo");
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ Event event = new TestEvent();
+ listener.onEvent(EasyMock.eq(event));
+ EasyMock.replay(listener);
+ container.addListener(new TrueFilter(), listener);
+ container.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testToString() {
+ TestContainer container = new TestContainer("foo");
+ assertNotNull(container.toString());
+ }
+
+ private class TestContainer extends AbstractScopeContainer {
+
+ public TestContainer(String name) {
+ super(null, null);
+ }
+
+ protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create) {
+ return null;
+ }
+
+ public Scope getScope() {
+ return null;
+ }
+
+ public void register(AtomicComponent component) {
+
+ }
+
+ public void onEvent(Event event) {
+
+ }
+
+ public WorkContext getWorkContext() {
+ return super.getWorkContext();
+ }
+ }
+
+ private class TestEvent implements Event {
+ public Object getSource() {
+ return null;
+ }
+ }
+
+ private class FalseFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java
new file mode 100644
index 0000000000..cd68b46541
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicCompositeScopeTestCase.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.CompositeScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class BasicCompositeScopeTestCase extends TestCase {
+
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+ private PojoObjectFactory<?> factory;
+
+ public void testLifecycleManagement() throws Exception {
+ CompositeScopeContainer scopeContext = new CompositeScopeContainer(null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ CompositeScopeInitDestroyComponent o1 =
+ (CompositeScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+ CompositeScopeInitDestroyComponent o2 =
+ (CompositeScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertEquals(o1, o2);
+ scopeContext.onEvent(new CompositeStop(this, null));
+ assertTrue(o1.isDestroyed());
+ scopeContext.stop();
+ }
+
+
+ public void testGetAssociatedInstance() throws Exception {
+ CompositeScopeContainer scopeContext = new CompositeScopeContainer(null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ scopeContext.getInstance(component);
+ scopeContext.getAssociatedInstance(component);
+ }
+
+ public void testGetAssociatedInstanceNonExistent() throws Exception {
+ CompositeScopeContainer scopeContext = new CompositeScopeContainer(null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ try {
+ scopeContext.getAssociatedInstance(component);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ }
+
+ public void testCompositeIsolation() throws Exception {
+ CompositeScopeContainer scopeContext = new CompositeScopeContainer(null);
+ scopeContext.start();
+
+ AtomicComponent component = createComponent(scopeContext);
+
+ CompositeScopeInitDestroyComponent o1 =
+ (CompositeScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+
+ CompositeScopeInitDestroyComponent o2 =
+ (CompositeScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertSame(o1, o2);
+ scopeContext.onEvent(new CompositeStop(this, null));
+ assertTrue(o1.isDestroyed());
+ scopeContext.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new PojoObjectFactory<CompositeScopeInitDestroyComponent>(
+ CompositeScopeInitDestroyComponent.class.getConstructor((Class[]) null));
+ initInvoker = new MethodEventInvoker<Object>(CompositeScopeInitDestroyComponent.class.getMethod(
+ "init", (Class[]) null));
+ destroyInvoker = new MethodEventInvoker<Object>(CompositeScopeInitDestroyComponent.class.getMethod(
+ "destroy", (Class[]) null));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private AtomicComponent createComponent(ScopeContainer scopeContainer) {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scopeContainer);
+ component.start();
+ return component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.java
new file mode 100644
index 0000000000..c97f3cb96f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicConversationalScopeTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.ConversationEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.ConversationalScopeInitDestroyComponent;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.EasyMock;
+
+/**
+ * @version $$Rev: 471111 $$ $$Date: 2006-11-03 23:06:48 -0500 (Fri, 03 Nov 2006) $$
+ */
+public class BasicConversationalScopeTestCase extends TestCase {
+
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+ private PojoObjectFactory<?> factory;
+
+ public void testLifecycleManagement() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ monitor.start(EasyMock.isA(String.class));
+ monitor.stop(EasyMock.isA(String.class));
+ MemoryStore store = new MemoryStore(monitor);
+ WorkContext workContext = new WorkContextImpl();
+ ConversationalScopeContainer scopeContext = new ConversationalScopeContainer(store, workContext, null);
+ scopeContext.start();
+ AtomicComponent atomicContext = createContext(scopeContext);
+ // start the request
+ String conversation = "conv";
+ workContext.setIdentifier(Scope.CONVERSATION, conversation);
+ ConversationalScopeInitDestroyComponent o1 =
+ (ConversationalScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+ //assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+ ConversationalScopeInitDestroyComponent o2 =
+ (ConversationalScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+ assertSame(o1, o2);
+ scopeContext.onEvent(new ConversationEnd(this, conversation));
+ //assertTrue(o1.isDestroyed());
+ scopeContext.stop();
+ }
+
+ public void testCompositeIsolation() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ monitor.start(EasyMock.isA(String.class));
+ monitor.stop(EasyMock.isA(String.class));
+ MemoryStore store = new MemoryStore(monitor);
+ WorkContext workContext = new WorkContextImpl();
+ ConversationalScopeContainer scopeContext = new ConversationalScopeContainer(store, workContext, null);
+ scopeContext.start();
+
+ AtomicComponent atomicContext = createContext(scopeContext);
+
+ String conversation1 = "conv";
+ workContext.setIdentifier(Scope.CONVERSATION, conversation1);
+ ConversationalScopeInitDestroyComponent o1 =
+ (ConversationalScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+ //assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+
+ String conversation2 = "conv2";
+ workContext.setIdentifier(Scope.CONVERSATION, conversation2);
+ ConversationalScopeInitDestroyComponent o2 =
+ (ConversationalScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
+ assertNotSame(o1, o2);
+
+ scopeContext.onEvent(new ConversationEnd(this, conversation1));
+ //assertTrue(o1.isDestroyed());
+ assertFalse(o2.isDestroyed());
+ scopeContext.onEvent(new ConversationEnd(this, conversation2));
+ //assertTrue(o2.isDestroyed());
+ scopeContext.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new PojoObjectFactory<ConversationalScopeInitDestroyComponent>(
+ ConversationalScopeInitDestroyComponent.class.getConstructor((Class[]) null));
+ initInvoker = new MethodEventInvoker<Object>(
+ ConversationalScopeInitDestroyComponent.class.getMethod("init", (Class[]) null));
+ destroyInvoker = new MethodEventInvoker<Object>(
+ ConversationalScopeInitDestroyComponent.class.getMethod("destroy", (Class[]) null));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private AtomicComponent createContext(ScopeContainer scopeContainer) {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scopeContainer);
+ component.start();
+ return component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java
new file mode 100644
index 0000000000..44e9bbc1d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicHttpSessionScopeTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.SessionScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class BasicHttpSessionScopeTestCase extends TestCase {
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+ private PojoObjectFactory<?> factory;
+
+ public void testLifecycleManagement() throws Exception {
+ WorkContext workContext = new WorkContextImpl();
+ HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext, null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ Object session = new Object();
+ workContext.setIdentifier(Scope.SESSION, session);
+ SessionScopeInitDestroyComponent o1 =
+ (SessionScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+ SessionScopeInitDestroyComponent o2 =
+ (SessionScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertSame(o1, o2);
+ scopeContext.onEvent(new HttpSessionEnd(this, session));
+ assertTrue(o1.isDestroyed());
+ scopeContext.stop();
+ }
+
+ public void testGetAssociatedInstance() throws Exception {
+ WorkContext workContext = new WorkContextImpl();
+ HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext, null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ Object session = new Object();
+ workContext.setIdentifier(Scope.SESSION, session);
+ scopeContext.getInstance(component);
+ scopeContext.getAssociatedInstance(component);
+ }
+
+ public void testGetAssociatedInstanceNonExistent() throws Exception {
+ WorkContext workContext = new WorkContextImpl();
+ HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext, null);
+ scopeContext.start();
+ AtomicComponent component = createComponent(scopeContext);
+ // start the request
+ Object session = new Object();
+ workContext.setIdentifier(Scope.SESSION, session);
+ try {
+ scopeContext.getAssociatedInstance(component);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ }
+
+ public void testSessionIsolation() throws Exception {
+ WorkContext workContext = new WorkContextImpl();
+ HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext, null);
+ scopeContext.start();
+
+ AtomicComponent component = createComponent(scopeContext);
+
+ Object session1 = new Object();
+ workContext.setIdentifier(Scope.SESSION, session1);
+ SessionScopeInitDestroyComponent o1 =
+ (SessionScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertTrue(o1.isInitialized());
+
+ Object session2 = new Object();
+ workContext.setIdentifier(Scope.SESSION, session2);
+ SessionScopeInitDestroyComponent o2 =
+ (SessionScopeInitDestroyComponent) scopeContext.getInstance(component);
+ assertNotSame(o1, o2);
+
+ scopeContext.onEvent(new HttpSessionEnd(this, session1));
+ assertTrue(o1.isDestroyed());
+ assertFalse(o2.isDestroyed());
+ scopeContext.onEvent(new HttpSessionEnd(this, session2));
+ assertTrue(o2.isDestroyed());
+ scopeContext.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new PojoObjectFactory<SessionScopeInitDestroyComponent>(
+ SessionScopeInitDestroyComponent.class.getConstructor((Class[]) null));
+ initInvoker = new MethodEventInvoker<Object>(
+ SessionScopeInitDestroyComponent.class.getMethod("init", (Class[]) null));
+ destroyInvoker = new MethodEventInvoker<Object>(
+ SessionScopeInitDestroyComponent.class.getMethod("destroy", (Class[]) null));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private AtomicComponent createComponent(ScopeContainer scopeContainer) {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scopeContainer);
+ component.start();
+ return component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java
new file mode 100644
index 0000000000..435e7d29b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicRequestScopeTestCase.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.RequestScopeInitDestroyComponent;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class BasicRequestScopeTestCase extends TestCase {
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+ private PojoObjectFactory<?> factory;
+
+ public void testLifecycleManagement() throws Exception {
+ RequestScopeContainer scopeContainer = new RequestScopeContainer(null, null);
+ scopeContainer.start();
+ AtomicComponent component = createComponent(scopeContainer);
+ // start the request
+ RequestScopeInitDestroyComponent o1 =
+ (RequestScopeInitDestroyComponent) scopeContainer.getInstance(component);
+ assertTrue(o1.isInitialized());
+ assertFalse(o1.isDestroyed());
+ RequestScopeInitDestroyComponent o2 =
+ (RequestScopeInitDestroyComponent) scopeContainer.getInstance(component);
+ assertSame(o1, o2);
+ scopeContainer.onEvent(new RequestEnd(this));
+ assertTrue(o1.isDestroyed());
+ scopeContainer.stop();
+ }
+
+ public void testGetAssociatedInstance() throws Exception {
+ RequestScopeContainer scopeContainer = new RequestScopeContainer(null, null);
+ scopeContainer.start();
+ AtomicComponent component = createComponent(scopeContainer);
+ // start the request
+ scopeContainer.getInstance(component);
+ scopeContainer.getAssociatedInstance(component);
+ scopeContainer.stop();
+ }
+
+ public void testGetAssociatedInstanceNonExistent() throws Exception {
+ RequestScopeContainer scopeContainer = new RequestScopeContainer(null, null);
+ scopeContainer.start();
+ AtomicComponent component = createComponent(scopeContainer);
+ // start the request
+ try {
+ scopeContainer.getAssociatedInstance(component);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ scopeContainer.stop();
+ }
+
+ public void testRequestIsolation() throws Exception {
+ RequestScopeContainer scopeContainer = new RequestScopeContainer(null, null);
+ scopeContainer.start();
+
+ AtomicComponent component = createComponent(scopeContainer);
+
+ RequestScopeInitDestroyComponent o1 =
+ (RequestScopeInitDestroyComponent) scopeContainer.getInstance(component);
+ assertTrue(o1.isInitialized());
+ scopeContainer.onEvent(new RequestEnd(this));
+ assertTrue(o1.isDestroyed());
+
+ RequestScopeInitDestroyComponent o2 =
+ (RequestScopeInitDestroyComponent) scopeContainer.getInstance(component);
+ assertNotSame(o1, o2);
+ scopeContainer.onEvent(new RequestEnd(this));
+ assertTrue(o2.isDestroyed());
+ scopeContainer.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new PojoObjectFactory<RequestScopeInitDestroyComponent>(
+ RequestScopeInitDestroyComponent.class.getConstructor((Class[]) null));
+ initInvoker = new MethodEventInvoker<Object>(
+ RequestScopeInitDestroyComponent.class.getMethod("init", (Class[]) null));
+ destroyInvoker = new MethodEventInvoker<Object>(
+ RequestScopeInitDestroyComponent.class.getMethod("destroy", (Class[]) null));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private AtomicComponent createComponent(ScopeContainer scopeContainer) {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scopeContainer);
+ component.start();
+ return component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.java
new file mode 100644
index 0000000000..9ca9230e5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/BasicStatelessScopeTestCase.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.core.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.StatelessComponent;
+import org.apache.tuscany.core.mock.component.StatelessComponentImpl;
+
+/**
+ * Unit tests for the composite scope container
+ *
+ * @version $Rev$ $Date$
+ */
+public class BasicStatelessScopeTestCase extends TestCase {
+ private PojoObjectFactory<StatelessComponentImpl> factory;
+
+ /**
+ * Verfies instance identity is properly maintained
+ */
+ public void testInstanceManagement() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ StatelessScopeContainer scope = new StatelessScopeContainer(ctx, null);
+ scope.start();
+ AtomicComponent component1 = createComponent(scope);
+ scope.register(component1);
+ AtomicComponent component2 = createComponent(scope);
+ scope.register(component2);
+ StatelessComponentImpl comp1 = (StatelessComponentImpl) scope.getInstance(component1);
+ Assert.assertNotNull(comp1);
+ StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getInstance(component2);
+ Assert.assertNotNull(comp2);
+ Assert.assertNotSame(comp1, comp2);
+ scope.stop();
+ }
+
+ public void testGetAssociatedInstance() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ StatelessScopeContainer scope = new StatelessScopeContainer(ctx, null);
+ scope.start();
+ AtomicComponent component1 = createComponent(scope);
+ scope.register(component1);
+ try {
+ // always throws an exception, which is the semantic for stateless implementations
+ scope.getAssociatedInstance(component1);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ scope.stop();
+ }
+
+ public void testRegisterContextAfterRequest() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ StatelessScopeContainer scope = new StatelessScopeContainer(ctx, null);
+
+ scope.start();
+ AtomicComponent component1 = createComponent(scope);
+ scope.register(component1);
+ StatelessComponent comp1 = (StatelessComponentImpl) scope.getInstance(component1);
+ Assert.assertNotNull(comp1);
+ AtomicComponent component2 = createComponent(scope);
+ scope.register(component2);
+ StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getInstance(component2);
+ Assert.assertNotNull(comp2);
+ scope.stop();
+ }
+
+
+ /**
+ * Tests setting no components in the scope
+ */
+ public void testSetNullComponents() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ StatelessScopeContainer scope = new StatelessScopeContainer(ctx, null);
+ scope.start();
+ scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory =
+ new PojoObjectFactory<StatelessComponentImpl>(StatelessComponentImpl.class.getConstructor((Class[]) null));
+
+ }
+
+ private AtomicComponent createComponent(ScopeContainer scopeContainer) {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setName("foo");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scopeContainer);
+ return component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.java
new file mode 100644
index 0000000000..8ac4ce46a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInitDestroyErrorTestCase.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.component.scope;
+
+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 junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeInitDestroyErrorTestCase extends TestCase {
+
+ public void testInitializeErrorMonitor() throws Exception {
+ ScopeContainerMonitor monitor;
+ monitor = EasyMock.createMock(ScopeContainerMonitor.class);
+ monitor.eagerInitializationError(EasyMock.isA(ObjectCreationException.class));
+ EasyMock.replay(monitor);
+ CompositeScopeContainer scope = new CompositeScopeContainer(monitor);
+ scope.start();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.createInstance()).andThrow(new ObjectCreationException(""));
+ EasyMock.expect(component.getInitLevel()).andReturn(1);
+ EasyMock.replay(component);
+ scope.register(component);
+ scope.onEvent(new CompositeStart(this, null));
+ EasyMock.verify(monitor);
+ }
+
+ public void testDestroyErrorMonitor() throws Exception {
+ ScopeContainerMonitor monitor;
+ monitor = EasyMock.createMock(ScopeContainerMonitor.class);
+ monitor.destructionError(EasyMock.isA(TargetDestructionException.class));
+ EasyMock.replay(monitor);
+ CompositeScopeContainer scope = new CompositeScopeContainer(monitor);
+ scope.start();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.createInstance()).andReturn(new Object());
+ EasyMock.expect(component.getInitLevel()).andReturn(1);
+ component.init(EasyMock.isA(Object.class));
+ component.destroy(EasyMock.isA(Object.class));
+ EasyMock.expectLastCall().andThrow(new TargetDestructionException("", ""));
+ EasyMock.replay(component);
+ scope.register(component);
+ scope.onEvent(new CompositeStart(this, null));
+ scope.onEvent(new CompositeStop(this, null));
+ EasyMock.verify(monitor);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInstanceLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInstanceLifecycleTestCase.java
new file mode 100644
index 0000000000..0d70bcf252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeInstanceLifecycleTestCase.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.component.scope;
+
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.TargetException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * Lifecycle unit tests for the composite scope container
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeInstanceLifecycleTestCase extends TestCase {
+
+ /**
+ * Verify init and stop by scope container on an atomic component
+ *
+ * @throws Exception
+ */
+ public void testInitDestroy() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ Foo comp = new Foo();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andReturn(comp);
+ EasyMock.expect(component.getInitLevel()).andReturn(1).atLeastOnce();
+ component.init(EasyMock.eq(comp));
+ component.destroy(EasyMock.eq(comp));
+ EasyMock.replay(component);
+ scope.register(component);
+ scope.onEvent(new CompositeStart(this, null));
+ assertNotNull(scope.getInstance(component));
+ // expire composite
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verify init and stop by scope container on an atomic component when set to eager initialize
+ *
+ * @throws Exception
+ */
+ public void testEagerInitDestroy() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ Foo comp = new Foo();
+ AtomicComponent initDestroyComponent = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(initDestroyComponent.createInstance()).andReturn(comp);
+ EasyMock.expect(initDestroyComponent.getInitLevel()).andReturn(1).atLeastOnce();
+ initDestroyComponent.init(EasyMock.eq(comp));
+ initDestroyComponent.destroy(EasyMock.eq(comp));
+ EasyMock.replay(initDestroyComponent);
+ scope.register(initDestroyComponent);
+ scope.onEvent(new CompositeStart(this, null));
+ // expire composite
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ EasyMock.verify(initDestroyComponent);
+ }
+
+
+ public void testDestroyOrder() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+
+ AtomicComponent oneComponent = createComponent(0);
+ scope.register(oneComponent);
+ AtomicComponent twoComponent = createComponent(0);
+ scope.register(twoComponent);
+ AtomicComponent threeComponent = createComponent(0);
+ scope.register(threeComponent);
+
+ scope.onEvent(new CompositeStart(this, null));
+ OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneComponent);
+ assertNotNull(one);
+ assertEquals(1, one.getNumberInstantiated());
+ assertEquals(1, one.getInitOrder());
+
+ OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoComponent);
+ assertNotNull(two);
+ assertEquals(2, two.getNumberInstantiated());
+ assertEquals(2, two.getInitOrder());
+
+ OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeComponent);
+ assertNotNull(three);
+ assertEquals(3, three.getNumberInstantiated());
+ assertEquals(3, three.getInitOrder());
+
+ // expire composite
+ scope.onEvent(new CompositeStop(this, null));
+ assertEquals(0, one.getNumberInstantiated());
+ scope.stop();
+ EasyMock.verify(oneComponent);
+ EasyMock.verify(twoComponent);
+ EasyMock.verify(threeComponent);
+ }
+
+ public void testEagerInitDestroyOrder() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+
+ AtomicComponent oneComponent = createComponent(1);
+ scope.register(oneComponent);
+ AtomicComponent twoComponent = createComponent(1);
+ scope.register(twoComponent);
+ AtomicComponent threeComponent = createComponent(1);
+ scope.register(threeComponent);
+
+ scope.onEvent(new CompositeStart(this, null));
+ OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneComponent);
+ assertNotNull(one);
+
+ OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoComponent);
+ assertNotNull(two);
+
+ OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeComponent);
+ assertNotNull(three);
+
+ // expire composite
+ scope.onEvent(new CompositeStop(this, null));
+ assertEquals(0, one.getNumberInstantiated());
+ scope.stop();
+ EasyMock.verify(oneComponent);
+ EasyMock.verify(twoComponent);
+ EasyMock.verify(threeComponent);
+ }
+
+ @SuppressWarnings("unchecked")
+ private AtomicComponent createComponent(int init) throws TargetException {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return new OrderedInitPojoImpl();
+ }
+ });
+ EasyMock.expect(component.getInitLevel()).andReturn(init).atLeastOnce();
+ component.init(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.init();
+ return null;
+ }
+ });
+ component.destroy(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.destroy();
+ return null;
+ }
+ });
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactoryTestCase.java
new file mode 100644
index 0000000000..611fbfc13f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeObjectFactoryTestCase.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.scope;
+
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeObjectFactoryTestCase extends TestCase {
+
+ public void testCreation() {
+ ScopeRegistry registry = EasyMock.createMock(ScopeRegistry.class);
+ registry.registerFactory(EasyMock.isA(Scope.class), EasyMock.isA(CompositeScopeObjectFactory.class));
+
+ assertNotNull(new CompositeScopeObjectFactory(registry, null).getInstance());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeRestartTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeRestartTestCase.java
new file mode 100644
index 0000000000..1fdaeed48c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/CompositeScopeRestartTestCase.java
@@ -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.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Verifies the scope container properly disposes resources and canbe restarted
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class CompositeScopeRestartTestCase extends TestCase {
+
+ public void testRestart() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ MethodEventInvoker<Object> initInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("init"));
+ MethodEventInvoker<Object> destroyInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+ configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+ configuration.setName("InitDestroy");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scope);
+ component.start();
+
+ scope.onEvent(new CompositeStart(this, null));
+ Object instance = component.getTargetInstance();
+ assertSame(instance, component.getTargetInstance());
+
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ component.stop();
+
+ scope.start();
+ scope.onEvent(new CompositeStart(this, null));
+ component.start();
+ assertNotSame(instance, component.getTargetInstance());
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ component.stop();
+ }
+
+ public static class InitDestroyOnce {
+
+ private boolean initialized;
+ private boolean destroyed;
+
+ public InitDestroyOnce() {
+ }
+
+ public void init() {
+ if (!initialized) {
+ initialized = true;
+ } else {
+ fail("Scope did not clean up properly - Init called more than once");
+ }
+ }
+
+ public void destroy() {
+ if (!destroyed) {
+ destroyed = true;
+ } else {
+ fail("Scope did not clean up properly - Destroyed called more than once");
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.java
new file mode 100644
index 0000000000..a1a3616d0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerDestroyOnExpirationTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.ScopeContainer;
+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.services.store.RecoveryListener;
+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;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerDestroyOnExpirationTestCase extends TestCase {
+ private ScopeContainer container;
+ private TestStore store;
+ private AtomicComponent component;
+
+ /**
+ * Verifies the scope container registers a callback listener for component instance destroy events when a
+ * conversational instance expires
+ */
+ public void testDestroyNotification() throws Exception {
+ store.getListener().onEvent(new StoreExpirationEvent(this, component, new Object()));
+ EasyMock.verify(component);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ component = EasyMock.createMock(AtomicComponent.class);
+ component.destroy(EasyMock.isA(Object.class));
+ EasyMock.replay(component);
+ store = new TestStore();
+ WorkContext context = new WorkContextImpl();
+ container = new ConversationalScopeContainer(store, context, null);
+ container.start();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ }
+
+ private class TestStore implements Store {
+ private RuntimeEventListener listener;
+
+ public RuntimeEventListener getListener() {
+ return listener;
+ }
+
+ public void insertRecord(SCAObject owner, String id, Object object, long expiration)
+ throws StoreWriteException {
+
+ }
+
+ public void updateRecord(SCAObject owner, String id, Object object, long expiration)
+ throws StoreWriteException {
+
+ }
+
+ public Object readRecord(SCAObject owner, String id) throws StoreReadException {
+ return null;
+ }
+
+ public void removeRecord(SCAObject owner, String id) throws StoreWriteException {
+
+ }
+
+ public void removeRecords() throws StoreWriteException {
+
+ }
+
+ public void recover(RecoveryListener listener) throws StoreReadException {
+
+ }
+
+ public void publish(Event object) {
+
+ }
+
+ public void addListener(RuntimeEventListener listener) {
+ this.listener = listener;
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.java
new file mode 100644
index 0000000000..79ea057652
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxAgeTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.store.Store;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerMaxAgeTestCase extends TestCase {
+
+ private ScopeContainer container;
+ private WorkContext context;
+ private Store store;
+ private AtomicComponent component;
+
+ public void testMaxAgeUpdate() throws Exception {
+ context.setIdentifier(Scope.CONVERSATION, "12345");
+ container.getInstance(component);
+ EasyMock.verify(store);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ConversationalScopeContainerMaxAgeTestCase.Foo foo = new ConversationalScopeContainerMaxAgeTestCase.Foo();
+ context = new WorkContextImpl();
+ component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce();
+ EasyMock.replay(component);
+ store = EasyMock.createMock(Store.class);
+ EasyMock.expect(store.readRecord(EasyMock.isA(SCAObject.class), EasyMock.isA(String.class))).andReturn(foo);
+ store.addListener(EasyMock.isA(RuntimeEventListener.class));
+ EasyMock.replay(store);
+ container = new ConversationalScopeContainer(store, context, null);
+ container.start();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ context.clearIdentifier(Scope.CONVERSATION);
+ container.stop();
+ }
+
+ private class Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.java
new file mode 100644
index 0000000000..2ba152d223
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerMaxIdleTimeTestCase.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.core.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.store.Store;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerMaxIdleTimeTestCase extends TestCase {
+
+ private ScopeContainer container;
+ private WorkContext context;
+ private Store store;
+ private AtomicComponent component;
+
+ public void testMaxIdleTimeUpdate() throws Exception {
+ context.setIdentifier(Scope.CONVERSATION, "12345");
+ container.getInstance(component);
+ EasyMock.verify(store);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Foo foo = new Foo();
+ context = new WorkContextImpl();
+ component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(600000L).atLeastOnce();
+ EasyMock.replay(component);
+ store = EasyMock.createMock(Store.class);
+ EasyMock.expect(store.readRecord(EasyMock.isA(SCAObject.class), EasyMock.isA(String.class))).andReturn(foo);
+ store.addListener(EasyMock.isA(RuntimeEventListener.class));
+ store.updateRecord(EasyMock.isA(SCAObject.class),
+ EasyMock.isA(String.class),
+ EasyMock.eq(foo),
+ EasyMock.anyLong());
+ EasyMock.replay(store);
+ container = new ConversationalScopeContainer(store, context, null);
+ container.start();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ context.clearIdentifier(Scope.CONVERSATION);
+ container.stop();
+ }
+
+ private class Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java
new file mode 100644
index 0000000000..ae7e91a59a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeContainerPersistenceTestCase.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.UUID;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+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.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerPersistenceTestCase extends TestCase {
+ private ScopeContainer container;
+ private WorkContext context;
+
+ /**
+ * Verifies the scope container properly creates an instance
+ */
+ public void testNotYetPersistedInMemory() throws Exception {
+ String id = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.eq(container));
+ EasyMock.expect(component.createInstance()).andReturn(new Foo());
+ EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce();
+ component.init(EasyMock.isA(Object.class));
+ EasyMock.replay(component);
+ container.register(component);
+ assertTrue(container.getInstance(component) instanceof Foo);
+ EasyMock.verify(component);
+ }
+
+ public void testPersistNewInMemory() throws Exception {
+ String id = UUID.randomUUID().toString();
+ String id2 = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.eq(container));
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ EasyMock.replay(component);
+ container.register(component);
+ Foo foo = new Foo();
+ Foo foo2 = new Foo();
+ container.persistNew(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getInstance(component));
+ container.persistNew(component, id2, foo2, System.currentTimeMillis() + 100000);
+ context.setIdentifier(Scope.CONVERSATION, id2);
+ assertEquals(foo2, container.getInstance(component));
+ EasyMock.verify(component);
+ }
+
+ public void testPersistInMemory() throws Exception {
+ String id = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.eq(container));
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ EasyMock.replay(component);
+ container.register(component);
+ Foo foo = new Foo();
+ container.persistNew(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getInstance(component));
+ container.persist(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getInstance(component));
+ EasyMock.verify(component);
+ }
+
+ public void testRemoveInMemory() throws Exception {
+ String id = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.eq(container));
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(component);
+ container.register(component);
+ Foo foo = new Foo();
+ container.persistNew(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getInstance(component));
+ container.remove(component);
+ try {
+ container.getAssociatedInstance(component);
+ fail();
+ } catch (TargetNotFoundException e) {
+ //expected
+ }
+ EasyMock.verify(component);
+ }
+
+ public void testRecreateAfterRemoveInMemory() throws Exception {
+ String id = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.eq(container));
+ EasyMock.expect(component.getMaxAge()).andReturn(600000L).atLeastOnce();
+ component.init(EasyMock.isA(Object.class));
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ EasyMock.expect(component.createInstance()).andReturn(new Foo());
+ EasyMock.replay(component);
+ container.register(component);
+ Foo foo = new Foo();
+ container.persistNew(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getInstance(component));
+ container.remove(component);
+ Foo foo2 = (Foo) container.getInstance(component);
+ assertNotNull(foo2);
+ assertNotSame(foo, foo2);
+ EasyMock.verify(component);
+ }
+
+ public void testGetPersistedInstance() throws Exception {
+ String id = UUID.randomUUID().toString();
+ String id2 = UUID.randomUUID().toString();
+ context.setIdentifier(Scope.CONVERSATION, id);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.getMaxIdleTime()).andReturn(-1L).atLeastOnce();
+ component.addListener(EasyMock.eq(container));
+ EasyMock.replay(component);
+ container.register(component);
+ Foo foo = new Foo();
+ container.persistNew(component, id, foo, System.currentTimeMillis() + 100000);
+ assertEquals(foo, container.getAssociatedInstance(component));
+ assertEquals(foo, container.getAssociatedInstance(component));
+ context.setIdentifier(Scope.CONVERSATION, id2);
+ try {
+ container.getAssociatedInstance(component);
+ fail();
+ } catch (TargetNotFoundException e) {
+ //expected
+ }
+ EasyMock.verify(component);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ context = new WorkContextImpl();
+ StoreMonitor mock = EasyMock.createNiceMock(StoreMonitor.class);
+ EasyMock.replay(mock);
+ Store store = new MemoryStore(mock);
+ container = new ConversationalScopeContainer(store, context, null);
+ container.start();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ context.clearIdentifier(Scope.CONVERSATION);
+ container.stop();
+ }
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeInstanceLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeInstanceLifecycleTestCase.java
new file mode 100644
index 0000000000..782b175b47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeInstanceLifecycleTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.EasyMock;
+
+/**
+ * Lifecycle unit tests for the conversational scope container
+ *
+ * @version $Rev: 451895 $ $Date: 2006-10-02 02:58:18 -0400 (Mon, 02 Oct 2006) $
+ */
+public class ConversationalScopeInstanceLifecycleTestCase extends TestCase {
+
+ public void testInitRemove() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ monitor.start(EasyMock.isA(String.class));
+ monitor.stop(EasyMock.isA(String.class));
+ MemoryStore store = new MemoryStore(monitor);
+ WorkContext ctx = new WorkContextImpl();
+ ConversationalScopeContainer scope = new ConversationalScopeContainer(store, ctx, null);
+ scope.start();
+
+ Foo comp = new Foo();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andReturn(comp);
+ component.init(EasyMock.eq(comp));
+ EasyMock.expect(component.getMaxAge()).andReturn(1L).anyTimes();
+ component.addListener(EasyMock.isA(RuntimeEventListener.class));
+ EasyMock.replay(component);
+ scope.register(component);
+ String convID = "ConvID";
+ ctx.setIdentifier(Scope.CONVERSATION, convID);
+ assertNotNull(scope.getInstance(component));
+ // expire
+ scope.remove(component);
+ scope.stop();
+ EasyMock.verify(component);
+ scope.stop();
+ }
+
+ private class Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeRestartTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeRestartTestCase.java
new file mode 100644
index 0000000000..bc5ddc7c2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ConversationalScopeRestartTestCase.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.ConversationEnd;
+import org.apache.tuscany.core.component.event.ConversationStart;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies the scope container properly disposes resources and can be restarted
+ *
+ * @version $$Rev: 471111 $$ $$Date: 2006-11-03 23:06:48 -0500 (Fri, 03 Nov 2006) $$
+ */
+public class ConversationalScopeRestartTestCase extends TestCase {
+
+ public void testRestart() throws Exception {
+ StoreMonitor monitor = EasyMock.createMock(StoreMonitor.class);
+ monitor.start(EasyMock.isA(String.class));
+ monitor.stop(EasyMock.isA(String.class));
+ MemoryStore store = new MemoryStore(monitor);
+ WorkContext ctx = new WorkContextImpl();
+ ConversationalScopeContainer scope = new ConversationalScopeContainer(store, ctx, null);
+ scope.start();
+ MethodEventInvoker<Object> initInvoker = new MethodEventInvoker<Object>(
+ ConversationalScopeRestartTestCase.InitDestroyOnce.class.getMethod("init"));
+ MethodEventInvoker<Object> destroyInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+ configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+ configuration.setName("InitDestroy");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scope);
+ component.start();
+
+ String conversation = "conv";
+ ctx.setIdentifier(Scope.CONVERSATION, conversation);
+ scope.onEvent(new ConversationStart(this, conversation));
+ Object instance = component.getTargetInstance();
+ assertSame(instance, component.getTargetInstance());
+
+ scope.onEvent(new ConversationEnd(this, conversation));
+ scope.stop();
+ component.stop();
+
+ scope.start();
+ scope.onEvent(new ConversationStart(this, conversation));
+ component.start();
+ //assertNotSame(instance, context.getServiceInstance());
+ scope.onEvent(new ConversationEnd(this, conversation));
+ scope.stop();
+ component.stop();
+ }
+
+ public static class InitDestroyOnce {
+
+ private boolean initialized;
+ private boolean destroyed;
+
+ public InitDestroyOnce() {
+ }
+
+ public void init() {
+ if (!initialized) {
+ initialized = true;
+ } else {
+ fail("Scope did not clean up properly - Init called more than once");
+ }
+ }
+
+ public void destroy() {
+ if (!destroyed) {
+ destroyed = true;
+ } else {
+ fail("Scope did not clean up properly - Destroyed called more than once");
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java
new file mode 100644
index 0000000000..4a2497a725
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/DependencyLifecycleTestCase.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.apache.tuscany.core.mock.component.OrderedDependentPojo;
+import org.apache.tuscany.core.mock.component.OrderedDependentPojoImpl;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+
+/**
+ * Tests dependencies are initalized and destroyed in the proper order (i.e. LIFO)
+ *
+ * @version $Rev$ $Date$
+ */
+public class DependencyLifecycleTestCase extends TestCase {
+
+ public void testInitDestroyOrderCompositeScope() throws Exception {
+ CompositeScopeContainer scopeCtx = new CompositeScopeContainer(null);
+ scopeCtx.start();
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+ OrderedDependentPojoImpl.class,
+ scopeCtx,
+ "target",
+ OrderedInitPojoImpl.class,
+ scopeCtx);
+ for (AtomicComponent component : contexts.values()) {
+ scopeCtx.register(component);
+ }
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ scopeCtx.register(sourceComponent);
+ scopeCtx.register(targetComponent);
+ scopeCtx.onEvent(new CompositeStart(this, null));
+ OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+ OrderedInitPojo target = (OrderedInitPojo) scopeCtx.getInstance(targetComponent);
+ assertNotNull(source.getPojo());
+ assertNotNull(target);
+ assertEquals(2, source.getNumberInstantiated());
+ scopeCtx.onEvent(new CompositeStop(this, null));
+ assertEquals(0, source.getNumberInstantiated());
+ scopeCtx.stop();
+ }
+
+ public void testInitDestroyOrderAfterStartCompositeScope() throws Exception {
+ CompositeScopeContainer scopeCtx = new CompositeScopeContainer(null);
+ scopeCtx.start();
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+ OrderedDependentPojoImpl.class,
+ scopeCtx,
+ "target",
+ OrderedInitPojoImpl.class,
+ scopeCtx);
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ scopeCtx.onEvent(new CompositeStart(this, null));
+ scopeCtx.register(sourceComponent);
+ scopeCtx.register(targetComponent);
+ OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+ OrderedInitPojo target = (OrderedInitPojo) scopeCtx.getInstance(targetComponent);
+ assertNotNull(source.getPojo());
+ assertNotNull(target);
+ assertEquals(2, source.getNumberInstantiated());
+ scopeCtx.onEvent(new CompositeStop(this, null));
+ assertEquals(0, source.getNumberInstantiated());
+ scopeCtx.stop();
+ }
+
+
+ public void testInitDestroyOrderSessionScope() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ HttpSessionScopeContainer scopeCtx = new HttpSessionScopeContainer(ctx, null);
+ scopeCtx.start();
+ Object session = new Object();
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+ OrderedDependentPojoImpl.class,
+ scopeCtx,
+ "target",
+ OrderedInitPojoImpl.class,
+ scopeCtx);
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ scopeCtx.register(sourceComponent);
+ scopeCtx.register(targetComponent);
+ ctx.setIdentifier(Scope.SESSION, session);
+ OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+ assertNotNull(source.getPojo());
+ assertEquals(2, source.getNumberInstantiated());
+ scopeCtx.onEvent(new HttpSessionEnd(this, session));
+ assertEquals(0, source.getNumberInstantiated());
+ scopeCtx.stop();
+ }
+
+
+ public void testInitDestroyOrderAfterStartSessionScope() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ HttpSessionScopeContainer scopeCtx = new HttpSessionScopeContainer(ctx, null);
+ scopeCtx.start();
+ Object session = new Object();
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+ OrderedDependentPojoImpl.class,
+ scopeCtx,
+ "target",
+ OrderedInitPojoImpl.class,
+ scopeCtx);
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ ctx.setIdentifier(Scope.SESSION, session);
+ scopeCtx.register(sourceComponent);
+ scopeCtx.register(targetComponent);
+ OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+ assertNotNull(source.getPojo());
+ assertEquals(2, source.getNumberInstantiated());
+ scopeCtx.onEvent(new HttpSessionEnd(this, session));
+ assertEquals(0, source.getNumberInstantiated());
+ scopeCtx.stop();
+ }
+
+ public void testInitDestroyOrderRequestScope() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ RequestScopeContainer scopeCtx = new RequestScopeContainer(ctx, null);
+ scopeCtx.start();
+ scopeCtx.onEvent(new RequestStart(this));
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
+ OrderedDependentPojoImpl.class,
+ scopeCtx,
+ "target",
+ OrderedInitPojoImpl.class,
+ scopeCtx);
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ scopeCtx.register(sourceComponent);
+ scopeCtx.register(targetComponent);
+ OrderedDependentPojo source = (OrderedDependentPojo) scopeCtx.getInstance(sourceComponent);
+ assertNotNull(source.getPojo());
+ assertEquals(2, source.getNumberInstantiated());
+ scopeCtx.onEvent(new RequestEnd(this));
+ assertEquals(0, source.getNumberInstantiated());
+ scopeCtx.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInitDestroyErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInitDestroyErrorTestCase.java
new file mode 100644
index 0000000000..7aa2f9a120
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInitDestroyErrorTestCase.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.component.scope;
+
+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.WorkContext;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeInitDestroyErrorTestCase extends TestCase {
+
+ public void testDestroyErrorMonitor() throws Exception {
+ ScopeContainerMonitor monitor;
+ monitor = EasyMock.createMock(ScopeContainerMonitor.class);
+ monitor.destructionError(EasyMock.isA(TargetDestructionException.class));
+ EasyMock.replay(monitor);
+ WorkContext workContext = new WorkContextImpl();
+ HttpSessionScopeContainer scope = new HttpSessionScopeContainer(workContext, monitor);
+ scope.start();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.isA(RuntimeEventListener.class));
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.createInstance()).andReturn(new Object());
+ EasyMock.expect(component.isEagerInit()).andReturn(true);
+ component.init(EasyMock.isA(Object.class));
+ component.destroy(EasyMock.isA(Object.class));
+ EasyMock.expectLastCall().andThrow(new TargetDestructionException("", ""));
+ EasyMock.replay(component);
+ scope.register(component);
+ Object id = new Object();
+ scope.onEvent(new HttpSessionStart(this, id));
+ workContext.setIdentifier(Scope.SESSION, id);
+ scope.getInstance(component);
+ scope.onEvent(new HttpSessionEnd(this, id));
+ EasyMock.verify(monitor);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java
new file mode 100644
index 0000000000..29d6d54450
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeInstanceLifecycleTestCase.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * Lifecycle unit tests for the composite scope container
+ *
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeInstanceLifecycleTestCase extends TestCase {
+
+ public void testInitDestroy() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx, null);
+ scope.start();
+ Foo comp = new Foo();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andReturn(comp);
+ component.addListener(EasyMock.isA(RuntimeEventListener.class));
+ component.init(EasyMock.eq(comp));
+ component.destroy(EasyMock.eq(comp));
+ EasyMock.replay(component);
+ scope.register(component);
+ Object session = new Object();
+ ctx.setIdentifier(Scope.SESSION, session);
+ scope.onEvent(new HttpSessionStart(this, session));
+ assertNotNull(scope.getInstance(component));
+ // expire
+ scope.onEvent(new HttpSessionEnd(this, session));
+ scope.stop();
+ EasyMock.verify(component);
+ scope.stop();
+ }
+
+ public void testDestroyOrder() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx, null);
+ scope.start();
+
+ AtomicComponent oneComponent = createComponent();
+ scope.register(oneComponent);
+ AtomicComponent twoComponent = createComponent();
+ scope.register(twoComponent);
+ AtomicComponent threeComponent = createComponent();
+ scope.register(threeComponent);
+
+ Object session = new Object();
+ ctx.setIdentifier(Scope.SESSION, session);
+ scope.onEvent(new HttpSessionStart(this, session));
+ OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneComponent);
+ assertNotNull(one);
+ assertEquals(1, one.getNumberInstantiated());
+ assertEquals(1, one.getInitOrder());
+
+ OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoComponent);
+ assertNotNull(two);
+ assertEquals(2, two.getNumberInstantiated());
+ assertEquals(2, two.getInitOrder());
+
+ OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeComponent);
+ assertNotNull(three);
+ assertEquals(3, three.getNumberInstantiated());
+ assertEquals(3, three.getInitOrder());
+
+ scope.onEvent(new HttpSessionEnd(this, session));
+ assertEquals(0, one.getNumberInstantiated());
+ scope.stop();
+ EasyMock.verify(oneComponent);
+ EasyMock.verify(twoComponent);
+ EasyMock.verify(threeComponent);
+ }
+
+ @SuppressWarnings("unchecked")
+ private AtomicComponent createComponent() throws TargetException {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return new OrderedInitPojoImpl();
+ }
+ });
+ component.addListener(EasyMock.isA(RuntimeEventListener.class));
+ component.init(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.init();
+ return null;
+ }
+ });
+ component.destroy(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.destroy();
+ return null;
+ }
+ });
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java
new file mode 100644
index 0000000000..eff0eb6d3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/HttpSessionScopeRestartTestCase.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Verifies the scope container properly disposes resources and canbe restarted
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class HttpSessionScopeRestartTestCase extends TestCase {
+
+ public void testRestart() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx, null);
+ scope.start();
+ MethodEventInvoker<Object> initInvoker = new MethodEventInvoker<Object>(
+ HttpSessionScopeRestartTestCase.InitDestroyOnce.class.getMethod("init"));
+ MethodEventInvoker<Object> destroyInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+ configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+ configuration.setName("InitDestroy");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scope);
+ component.start();
+
+ Object session = new Object();
+ ctx.setIdentifier(Scope.SESSION, session);
+ scope.onEvent(new HttpSessionStart(this, session));
+ Object instance = component.getTargetInstance();
+ assertSame(instance, component.getTargetInstance());
+
+ scope.onEvent(new HttpSessionEnd(this, session));
+ scope.stop();
+ component.stop();
+
+ scope.start();
+ scope.onEvent(new HttpSessionStart(this, session));
+ component.start();
+ assertNotSame(instance, component.getTargetInstance());
+ scope.onEvent(new HttpSessionEnd(this, session));
+ scope.stop();
+ component.stop();
+ }
+
+ public static class InitDestroyOnce {
+
+ private boolean initialized;
+ private boolean destroyed;
+
+ public InitDestroyOnce() {
+ }
+
+ public void init() {
+ if (!initialized) {
+ initialized = true;
+ } else {
+ fail("Scope did not clean up properly - Init called more than once");
+ }
+ }
+
+ public void destroy() {
+ if (!destroyed) {
+ destroyed = true;
+ } else {
+ fail("Scope did not clean up properly - Destroyed called more than once");
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.java
new file mode 100644
index 0000000000..5600987d8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/InstanceWrapperTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InstanceWrapperTestCase extends TestCase {
+
+ public void testExceptionInit() throws Exception {
+ AtomicComponent component = getComponent();
+ InstanceWrapper wrapper = new InstanceWrapperImpl(component, new Object());
+ try {
+ wrapper.start();
+ fail();
+ } catch (SomeException e) {
+ // expected
+ }
+ assertFalse(wrapper.isStarted());
+ EasyMock.verify(component);
+ }
+
+ public void testNonStart() throws Exception {
+ AtomicComponent comp = EasyMock.createNiceMock(AtomicComponent.class); // class-level one has an expects
+ InstanceWrapper wrapper = new InstanceWrapperImpl(comp, new Object());
+ try {
+ wrapper.getInstance();
+ fail();
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ }
+
+ private AtomicComponent getComponent() throws Exception {
+ // do not use setUp() since we do not need this in all testcases
+ AtomicComponent comp = EasyMock.createMock(AtomicComponent.class);
+ comp.init(EasyMock.isA(Object.class));
+ EasyMock.expectLastCall().andThrow(new SomeException());
+ EasyMock.replay(comp);
+ return comp;
+ }
+
+ private class SomeException extends RuntimeException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/MockFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/MockFactory.java
new file mode 100644
index 0000000000..db947e0d66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/MockFactory.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public final class MockFactory {
+
+ private MockFactory() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, AtomicComponent> createWiredComponents(String source,
+ Class<?> sourceClass,
+ ScopeContainer sourceScopeContainer,
+ String target,
+ Class<?> targetClass,
+ ScopeContainer targetScopeContainer)
+ throws NoSuchMethodException {
+
+ Map<String, AtomicComponent> components = new HashMap<String, AtomicComponent>();
+ AtomicComponent targetComponent = createAtomicComponent(target, targetScopeContainer, targetClass);
+ PojoConfiguration sourceConfig = new PojoConfiguration();
+ sourceConfig.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
+
+ //create target wire
+ Method[] sourceMethods = sourceClass.getMethods();
+ Class[] interfaces = targetClass.getInterfaces();
+ EagerInit eager = targetClass.getAnnotation(EagerInit.class);
+ if (eager != null) {
+ sourceConfig.setInitLevel(50);
+ }
+
+ Method setter = null;
+ for (Class interfaze : interfaces) {
+
+ for (Method method : sourceMethods) {
+ if (method.getParameterTypes().length == 1) {
+ if (interfaze.isAssignableFrom(method.getParameterTypes()[0])) {
+ setter = method;
+ }
+ }
+ if (method.getAnnotation(Init.class) != null) {
+ sourceConfig.setInitInvoker(new MethodEventInvoker<Object>(method));
+
+ } else if (method.getAnnotation(Destroy.class) != null) {
+ sourceConfig.setDestroyInvoker(new MethodEventInvoker<Object>(method));
+ }
+ }
+
+ }
+ if (setter == null) {
+ throw new IllegalArgumentException("No setter found on source for target");
+ }
+
+ sourceConfig.addReferenceSite(setter.getName(), setter);
+ sourceConfig.setName(source);
+ AtomicComponent sourceComponent = new SystemAtomicComponentImpl(sourceConfig);
+ sourceComponent.setScopeContainer(sourceScopeContainer);
+ QualifiedName targetName = new QualifiedName(target);
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setReferenceName(setter.getName());
+ wire.setServiceContract(new JavaServiceContract(targetClass));
+ InboundWire inboundWire = new InboundWireImpl();
+ inboundWire.setContainer(targetComponent);
+ inboundWire.setServiceContract(new JavaServiceContract(targetClass));
+ inboundWire.setServiceName(targetName.getPortName());
+ wire.setTargetWire(inboundWire);
+ sourceComponent.addOutboundWire(wire);
+ components.put(source, sourceComponent);
+ components.put(target, targetComponent);
+ return components;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static AtomicComponent createAtomicComponent(String name, ScopeContainer container, Class<?> clazz)
+ throws NoSuchMethodException {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(clazz.getConstructor()));
+ EagerInit eager = clazz.getAnnotation(EagerInit.class);
+ if (eager != null) {
+ configuration.setInitLevel(50);
+ }
+ Method[] methods = clazz.getMethods();
+ for (Method method : methods) {
+ if (method.getAnnotation(Init.class) != null) {
+ configuration.setInitInvoker(new MethodEventInvoker<Object>(method));
+ } else if (method.getAnnotation(Destroy.class) != null) {
+ configuration.setDestroyInvoker(new MethodEventInvoker<Object>(method));
+ }
+ }
+ configuration.setName(name);
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(container);
+ return component;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInitDestroyErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInitDestroyErrorTestCase.java
new file mode 100644
index 0000000000..3f562c9b61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInitDestroyErrorTestCase.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.ScopeContainerMonitor;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeInitDestroyErrorTestCase extends TestCase {
+
+ public void testDestroyErrorMonitor() throws Exception {
+ ScopeContainerMonitor monitor;
+ monitor = EasyMock.createMock(ScopeContainerMonitor.class);
+ monitor.destructionError(EasyMock.isA(TargetDestructionException.class));
+ EasyMock.replay(monitor);
+ RequestScopeContainer scope = new RequestScopeContainer(new WorkContextImpl(), monitor);
+ scope.start();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addListener(EasyMock.isA(RuntimeEventListener.class));
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.createInstance()).andReturn(new Object());
+ component.init(EasyMock.isA(Object.class));
+ component.destroy(EasyMock.isA(Object.class));
+ EasyMock.expectLastCall().andThrow(new TargetDestructionException("", ""));
+ EasyMock.replay(component);
+ scope.register(component);
+ scope.onEvent(new RequestStart(this));
+ scope.getInstance(component);
+ scope.onEvent(new RequestEnd(this));
+ EasyMock.verify(monitor);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInstanceLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInstanceLifecycleTestCase.java
new file mode 100644
index 0000000000..6601640c3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeInstanceLifecycleTestCase.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.component.scope;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.apache.tuscany.core.mock.component.OrderedInitPojo;
+import org.apache.tuscany.core.mock.component.OrderedInitPojoImpl;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * Lifecycle unit tests for the request scope container
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeInstanceLifecycleTestCase extends TestCase {
+
+ public void testInitDestroy() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ RequestScopeContainer scope = new RequestScopeContainer(ctx, null);
+ scope.start();
+ Foo comp = new Foo();
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andReturn(comp);
+ component.init(EasyMock.eq(comp));
+ component.destroy(EasyMock.eq(comp));
+ EasyMock.replay(component);
+ scope.register(component);
+ scope.onEvent(new RequestStart(this));
+ assertNotNull(scope.getInstance(component));
+ // expire
+ scope.onEvent(new RequestEnd(this));
+ scope.stop();
+ EasyMock.verify(component);
+ scope.stop();
+ }
+
+ public void testDestroyOrder() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ RequestScopeContainer scope = new RequestScopeContainer(ctx, null);
+ scope.start();
+
+ AtomicComponent oneComponent = createComponent();
+ scope.register(oneComponent);
+ AtomicComponent twoComponent = createComponent();
+ scope.register(twoComponent);
+ AtomicComponent threeComponent = createComponent();
+ scope.register(threeComponent);
+
+ scope.onEvent(new RequestStart(this));
+ OrderedInitPojo one = (OrderedInitPojo) scope.getInstance(oneComponent);
+ assertNotNull(one);
+ assertEquals(1, one.getNumberInstantiated());
+ assertEquals(1, one.getInitOrder());
+
+ OrderedInitPojo two = (OrderedInitPojo) scope.getInstance(twoComponent);
+ assertNotNull(two);
+ assertEquals(2, two.getNumberInstantiated());
+ assertEquals(2, two.getInitOrder());
+
+ OrderedInitPojo three = (OrderedInitPojo) scope.getInstance(threeComponent);
+ assertNotNull(three);
+ assertEquals(3, three.getNumberInstantiated());
+ assertEquals(3, three.getInitOrder());
+
+ scope.onEvent(new RequestEnd(this));
+ assertEquals(0, one.getNumberInstantiated());
+ scope.stop();
+ EasyMock.verify(oneComponent);
+ EasyMock.verify(twoComponent);
+ EasyMock.verify(threeComponent);
+ }
+
+ @SuppressWarnings("unchecked")
+ private AtomicComponent createComponent() throws TargetException {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.createInstance()).andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return new OrderedInitPojoImpl();
+ }
+ });
+ component.init(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.init();
+ return null;
+ }
+ });
+ component.destroy(EasyMock.isA(OrderedInitPojoImpl.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ OrderedInitPojoImpl pojo = (OrderedInitPojoImpl) EasyMock.getCurrentArguments()[0];
+ pojo.destroy();
+ return null;
+ }
+ });
+ EasyMock.replay(component);
+ return component;
+ }
+
+ private class Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeRestartTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeRestartTestCase.java
new file mode 100644
index 0000000000..335d8c621d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/RequestScopeRestartTestCase.java
@@ -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.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.system.component.SystemAtomicComponentImpl;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+
+/**
+ * Verifies the scope container properly disposes resources and canbe restarted
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RequestScopeRestartTestCase extends TestCase {
+
+ public void testRestart() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ RequestScopeContainer scope = new RequestScopeContainer(ctx, null);
+ scope.start();
+ MethodEventInvoker<Object> initInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("init"));
+ MethodEventInvoker<Object> destroyInvoker =
+ new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("destroy"));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInitInvoker(initInvoker);
+ configuration.setDestroyInvoker(destroyInvoker);
+ Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
+ configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
+ configuration.setName("InitDestroy");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scope);
+ component.start();
+
+ Object instance = component.getTargetInstance();
+ assertSame(instance, component.getTargetInstance());
+
+ scope.onEvent(new RequestEnd(this));
+ scope.stop();
+ component.stop();
+
+ scope.start();
+ component.start();
+ assertNotSame(instance, component.getTargetInstance());
+ scope.onEvent(new RequestEnd(this));
+ scope.stop();
+ component.stop();
+ }
+
+ public static class InitDestroyOnce {
+
+ private boolean initialized;
+ private boolean destroyed;
+
+ public InitDestroyOnce() {
+ }
+
+ public void init() {
+ if (!initialized) {
+ initialized = true;
+ } else {
+ fail("Scope did not clean up properly - Init called more than once");
+ }
+ }
+
+ public void destroy() {
+ if (!destroyed) {
+ destroyed = true;
+ } else {
+ fail("Scope did not clean up properly - Destroyed called more than once");
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ScopeRegistryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ScopeRegistryTestCase.java
new file mode 100644
index 0000000000..e1380eb4c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/ScopeRegistryTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.component.scope;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+
+/**
+ * Verifies retrieval of standard scope contexts from the default scope registry
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ScopeRegistryTestCase extends TestCase {
+ public void testScopeContextCreation() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ scopeRegistry.registerFactory(Scope.REQUEST, new RequestScopeObjectFactory(context, null));
+ HttpSessionScopeObjectFactory sessionFactory = new HttpSessionScopeObjectFactory(scopeRegistry, context, null);
+ scopeRegistry.registerFactory(Scope.SESSION, sessionFactory);
+ scopeRegistry.registerFactory(Scope.CONVERSATION,
+ new ConversationalScopeObjectFactory(scopeRegistry, context, null, null));
+ ScopeContainer request = scopeRegistry.getScopeContainer(Scope.REQUEST);
+ assertTrue(request instanceof RequestScopeContainer);
+ assertSame(request, scopeRegistry.getScopeContainer(Scope.REQUEST));
+ ScopeContainer session = scopeRegistry.getScopeContainer(Scope.SESSION);
+ assertTrue(session instanceof HttpSessionScopeContainer);
+ assertSame(session, scopeRegistry.getScopeContainer(Scope.SESSION));
+ assertNotSame(request, session);
+ ScopeContainer conversation = scopeRegistry.getScopeContainer(Scope.CONVERSATION);
+ assertTrue(conversation instanceof ConversationalScopeContainer);
+ assertSame(conversation, scopeRegistry.getScopeContainer(Scope.CONVERSATION));
+ assertNotSame(session, conversation);
+ }
+
+ public void testDeregisterFactory() throws Exception {
+ WorkContext context = new WorkContextImpl();
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ RequestScopeObjectFactory factory = new RequestScopeObjectFactory(context, null);
+ scopeRegistry.registerFactory(Scope.REQUEST, factory);
+ scopeRegistry.deregisterFactory(Scope.REQUEST);
+ assertNull(scopeRegistry.getScopeContainer(Scope.REQUEST));
+ ConversationalScopeObjectFactory convFactory =
+ new ConversationalScopeObjectFactory(scopeRegistry, context, null, null);
+ scopeRegistry.registerFactory(Scope.CONVERSATION, convFactory);
+ scopeRegistry.deregisterFactory(Scope.CONVERSATION);
+ assertNull(scopeRegistry.getScopeContainer(Scope.CONVERSATION));
+ }
+
+ public void testScopeNotRegistered() throws Exception {
+ WorkContext workContext = new WorkContextImpl();
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ assertNull(scopeRegistry.getScopeContainer(Scope.REQUEST));
+ assertNull(scopeRegistry.getScopeContainer(Scope.SESSION));
+ assertNull(scopeRegistry.getScopeContainer(Scope.CONVERSATION));
+ assertNull(scopeRegistry.getScopeContainer(Scope.STATELESS));
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeContainerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeContainerTestCase.java
new file mode 100644
index 0000000000..89cd9b51d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeContainerTestCase.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.core.component.scope;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeContainerTestCase extends TestCase {
+
+ public void testBadStopWithoutStart() throws Exception {
+ StatelessScopeContainer container = new StatelessScopeContainer(null, null);
+ try {
+ container.stop();
+ fail();
+ } catch (IllegalStateException e) {
+ //expected
+ }
+ }
+
+ public void testBadDoubleStart() throws Exception {
+ StatelessScopeContainer container = new StatelessScopeContainer(null, null);
+ try {
+ container.start();
+ container.start();
+ fail();
+ } catch (IllegalStateException e) {
+ //expected
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactoryTestCase.java
new file mode 100644
index 0000000000..0902b9d78c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/StatelessScopeObjectFactoryTestCase.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.scope;
+
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeObjectFactoryTestCase extends TestCase {
+
+ public void testCreation() {
+ ScopeRegistry registry = EasyMock.createMock(ScopeRegistry.class);
+ registry.registerFactory(EasyMock.isA(Scope.class), EasyMock.isA(StatelessScopeObjectFactory.class));
+ assertNotNull(new StatelessScopeObjectFactory(registry, null, null).getInstance());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java
new file mode 100644
index 0000000000..8a9fdf4ac4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/component/scope/WorkContextTestCase.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkContextTestCase extends TestCase {
+
+ public void testRemoteComponent() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ CompositeComponent component = EasyMock.createNiceMock(CompositeComponent.class);
+ CompositeComponent component2 = EasyMock.createNiceMock(CompositeComponent.class);
+ ctx.setRemoteComponent(component);
+ assertEquals(component, ctx.getRemoteComponent());
+ ctx.setRemoteComponent(component2);
+ assertEquals(component2, ctx.getRemoteComponent());
+ }
+
+ public void testNonSetRemoteComponent() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ assertNull(ctx.getRemoteComponent());
+ }
+
+ public void testSetCurrentAtomicComponent() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ AtomicComponent component2 = EasyMock.createNiceMock(AtomicComponent.class);
+ ctx.setCurrentAtomicComponent(component);
+ assertEquals(component, ctx.getCurrentAtomicComponent());
+ ctx.setCurrentAtomicComponent(component2);
+ assertEquals(component2, ctx.getCurrentAtomicComponent());
+ }
+
+ public void testNonSetCurrentAtomicComponent() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ assertNull(ctx.getCurrentAtomicComponent());
+ }
+
+ public void testIndentifier() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ Object id = new Object();
+ ctx.setIdentifier(this, id);
+ assertEquals(id, ctx.getIdentifier(this));
+ }
+
+ public void testClearIndentifier() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ Object id = new Object();
+ ctx.setIdentifier(this, id);
+ ctx.clearIdentifier(this);
+ assertNull(ctx.getIdentifier(this));
+ }
+
+ public void testClearIndentifiers() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ Object id = new Object();
+ Object id2 = new Object();
+ ctx.setIdentifier(id, id);
+ ctx.setIdentifier(id2, id2);
+ ctx.clearIdentifiers();
+ assertNull(ctx.getIdentifier(id));
+ assertNull(ctx.getIdentifier(id2));
+ }
+
+ public void testClearNonExistentIndentifier() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ctx.clearIdentifier(this);
+ }
+
+ public void testNullIndentifier() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ Object id = new Object();
+ ctx.setIdentifier(this, id);
+ ctx.clearIdentifier(null);
+ assertEquals(id, ctx.getIdentifier(this));
+ }
+
+ public void testNoIndentifier() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ assertNull(ctx.getIdentifier(this));
+ }
+
+ public void testSetGetCorrelationId() {
+ WorkContext context = new WorkContextImpl();
+ context.setCurrentCorrelationId("msg-005");
+ assertEquals(context.getCurrentCorrelationId(), "msg-005");
+ context.setCurrentCorrelationId(null);
+ assertNull(context.getCurrentCorrelationId());
+ }
+
+ public void testSetGetCorrelationIdInNewThread() throws InterruptedException {
+ WorkContext context = new WorkContextImpl();
+ context.setCurrentCorrelationId("msg-005");
+ assertEquals(context.getCurrentCorrelationId(), "msg-005");
+ context.setIdentifier("TX", "002");
+ ChildThread t = new ChildThread(context);
+ t.start();
+ t.join();
+ assertTrue(t.passed);
+ context.setCurrentCorrelationId(null);
+ assertNull(context.getCurrentCorrelationId());
+ }
+
+ public void testCurrentAtomicComponentDoesNotPropagateToChildThread() throws InterruptedException {
+ // NOTE should behaviour be to propagate?
+ WorkContext context = new WorkContextImpl();
+ context.setCurrentAtomicComponent(EasyMock.createNiceMock(AtomicComponent.class));
+ TestCurrentAtomicComponentChildThread t = new TestCurrentAtomicComponentChildThread(context);
+ t.start();
+ t.join();
+ assertTrue(t.passed);
+ context.setCurrentAtomicComponent(null);
+ assertNull(context.getCurrentAtomicComponent());
+ }
+
+ public void testCurrentRemoteComponentDoesNotPropagateToChildThread() throws InterruptedException {
+ // NOTE should behaviour be to propagate?
+ WorkContext context = new WorkContextImpl();
+ context.setRemoteComponent(EasyMock.createNiceMock(CompositeComponent.class));
+ TestCurrentRemoteComponentChildThread t = new TestCurrentRemoteComponentChildThread(context);
+ t.start();
+ t.join();
+ assertTrue(t.passed);
+ context.setRemoteComponent(null);
+ assertNull(context.getRemoteComponent());
+ }
+
+ private static final class ChildThread extends Thread {
+ private WorkContext context;
+ private boolean passed = true;
+
+ private ChildThread(WorkContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public void run() {
+ try {
+ assertNull(context.getCurrentCorrelationId());
+ assertEquals("002", context.getIdentifier("TX"));
+ } catch (AssertionError e) {
+ passed = false;
+ }
+ }
+
+ }
+
+ private static final class TestCurrentAtomicComponentChildThread extends Thread {
+ private WorkContext context;
+ private boolean passed = true;
+
+ private TestCurrentAtomicComponentChildThread(WorkContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public void run() {
+ try {
+ assertNull(context.getCurrentAtomicComponent());
+ } catch (AssertionError e) {
+ passed = false;
+ }
+ }
+
+ }
+
+ private static final class TestCurrentRemoteComponentChildThread extends Thread {
+ private WorkContext context;
+ private boolean passed = true;
+
+ private TestCurrentRemoteComponentChildThread(WorkContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public void run() {
+ try {
+ assertNull(context.getRemoteComponent());
+ } catch (AssertionError e) {
+ passed = false;
+ }
+ }
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingInterceptorTestCase.java
new file mode 100644
index 0000000000..ddfb75568d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingInterceptorTestCase.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 java.util.Map;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.databinding.Mediator;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingInterceptorTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public final void testInvoke() {
+ DataType<Class> type1 = new DataType<Class>("xml:string", String.class, String.class);
+ List<DataType<Class>> types1 = new ArrayList<DataType<Class>>();
+ types1.add(type1);
+ DataType<List<DataType<Class>>> inputType1 =
+ new DataType<List<DataType<Class>>>("xml:string", Object[].class, types1);
+
+ DataType<Class> type2 = new DataType<Class>("foo", Foo.class, Foo.class);
+ List<DataType<Class>> types2 = new ArrayList<DataType<Class>>();
+ types2.add(type2);
+ DataType<List<DataType<Class>>> inputType2 =
+ new DataType<List<DataType<Class>>>("foo", Object[].class, types2);
+
+ Operation<Class> operation1 =
+ new Operation<Class>("call", inputType1, type1, null, false, "xml:string", NO_CONVERSATION);
+ Operation<Class> operation2 =
+ new Operation<Class>("call", inputType2, type2, null, false, "org.w3c.dom.Node", NO_CONVERSATION);
+
+ DataType<DataType> outputType1 =
+ new DataType<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation1.getOutputType());
+ DataType<DataType> outputType2 =
+ new DataType<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation2.getOutputType());
+
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
+ CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
+ Component component = EasyMock.createMock(Component.class);
+ EasyMock.expect(component.getParent()).andReturn(composite).once();
+ EasyMock.expect(outboundWire.getContainer()).andReturn(component);
+ EasyMock.replay(outboundWire, inboundWire, composite, component);
+
+ DataBindingInteceptor interceptor = new DataBindingInteceptor(outboundWire, operation1, operation2);
+ Mediator mediator = createMock(Mediator.class);
+ Object[] source = new Object[]{"<foo>bar</foo>"};
+ Foo foo = new Foo();
+ foo.bar = "bar";
+ Object[] target = new Object[]{foo};
+ expect(mediator.mediate(EasyMock.same(source),
+ EasyMock.same(inputType1),
+ EasyMock.same(inputType2),
+ EasyMock.isA(Map.class))).andReturn(target);
+ // expect(mediator.mediate(target[0], type2,
+ // type1)).andReturn(source[0]);
+ expect(mediator.mediate(EasyMock.same(target[0]),
+ EasyMock.eq(outputType2),
+ EasyMock.eq(outputType1),
+ EasyMock.isA(Map.class))).andReturn(source[0]);
+ replay(mediator);
+ interceptor.setMediator(mediator);
+ Message msg = createMock(Message.class);
+ msg.setBody(EasyMock.anyObject());
+ expectLastCall().anyTimes();
+ expect(msg.getBody()).andReturn(source).once().andReturn(target[0]).once().andReturn(source[0]);
+ expect(msg.isFault()).andReturn(false).once();
+ replay(msg);
+ Interceptor next = createMock(Interceptor.class);
+ expect(next.invoke(msg)).andReturn(msg);
+ replay(next);
+ interceptor.setNext(next);
+ interceptor.invoke(msg);
+ String result = (String) msg.getBody();
+ Assert.assertEquals(source[0], result);
+ EasyMock.verify(mediator, msg, next);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ private static class Foo {
+ private String bar;
+
+ public String getBar() {
+ return bar;
+ }
+
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..9e181960b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.core.databinding.impl;
+
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingJavaInterfaceProcessorTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @throws InvalidServiceContractException
+ */
+ public final void testVisitInterface() throws InvalidServiceContractException {
+ DataBindingRegistry registry = new DataBindingRegistryImpl();
+ DataBindingJavaInterfaceProcessor processor = new DataBindingJavaInterfaceProcessor(registry);
+ JavaServiceContract contract = new JavaServiceContract(MockInterface.class);
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ Operation<Type> operation = new Operation<Type>("call", null, null, null, false, null, NO_CONVERSATION);
+ Operation<Type> operation1 = new Operation<Type>("call1", null, null, null, false, null, NO_CONVERSATION);
+ operations.put("call", operation);
+ operations.put("call1", operation1);
+ contract.setOperations(operations);
+ contract.setRemotable(true);
+ processor.visitInterface(MockInterface.class, null, contract);
+ Assert.assertEquals("org.w3c.dom.Node", contract.getDataBinding());
+ Assert.assertEquals("org.w3c.dom.Node", contract.getOperations().get("call").getDataBinding());
+ Assert.assertEquals("xml:string", contract.getOperations().get("call1").getDataBinding());
+ }
+
+ @DataType(name = "org.w3c.dom.Node")
+ @Remotable
+ public static interface MockInterface {
+ Node call(Node msg);
+
+ @DataType(name = "xml:string")
+ String call1(String msg);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingLoaderTestCase.java
new file mode 100644
index 0000000000..02dd10ee97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingLoaderTestCase.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.core.databinding.impl;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.loader.InvalidValueException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.easymock.EasyMock;
+
+/**
+ * Testcase for DataBindingLoader
+ */
+public class DataBindingLoaderTestCase extends TestCase {
+ private XMLStreamReader reader;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public final void testLoad() throws LoaderException, XMLStreamException {
+ reader = EasyMock.createMock(XMLStreamReader.class);
+ // EasyMock.expect(reader.getEventType()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.hasNext()).andReturn(true).anyTimes();
+ EasyMock.expect(reader.getName()).andReturn(DataTypeLoader.DATA_BINDING);
+ EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("ABC");
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+
+ ModelObject mo = new DataTypeLoader(null).load(null, null, reader, null);
+ Assert.assertTrue(mo instanceof DataType);
+ Assert.assertEquals("ABC", ((DataType<?>)mo).getDataBinding());
+ EasyMock.verify(reader);
+
+ EasyMock.reset(reader);
+
+ // EasyMock.expect(reader.getEventType()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.hasNext()).andReturn(true).anyTimes();
+ EasyMock.expect(reader.getName()).andReturn(DataTypeLoader.DATA_BINDING);
+ EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn(null);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ try {
+ mo = new DataTypeLoader(null).load(null, null, reader, null);
+ Assert.fail("InvalidValueException should have been thrown");
+ } catch (InvalidValueException e) {
+ Assert.assertTrue(true);
+ }
+ EasyMock.verify(reader);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImplTestCase.java
new file mode 100644
index 0000000000..3ee5460ac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingRegistryImplTestCase.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.core.databinding.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.easymock.EasyMock;
+import org.xml.sax.ContentHandler;
+
+/**
+ *
+ */
+public class DataBindingRegistryImplTestCase extends TestCase {
+ private DataBindingRegistry registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DataBindingRegistryImpl();
+ }
+
+ public void testRegistry() {
+ DataBinding db1 = createMock(DataBinding.class);
+ expect(db1.getAliases()).andReturn(new String[] {"db1"}).anyTimes();
+ expect(db1.getName()).andReturn(ContentHandler.class.getName()).anyTimes();
+ DataType<Class> dataType1 = new DataType<Class>(ContentHandler.class, ContentHandler.class);
+ expect(db1.introspect(dataType1, null)).andReturn(true);
+ expect(db1.introspect(EasyMock.not(EasyMock.same(dataType1)), (Annotation[])EasyMock.isNull()))
+ .andReturn(false).anyTimes();
+ replay(db1);
+
+ registry.register(db1);
+
+ DataBinding db2 = createMock(DataBinding.class);
+ expect(db2.getAliases()).andReturn(new String[] {"db2"}).anyTimes();
+ expect(db2.getName()).andReturn(XMLStreamReader.class.getName()).anyTimes();
+ DataType<Class> dataType2 = new DataType<Class>(XMLStreamReader.class, XMLStreamReader.class);
+ expect(db2.introspect(dataType2, null)).andReturn(true);
+ expect(db2.introspect(EasyMock.not(EasyMock.same(dataType2)), (Annotation[])EasyMock.isNull()))
+ .andReturn(false).anyTimes();
+ replay(db2);
+
+ registry.register(db2);
+
+ // Lookup by name
+ String name = db1.getName();
+ DataBinding db3 = registry.getDataBinding(name);
+ assertSame(db1, db3);
+
+ // Look up by alias
+ DataBinding db5 = registry.getDataBinding("db1");
+ assertSame(db1, db5);
+
+ DataType dt = new DataType(ContentHandler.class, null);
+ registry.introspectType(dt, null);
+ assertEquals(dataType1.getLogical(), ContentHandler.class);
+ assertTrue(dt.getDataBinding().equalsIgnoreCase("java.lang.Object"));
+
+ registry.unregister(name);
+ DataBinding db4 = registry.getDataBinding(name);
+ assertNull(db4);
+
+ dt = new DataType(null, String.class, null);
+ registry.introspectType(dt, null);
+ assertEquals("java.lang.Object", dt.getDataBinding());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingTestCase.java
new file mode 100644
index 0000000000..5abb520b80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingTestCase.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.databinding.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.annotation.DataType;
+
+public class DataBindingTestCase extends TestCase {
+ @SuppressWarnings("unused")
+ public void testDataType() throws Exception {
+ Class<Test> testClass = Test.class;
+ DataType d = testClass.getAnnotation(DataType.class);
+ Assert.assertEquals(d.name(), "sdo");
+
+ Method method = testClass.getMethod("test", new Class[] {Object.class});
+ DataType d2 = method.getAnnotation(DataType.class);
+ Assert.assertEquals(d2.name(), "jaxb");
+ }
+
+ @DataType(name = "sdo")
+ private static interface Test {
+ @DataType(name = "jaxb")
+ Object test(Object object);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorOptimizationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorOptimizationTestCase.java
new file mode 100644
index 0000000000..d871978cb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorOptimizationTestCase.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.core.databinding.impl;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.databinding.Mediator;
+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.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies that data binding interceptor is not added to invocation chains when the data binding types are not set on
+ * service contracts
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingWirePostProcessorOptimizationTestCase extends TestCase {
+ private DataBindingWirePostProcessor processor;
+ private OutboundInvocationChain outboundChain;
+ private OutboundWire outboundWire;
+ private InboundInvocationChain inboundChain;
+ private InboundWire inboundWire;
+
+ public void testNoInterceptorInterposedOutboundToInbound() {
+ processor.process(outboundWire, inboundWire);
+ EasyMock.verify(outboundChain);
+ EasyMock.verify(inboundChain);
+ EasyMock.verify(outboundWire);
+ EasyMock.verify(inboundWire);
+ }
+
+ public void testNoInterceptorInterposedInboundToOutbound() {
+ processor.process(inboundWire, outboundWire);
+ EasyMock.verify(outboundChain);
+ EasyMock.verify(inboundChain);
+ EasyMock.verify(outboundWire);
+ EasyMock.verify(inboundWire);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ SCAObject container = EasyMock.createMock(SCAObject.class);
+ EasyMock.expect(container.getName()).andReturn("foo");
+ EasyMock.replay(container);
+
+ Mediator mediator = new MediatorImpl();
+ processor = new DataBindingWirePostProcessor(mediator);
+
+ ServiceContract<Type> contract = new JavaServiceContract(null);
+ Operation<Type> operation = new Operation<Type>("test", null, null, null);
+ operation.setServiceContract(contract);
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ operations.put("test", operation);
+ contract.setOperations(operations);
+ contract.setCallbackOperations(operations);
+
+ inboundChain = EasyMock.createMock(InboundInvocationChain.class);
+ EasyMock.replay(inboundChain);
+ Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
+ inboundChains.put(operation, inboundChain);
+
+ outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.replay(outboundChain);
+ Map<Operation<?>, OutboundInvocationChain> outboundChains =
+ new HashMap<Operation<?>, OutboundInvocationChain>();
+ outboundChains.put(operation, outboundChain);
+
+ outboundWire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains);
+ EasyMock.expect(outboundWire.getServiceContract()).andReturn(contract).anyTimes();
+ EasyMock.expect(outboundWire.getContainer()).andReturn(container).anyTimes();
+ EasyMock.expect(outboundWire.getTargetCallbackInvocationChains()).andReturn(inboundChains).anyTimes();
+ EasyMock.replay(outboundWire);
+
+ inboundWire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(inboundWire.getInvocationChains()).andReturn(inboundChains);
+ EasyMock.expect(inboundWire.getContainer()).andReturn(container).anyTimes();
+ EasyMock.expect(inboundWire.getSourceCallbackInvocationChains(EasyMock.eq("foo"))).andReturn(outboundChains)
+ .anyTimes();
+ EasyMock.replay(inboundWire);
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java
new file mode 100644
index 0000000000..29bf91f2c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.w3c.dom.Node;
+
+import org.apache.tuscany.spi.component.Component;
+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.databinding.Mediator;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+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 junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingWirePostProcessorTestCase extends TestCase {
+ private DataBindingWirePostProcessor processor;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ Mediator mediator = new MediatorImpl();
+ this.processor = new DataBindingWirePostProcessor(mediator);
+ }
+
+ public void testProcess1() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ Component component = createMock(Component.class);
+ CompositeComponent composite = createMock(CompositeComponent.class);
+ expect(component.getParent()).andReturn(composite);
+ expect(inboundWire.getContainer()).andReturn(component);
+ expect(outboundWire.getContainer()).andReturn(component);
+
+ Map<Operation<?>, OutboundInvocationChain> outboundChains =
+ new HashMap<Operation<?>, OutboundInvocationChain>();
+ DataType<Type> type1 = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ types.add(type1);
+ DataType<List<DataType<Type>>> inputType1 = new DataType<List<DataType<Type>>>(Object[].class, types);
+ DataType<Type> outputType1 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op1 = new Operation<Type>("test", inputType1, outputType1, null);
+ ServiceContract<Type> outboundContract = new JavaServiceContract(null);
+ outboundContract.setDataBinding(String.class.getName());
+ op1.setServiceContract(outboundContract);
+
+ OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
+ outboundChains.put(op1, outboundChain);
+ expect(outboundWire.getInvocationChains()).andReturn(outboundChains);
+ outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+
+ Map<Operation<?>, InboundInvocationChain> inboundChains =
+ new HashMap<Operation<?>, InboundInvocationChain>();
+ DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
+ List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
+ types2.add(type2);
+ DataType<List<DataType<Type>>> inputType2 =
+ new DataType<List<DataType<Type>>>(Object[].class, types2);
+ DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
+ ServiceContract<Type> inboundContract = new JavaServiceContract(null);
+ inboundContract.setDataBinding(Node.class.getName());
+ op2.setServiceContract(inboundContract);
+
+ InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
+ inboundChains.put(op2, inboundChain);
+ expect(inboundWire.getInvocationChains()).andReturn(inboundChains);
+
+ ServiceContract<Type> contract = new JavaServiceContract();
+ Map<String, Operation<Type>> operations = Collections.emptyMap();
+ contract.setCallbackOperations(operations);
+ expect(outboundWire.getServiceContract()).andReturn(contract);
+
+ EasyMock.replay(composite, component, inboundWire, outboundWire, inboundChain, outboundChain);
+
+ processor.process(outboundWire, inboundWire);
+ }
+
+ public void testProcess2() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ReferenceBinding referenceBinding = createMock(ReferenceBinding.class);
+ CompositeComponent composite = createMock(CompositeComponent.class);
+ expect(referenceBinding.getParent()).andReturn(composite);
+ expect(inboundWire.getContainer()).andReturn(referenceBinding).anyTimes();
+ expect(outboundWire.getContainer()).andReturn(referenceBinding).anyTimes();
+
+ Map<Operation<?>, OutboundInvocationChain> outboundChains =
+ new HashMap<Operation<?>, OutboundInvocationChain>();
+ DataType<Type> type1 = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ types.add(type1);
+ DataType<List<DataType<Type>>> inputType1 = new DataType<List<DataType<Type>>>(Object[].class, types);
+ DataType<Type> outputType1 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op1 = new Operation<Type>("test", inputType1, outputType1, null);
+ ServiceContract<Type> outboundContract = new JavaServiceContract(null);
+ outboundContract.setDataBinding(String.class.getName());
+ op1.setServiceContract(outboundContract);
+
+ OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
+ outboundChains.put(op1, outboundChain);
+ expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
+ outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+
+ Map<Operation<?>, InboundInvocationChain> inboundChains =
+ new HashMap<Operation<?>, InboundInvocationChain>();
+ DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
+ List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
+ types2.add(type2);
+ DataType<List<DataType<Type>>> inputType2 =
+ new DataType<List<DataType<Type>>>(Object[].class, types2);
+ DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
+ ServiceContract<Type> inboundContract = new JavaServiceContract(null);
+ inboundContract.setDataBinding(Node.class.getName());
+ op2.setServiceContract(inboundContract);
+
+ InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
+ inboundChains.put(op2, inboundChain);
+ expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
+
+ ServiceContract<Type> contract = new JavaServiceContract();
+ Map<String, Operation<Type>> operations = Collections.emptyMap();
+ contract.setCallbackOperations(operations);
+ expect(inboundWire.getServiceContract()).andReturn(contract);
+ expect(inboundChain.getTailInterceptor()).andReturn(null);
+
+ EasyMock.replay(composite, referenceBinding, inboundWire, outboundWire, inboundChain, outboundChain);
+
+ processor.process(inboundWire, outboundWire);
+ }
+
+ public void testProcess3() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ServiceBinding serviceBinding = createMock(ServiceBinding.class);
+ CompositeComponent composite = createMock(CompositeComponent.class);
+ expect(serviceBinding.getParent()).andReturn(composite);
+ expect(inboundWire.getContainer()).andReturn(serviceBinding).anyTimes();
+ expect(outboundWire.getContainer()).andReturn(serviceBinding).anyTimes();
+
+ Map<Operation<?>, OutboundInvocationChain> outboundChains =
+ new HashMap<Operation<?>, OutboundInvocationChain>();
+ DataType<Type> type1 = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ types.add(type1);
+ DataType<List<DataType<Type>>> inputType1 = new DataType<List<DataType<Type>>>(Object[].class, types);
+ DataType<Type> outputType1 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op1 = new Operation<Type>("test", inputType1, outputType1, null);
+ ServiceContract<Type> outboundContract = new JavaServiceContract(null);
+ outboundContract.setDataBinding(String.class.getName());
+ op1.setServiceContract(outboundContract);
+
+ OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
+ outboundChains.put(op1, outboundChain);
+ expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
+ // outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)
+ // EasyMock.anyObject());
+
+ Map<Operation<?>, InboundInvocationChain> inboundChains =
+ new HashMap<Operation<?>, InboundInvocationChain>();
+ DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
+ List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
+ types2.add(type2);
+ DataType<List<DataType<Type>>> inputType2 =
+ new DataType<List<DataType<Type>>>(Object[].class, types2);
+ DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
+ ServiceContract<Type> inboundContract = new JavaServiceContract(null);
+ inboundContract.setDataBinding(Node.class.getName());
+ op2.setServiceContract(inboundContract);
+
+ InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
+ inboundChains.put(op2, inboundChain);
+ expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
+ inboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+
+ ServiceContract<Type> contract = new JavaServiceContract();
+ Map<String, Operation<Type>> operations = Collections.emptyMap();
+ contract.setCallbackOperations(operations);
+ expect(inboundWire.getServiceContract()).andReturn(contract);
+
+ EasyMock.replay(composite, serviceBinding, inboundWire, outboundWire, inboundChain, outboundChain);
+
+ processor.process(inboundWire, outboundWire);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DirectedGraphTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DirectedGraphTestCase.java
new file mode 100755
index 0000000000..70244df8e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DirectedGraphTestCase.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.core.databinding.impl;
+
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.DirectedGraph.Edge;
+import org.apache.tuscany.core.databinding.impl.DirectedGraph.Vertex;
+
+public class DirectedGraphTestCase extends TestCase {
+ private DirectedGraph<String, Object> graph;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new DirectedGraph<String, Object>();
+ graph.addEdge("a", "b", null, 3);
+ graph.addEdge("b", "c", null, 1);
+ graph.addEdge("a", "c", null, 8);
+ graph.addEdge("a", "d", null, 3);
+ graph.addEdge("b", "d", null, 2);
+ graph.addEdge("c", "b", null, 1);
+ graph.addEdge("c", "d", null, 2);
+ graph.addEdge("d", "b", null, 1);
+ graph.addEdge("a", "e", null, 8);
+ graph.addEdge("c", "c", null, 2);
+ }
+
+ public void testGraph() {
+ // System.out.println(graph);
+
+ Vertex vertex = graph.getVertex("a");
+ Assert.assertNotNull(vertex);
+ Assert.assertEquals(vertex.getValue(), "a");
+
+ Assert.assertNull(graph.getVertex("1"));
+
+ Edge edge = graph.getEdge("a", "b");
+ Assert.assertNotNull(edge);
+ Assert.assertEquals(edge.getWeight(), 3);
+
+ edge = graph.getEdge("b", "a");
+ Assert.assertNull(edge);
+
+ DirectedGraph<String, Object>.Path path = graph.getShortestPath("a", "c");
+
+ List<DirectedGraph<String, Object>.Edge> edges = path.getEdges();
+ Assert.assertEquals(edges.size(), 2);
+ Assert.assertEquals(edges.get(0), graph.getEdge("a", "b"));
+ Assert.assertEquals(edges.get(1), graph.getEdge("b", "c"));
+
+ Assert.assertEquals(path.getWeight(), 4);
+
+ DirectedGraph<String, Object>.Path path2 = graph.getShortestPath("b", "e");
+ Assert.assertNull(path2);
+
+ DirectedGraph<String, Object>.Path path3 = graph.getShortestPath("a", "a");
+ Assert.assertTrue(path3.getWeight() == 0 && path3.getEdges().isEmpty());
+
+ DirectedGraph<String, Object>.Path path4 = graph.getShortestPath("c", "c");
+ Assert.assertTrue(path4.getWeight() == 2 && path4.getEdges().size() == 1);
+
+ // System.out.println(path);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/IDLTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/IDLTransformerTestCase.java
new file mode 100644
index 0000000000..7981080f82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/IDLTransformerTestCase.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.databinding.impl;
+
+import static org.apache.tuscany.spi.databinding.DataBinding.IDL_INPUT;
+import static org.apache.tuscany.spi.databinding.DataBinding.IDL_OUTPUT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.javabeans.DOMNode2JavaBeanTransformer;
+import org.apache.tuscany.core.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.core.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.core.databinding.xml.Node2String;
+import org.apache.tuscany.core.databinding.xml.String2Node;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.ElementInfo;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.WrapperInfo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class IDLTransformerTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<order1"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</order1>";
+
+ private static final String URI_ORDER_XSD = "http://example.com/order.xsd";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ List<DataType<XMLType>> types0 = new ArrayList<DataType<XMLType>>();
+ DataType<XMLType> wrapperType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "checkOrderStatus"), null));
+ types0.add(wrapperType);
+ DataType<List<DataType<XMLType>>> inputType0 =
+ new DataType<List<DataType<XMLType>>>(IDL_INPUT, Object[].class, types0);
+
+ List<DataType<XMLType>> types1 = new ArrayList<DataType<XMLType>>();
+ DataType<XMLType> customerIdType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "customerId"), null));
+ DataType<XMLType> orderType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "order"), null));
+ DataType<XMLType> flagType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "flag"), null));
+ types1.add(customerIdType);
+ types1.add(orderType);
+ types1.add(flagType);
+
+ DataType<XMLType> statusType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "status"), null));
+ DataType<XMLType> responseType =
+ new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"),
+ null));
+
+ org.apache.tuscany.spi.model.Operation<XMLType> op =
+ new org.apache.tuscany.spi.model.Operation<XMLType>("checkOrderStatus", inputType0, responseType, null);
+ op.setDataBinding(DOMDataBinding.NAME);
+
+ inputType0.setOperation(op);
+ op.setWrapperStyle(true);
+ ElementInfo inputElement =
+ new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null, false, null));
+ wrapperType.setMetadata(ElementInfo.class.getName(), inputElement);
+
+ ElementInfo customerId =
+ new ElementInfo(new QName("", "customerId"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
+ ElementInfo order =
+ new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
+ ElementInfo flag =
+ new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));
+
+ customerIdType.setMetadata(ElementInfo.class.getName(), customerId);
+ orderType.setMetadata(ElementInfo.class.getName(), order);
+ flagType.setMetadata(ElementInfo.class.getName(), flag);
+
+ customerIdType.setOperation(op);
+ orderType.setOperation(op);
+ flagType.setOperation(op);
+
+ List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
+ inputElements.add(customerId);
+ inputElements.add(order);
+ inputElements.add(flag);
+
+ ElementInfo statusElement =
+ new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
+
+ statusType.setMetadata(ElementInfo.class.getName(), statusElement);
+ statusType.setOperation(op);
+
+ List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
+ outputElements.add(statusElement);
+
+ ElementInfo outputElement =
+ new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"), new TypeInfo(null, false, null));
+
+ responseType.setMetadata(ElementInfo.class.getName(), inputElement);
+ responseType.setOperation(op);
+
+ WrapperInfo wrapperInfo =
+ new WrapperInfo(DOMDataBinding.NAME, inputElement, outputElement, inputElements, outputElements);
+ op.setWrapper(wrapperInfo);
+ op.setDataBinding(DOMDataBinding.NAME);
+
+ MediatorImpl m = new MediatorImpl();
+ TransformerRegistryImpl tr = new TransformerRegistryImpl();
+ tr.registerTransformer(new String2Node());
+ tr.registerTransformer(new Node2String());
+ tr.registerTransformer(new DOMNode2JavaBeanTransformer());
+ tr.registerTransformer(new JavaBean2DOMNodeTransformer());
+ m.setTransformerRegistry(tr);
+ DataBindingRegistry dataBindingRegistry = new DataBindingRegistryImpl();
+ dataBindingRegistry.register(new DOMDataBinding());
+ m.setDataBindingRegistry(dataBindingRegistry);
+
+ Object[] source = new Object[] {"cust001", IPO_XML, Integer.valueOf(1)};
+ Input2InputTransformer t = new Input2InputTransformer();
+ t.setMediator(m);
+
+ TransformationContext context = new TransformationContextImpl();
+ List<DataType<Class>> types = new ArrayList<DataType<Class>>();
+ types.add(new DataType<Class>(Object.class.getName(), String.class, String.class));
+ types.add(new DataType<Class>("java.lang.String", String.class, String.class));
+ types.add(new DataType<Class>(Object.class.getName(), int.class, int.class));
+ DataType<List<DataType<Class>>> inputType1 =
+ new DataType<List<DataType<Class>>>(IDL_INPUT, Object[].class, types);
+ context.setSourceDataType(inputType1);
+ context.setTargetDataType(op.getInputType());
+ Object[] results = t.transform(source, context);
+ assertEquals(1, results.length);
+ assertTrue(results[0] instanceof Element);
+ Element element = (Element)results[0];
+ assertEquals("http://example.com/order.xsd", element.getNamespaceURI());
+ assertEquals("checkOrderStatus", element.getLocalName());
+
+ TransformationContext context1 = new TransformationContextImpl();
+ DataType<DataType> sourceType = new DataType<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
+ sourceType.setOperation(op.getOutputType().getOperation());
+
+ context1.setSourceDataType(sourceType);
+ DataType<DataType> targetType =
+ new DataType<DataType>(IDL_OUTPUT, Object.class, new DataType<Class>("java.lang.Object", String.class,
+ String.class));
+ context1.setTargetDataType(targetType);
+
+ Document factory = DOMHelper.newDocument();
+ Element responseElement =
+ factory.createElementNS("http://example.com/order.wsdl", "p:checkOrderStatusResponse");
+ Element status = factory.createElement("status");
+ responseElement.appendChild(status);
+ status.appendChild(factory.createTextNode("shipped"));
+ Output2OutputTransformer t2 = new Output2OutputTransformer();
+ t2.setMediator(m);
+ Object st = t2.transform(responseElement, context1);
+ assertEquals("shipped", st);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/MediatorImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/MediatorImplTestCase.java
new file mode 100644
index 0000000000..3cb7f243a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/MediatorImplTestCase.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.databinding.impl;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.xml.Node2String;
+import org.apache.tuscany.core.databinding.xml.Node2Writer;
+import org.apache.tuscany.core.databinding.xml.SAX2DOMPipe;
+import org.apache.tuscany.core.databinding.xml.String2SAX;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformerRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for MediatorImpl
+ */
+public class MediatorImplTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + "<state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + "<USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private MediatorImpl mediator;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ TransformerRegistry registry = new TransformerRegistryImpl();
+ registry.registerTransformer(new String2SAX());
+ registry.registerTransformer(new SAX2DOMPipe());
+ registry.registerTransformer(new Node2String());
+ registry.registerTransformer(new Node2Writer());
+
+ mediator = new MediatorImpl();
+ mediator.setTransformerRegistry(registry);
+
+ DataBindingRegistry dataBindingRegistry = new DataBindingRegistryImpl();
+ mediator.setDataBindingRegistry(dataBindingRegistry);
+ }
+
+ private TransformationContext createTransformationContext(Class sourceType, Class targetType) {
+ TransformationContext context = new TransformationContextImpl();
+ DataType sourceDataType = new DataType<Class>(sourceType, sourceType);
+ DataType targetDataType = new DataType<Class>(targetType, targetType);
+ context.setSourceDataType(sourceDataType);
+ context.setTargetDataType(targetDataType);
+ return context;
+ }
+
+ public void testTransform1() {
+ TransformationContext context = createTransformationContext(String.class, Node.class);
+ Object node =
+ mediator.mediate(IPO_XML, context.getSourceDataType(), context.getTargetDataType(), null);
+ Assert.assertTrue(node instanceof Document);
+ Element root = ((Document)node).getDocumentElement();
+ Assert.assertEquals(root.getNamespaceURI(), "http://www.example.com/IPO");
+ Assert.assertEquals(root.getLocalName(), "purchaseOrder");
+ }
+
+ public void testTransform2() {
+ TransformationContext context = createTransformationContext(String.class, Writer.class);
+ Writer writer = new StringWriter();
+ mediator.mediate(IPO_XML, writer, context.getSourceDataType(), context.getTargetDataType(), null);
+ String str = writer.toString();
+ Assert.assertTrue(str != null && str.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptorTestCase.java
new file mode 100644
index 0000000000..3e839bdae1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueInterceptorTestCase.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.databinding.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.core.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.spi.databinding.DataBinding;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for ByValueInterceptor
+ */
+public class PassByValueInterceptorTestCase extends TestCase {
+ private MySerialiable serialiable = new MySerialiable();
+ private String str = "ABC";
+ private Integer i = new Integer(1);
+ private String[] array = new String[] {"1", "2"};
+ private Object[] values;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ values = new Object[] {serialiable, str, i, serialiable, array};
+ }
+
+ private static class MySerialiable implements Serializable {
+ private static final long serialVersionUID = 7827201707529055310L;
+ private final String name = "Serializable";
+ private final int age = 100;
+
+ public int getAge() {
+ return age;
+ }
+
+ public String getName() {
+ return name;
+ }
+ }
+
+ public void testCopy() {
+ PassByValueInterceptor interceptor = new PassByValueInterceptor(null);
+ DataBinding db = new JavaBeansDataBinding();
+ interceptor.setParameterDatabindings(new DataBinding[] {db, db, db, db, db});
+ Object[] copy = interceptor.copy(values);
+ assertTrue(copy[0] instanceof MySerialiable);
+ MySerialiable copied = (MySerialiable)copy[0];
+ assertNotSame(serialiable, copy[0]);
+ assertEquals(serialiable.getName(), copied.getName());
+ assertEquals(serialiable.getAge(), copied.getAge());
+ assertSame(copy[1], str);
+ assertSame(copy[2], i);
+ assertSame(copy[0], copy[3]);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java
new file mode 100644
index 0000000000..1839aa4044
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessorTestCase.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Type;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+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.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.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.SynchronousBridgingInterceptor;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+
+/**
+ * Testcase for testing if the PassByValueWireProcessor adds the PassByValueInterceptor to the invocation chains and
+ * also ensure that the outbound and inbound chain of interceptors are linked after this insertion
+ *
+ * @version $Rev$ $Date$
+ */
+public class PassByValueWirePostProcessorTestCase extends TestCase {
+ private PassByValueWirePostProcessor processor;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.processor = new PassByValueWirePostProcessor();
+ DataBindingRegistry dataBindingRegistry = createMock(DataBindingRegistry.class);
+ processor.setDataBindingRegistry(dataBindingRegistry);
+ }
+
+ public void testProcessInclusionOfInterceptor() {
+
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ServiceContract<Type> serviceContract = new JavaServiceContract(null);
+ serviceContract.setRemotable(true);
+ Map<Operation<?>, InboundInvocationChain> inChainsMap =
+ new Hashtable<Operation<?>, InboundInvocationChain>();
+
+ Operation<Type> operation1 = new Operation<Type>("testMethod", null, null, null);
+ operation1.setServiceContract(serviceContract);
+ InboundInvocationChainImpl inChain = new InboundInvocationChainImpl(operation1);
+ inChainsMap.put(operation1, inChain);
+
+ AtomicComponentExtension componentExtn = new FooComponent();
+ componentExtn.setPassByReferenceMethods(new ArrayList<String>());
+
+ Map<Operation<?>, OutboundInvocationChain> outChainsMap =
+ new Hashtable<Operation<?>, OutboundInvocationChain>();
+ OutboundInvocationChainImpl outChain = new OutboundInvocationChainImpl(operation1);
+ outChainsMap.put(operation1, outChain);
+
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(outboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getInvocationChains()).andReturn(inChainsMap);
+ expect(outboundWire.getServiceContract()).andReturn(serviceContract).times(2);
+ expect(outboundWire.getInvocationChains()).andReturn(outChainsMap).times(2);
+
+ Interceptor inInterceptor = createMock(Interceptor.class);
+ Interceptor outInterceptor = createMock(Interceptor.class);
+ inChain.addInterceptor(0, inInterceptor);
+ outChain.addInterceptor(0, outInterceptor);
+ outChain.addInterceptor(new SynchronousBridgingInterceptor(inChain.getHeadInterceptor()));
+
+ EasyMock.replay(inboundWire, outboundWire);
+ processor.process(outboundWire, inboundWire);
+
+ assertEquals(true, outChain.getHeadInterceptor() instanceof PassByValueInterceptor);
+ assertEquals(true, outChain.getTailInterceptor().getNext().equals(
+ inChain.getHeadInterceptor()));
+
+ }
+
+ public void testProcessExclusionOfInterceptorWhenAllowsPassByReference() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ServiceContract<Type> serviceContract = new JavaServiceContract(null);
+ serviceContract.setRemotable(true);
+ Map<Operation<?>, InboundInvocationChain> inChainsMap =
+ new Hashtable<Operation<?>, InboundInvocationChain>();
+
+ Operation<?> operation1 = new Operation<Type>("testMethod", null, null, null);
+ InboundInvocationChainImpl inChain = new InboundInvocationChainImpl(operation1);
+ inChainsMap.put(operation1, inChain);
+
+ AtomicComponentExtension componentExtn = new FooComponent();
+ componentExtn.setAllowsPassByReference(true);
+ componentExtn.setPassByReferenceMethods(new ArrayList<String>());
+
+
+ Map<Operation<?>, OutboundInvocationChain> outChainsMap =
+ new Hashtable<Operation<?>, OutboundInvocationChain>();
+ OutboundInvocationChainImpl outChain = new OutboundInvocationChainImpl(operation1);
+ outChainsMap.put(operation1, outChain);
+
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(outboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getInvocationChains()).andReturn(inChainsMap);
+ expect(outboundWire.getServiceContract()).andReturn(serviceContract).anyTimes();
+ expect(outboundWire.getInvocationChains()).andReturn(outChainsMap).times(2);
+
+ Interceptor inInterceptor = createMock(Interceptor.class);
+ Interceptor outInterceptor = createMock(Interceptor.class);
+ inChain.addInterceptor(0, inInterceptor);
+ outChain.addInterceptor(0, outInterceptor);
+ outChain.addInterceptor(new SynchronousBridgingInterceptor(inChain.getHeadInterceptor()));
+
+ EasyMock.replay(inboundWire, outboundWire);
+ processor.process(outboundWire, inboundWire);
+
+ assertEquals(false, inChain.getHeadInterceptor() instanceof PassByValueInterceptor);
+ assertEquals(false,
+ outChain.getTailInterceptor().getNext() instanceof PassByValueInterceptor);
+ assertEquals(true, outChain.getTailInterceptor().getNext().equals(
+ inChain.getHeadInterceptor()));
+ }
+
+ public void testProcessExclusionOfInterceptorWhenAllowsPassByReferenceAtMethod() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ServiceContract<Type> serviceContract = new JavaServiceContract(null);
+ serviceContract.setRemotable(true);
+ Map<Operation<?>, InboundInvocationChain> inChainsMap =
+ new Hashtable<Operation<?>, InboundInvocationChain>();
+
+ Operation<?> operation1 = new Operation<Type>("testMethod", null, null, null);
+ InboundInvocationChainImpl inChain = new InboundInvocationChainImpl(operation1);
+ inChainsMap.put(operation1, inChain);
+
+ AtomicComponentExtension componentExtn = new FooComponent();
+ componentExtn.setPassByReferenceMethods(new ArrayList<String>());
+ componentExtn.getPassByReferenceMethods().add("testMethod");
+
+
+ Map<Operation<?>, OutboundInvocationChain> outChainsMap =
+ new Hashtable<Operation<?>, OutboundInvocationChain>();
+ OutboundInvocationChainImpl outChain = new OutboundInvocationChainImpl(operation1);
+ outChainsMap.put(operation1, outChain);
+
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(outboundWire.getContainer()).andReturn(componentExtn).anyTimes();
+ expect(inboundWire.getServiceContract()).andReturn(serviceContract);
+ expect(inboundWire.getInvocationChains()).andReturn(inChainsMap);
+ expect(outboundWire.getServiceContract()).andReturn(serviceContract).anyTimes();
+ expect(outboundWire.getInvocationChains()).andReturn(outChainsMap).times(2);
+
+ Interceptor inInterceptor = createMock(Interceptor.class);
+ Interceptor outInterceptor = createMock(Interceptor.class);
+ inChain.addInterceptor(0, inInterceptor);
+ outChain.addInterceptor(0, outInterceptor);
+ outChain.addInterceptor(new SynchronousBridgingInterceptor(inChain.getHeadInterceptor()));
+
+ EasyMock.replay(inboundWire, outboundWire);
+ processor.process(outboundWire, inboundWire);
+
+ assertEquals(false, inChain.getHeadInterceptor() instanceof PassByValueInterceptor);
+ assertEquals(false,
+ outChain.getTailInterceptor().getNext() instanceof PassByValueInterceptor);
+ assertEquals(true, outChain.getTailInterceptor().getNext().equals(
+ inChain.getHeadInterceptor()));
+ }
+
+ public void testProcessExclusionOfInterceptorForBinding() {
+ InboundWire inboundWire = createMock(InboundWire.class);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+
+ ServiceBinding serviceBinding = createMock(ServiceBinding.class);
+ expect(outboundWire.getContainer()).andReturn(serviceBinding).anyTimes();
+ expect(inboundWire.getContainer()).andReturn(null).anyTimes();
+
+ ServiceContract<Type> serviceContract = new JavaServiceContract(null);
+ serviceContract.setRemotable(true);
+ Map<Operation<?>, InboundInvocationChain> inChainsMap =
+ new Hashtable<Operation<?>, InboundInvocationChain>();
+
+ Operation<?> operation1 = new Operation<Type>("testMethod", null, null, null);
+ InboundInvocationChainImpl inChain = new InboundInvocationChainImpl(operation1);
+ inChainsMap.put(operation1, inChain);
+
+ Map<Operation<?>, OutboundInvocationChain> outChainsMap =
+ new Hashtable<Operation<?>, OutboundInvocationChain>();
+ OutboundInvocationChainImpl outChain = new OutboundInvocationChainImpl(operation1);
+ outChainsMap.put(operation1, outChain);
+
+ Interceptor inInterceptor = createMock(Interceptor.class);
+ Interceptor outInterceptor = createMock(Interceptor.class);
+ inChain.addInterceptor(0, inInterceptor);
+ outChain.addInterceptor(0, outInterceptor);
+ outChain.addInterceptor(new SynchronousBridgingInterceptor(inChain.getHeadInterceptor()));
+
+ EasyMock.replay(inboundWire, outboundWire);
+ processor.process(outboundWire, inboundWire);
+
+ assertEquals(false, inChain.getHeadInterceptor() instanceof PassByValueInterceptor);
+ assertEquals(false,
+ outChain.getTailInterceptor().getNext() instanceof PassByValueInterceptor);
+ assertEquals(true, outChain.getTailInterceptor().getNext().equals(
+ inChain.getHeadInterceptor()));
+ }
+
+ private class FooComponent extends AtomicComponentExtension {
+
+ public FooComponent() {
+ super(null, null, null, null, null, null, 0);
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ return null;
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return null;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImplTestCase.java
new file mode 100644
index 0000000000..6250efd897
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/TransformerRegistryImplTestCase.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.core.databinding.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.TransformerRegistry;
+
+/**
+ *
+ */
+public class TransformerRegistryImplTestCase extends TestCase {
+ private TransformerRegistry registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new TransformerRegistryImpl();
+ }
+
+ public void testRegisterTransformer1() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.registerTransformer("a", "b", 10, transformer);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testRegisterTransformerTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ expect(transformer.getSourceDataBinding()).andReturn("a");
+ expect(transformer.getTargetDataBinding()).andReturn("b");
+ expect(transformer.getWeight()).andReturn(10);
+ replay(transformer);
+ registry.registerTransformer(transformer);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testUnregisterTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.registerTransformer("a", "b", 10, transformer);
+ boolean result = registry.unregisterTransformer("a", "b");
+ Assert.assertTrue(result);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertNull(t);
+ }
+
+ public void testGetTransformerChain() {
+ Transformer t1 = createMock(Transformer.class);
+ expect(t1.getSourceDataBinding()).andReturn("a");
+ expect(t1.getTargetDataBinding()).andReturn("b");
+ expect(t1.getWeight()).andReturn(10);
+ replay(t1);
+ Transformer t2 = createMock(Transformer.class);
+ expect(t2.getSourceDataBinding()).andReturn("b");
+ expect(t2.getTargetDataBinding()).andReturn("c");
+ expect(t2.getWeight()).andReturn(20);
+ replay(t2);
+
+ Transformer t3 = createMock(Transformer.class);
+ expect(t3.getSourceDataBinding()).andReturn("a");
+ expect(t3.getTargetDataBinding()).andReturn("c");
+ expect(t3.getWeight()).andReturn(120);
+ replay(t3);
+
+ registry.registerTransformer(t1);
+ registry.registerTransformer(t2);
+ registry.registerTransformer(t3);
+
+ List<Transformer> l1 = registry.getTransformerChain("a", "b");
+ Assert.assertTrue(l1.size() == 1 && l1.get(0) == t1);
+ List<Transformer> l2 = registry.getTransformerChain("a", "c");
+ Assert.assertTrue(l2.size() == 2 && l2.get(0) == t1 && l2.get(1) == t2);
+ List<Transformer> l3 = registry.getTransformerChain("a", "d");
+ Assert.assertNull(l3);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformerTestCase.java
new file mode 100644
index 0000000000..e654fe3ec9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/DOMNode2JavaBeanTransformerTestCase.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.core.databinding.javabeans;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.javabeans.DOMNode2JavaBeanTransformer;
+import org.apache.tuscany.core.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.idl.ElementInfo;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.easymock.EasyMock;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Testcase to test the XMLTypeMapperExtension which is the back bone for all transformations supported by the JavaBeans
+ * Databinding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DOMNode2JavaBeanTransformerTestCase extends TestCase {
+
+ private DOMNode2JavaBeanTransformer dom2JavaTransformer = new DOMNode2JavaBeanTransformer();
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testFieldSettings() throws Exception {
+ String samplePropertyXML =
+ "<property name=\"prop2\" >" + "<integerNumber>27</integerNumber>"
+ + "<floatNumber>79.34</floatNumber>"
+ + "<doubleNumber>184.52</doubleNumber>" + "<innerProperty>"
+ + "<integerNumber>54</integerNumber>" + "<floatNumber>158.68</floatNumber>"
+ + "<doubleNumber>369.04</doubleNumber>" + "</innerProperty>"
+ + "<stringArray>TestString_1</stringArray>"
+ + "<stringArray>TestString_2</stringArray>" + "<boolArray>true</boolArray>"
+ + "<boolArray>false</boolArray>" + "</property>";
+
+ DocumentBuilder builder = DOMHelper.newDocumentBuilder();
+ InputSource inputSource = new InputSource(new StringReader(samplePropertyXML));
+ Node samplePropertyNode = builder.parse(inputSource);
+ TypeInfo typeInfo = new TypeInfo(null, false, null);
+
+ TransformationContext context = EasyMock.createMock(TransformationContext.class);
+ DataType<Class> targetDataType = new DataType<Class>(SamplePropertyBean.class, SamplePropertyBean.class);
+ EasyMock.expect(context.getTargetDataType()).andReturn(targetDataType).anyTimes();
+
+ DataType<XMLType> sourceDataType = new DataType<XMLType>(null, new XMLType(typeInfo));
+ // ElementInfo eleInfo = new ElementInfo(null, typeInfo);
+ // sourceDataType.setMetadata(ElementInfo.class.getName(), eleInfo);
+ EasyMock.expect(context.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ EasyMock.replay(context);
+
+ Object javaObject =
+ dom2JavaTransformer.transform(((Document) samplePropertyNode).getDocumentElement(), context);
+
+ assertTrue(javaObject instanceof SamplePropertyBean);
+ SamplePropertyBean samplePropBean = (SamplePropertyBean) javaObject;
+ assertEquals(samplePropBean.getIntegerNumber(), 27);
+ assertEquals((float) 79.34, samplePropBean.getFloatNumber());
+ assertEquals(samplePropBean.getInnerProperty().getDoubleNumber(), 369.04);
+
+ assertEquals(samplePropBean.getStringArray()[0], "TestString_1");
+ assertEquals(samplePropBean.boolArray[0], true);
+
+ /** testing for object to node * */
+ javax.xml.transform.Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ JavaBean2DOMNodeTransformer java2DomTransformer = new JavaBean2DOMNodeTransformer();
+ Node aNode = java2DomTransformer.transform(javaObject, context);
+ StringWriter sw = new StringWriter();
+ transformer.transform(new DOMSource(aNode), new StreamResult(sw));
+ String nodeString = sw.toString();
+ //System.out.println(nodeString);
+
+ // testing the case when field and getter method do not have public access
+ assertTrue(nodeString.indexOf("<doubleNumber>184.52</doubleNumber>") == -1);
+ // test the case for fields that are of array type
+ assertTrue(nodeString.indexOf("<stringArray>TestString_1</stringArray>"
+ + "<stringArray>TestString_2</stringArray>") != -1);
+ // testing the case for non-public field with public getter method
+ assertTrue(nodeString.indexOf("<integerNumber>27</integerNumber>") != -1);
+ // test the case for public field that is a another java bean .i.e. embeded javabean
+ int startIndex = nodeString.indexOf("<innerProperty>");
+ int endIndex = nodeString.indexOf("</innerProperty>");
+ String fragment = nodeString.substring(startIndex, endIndex);
+ assertTrue(fragment.indexOf("<integerNumber>54</integerNumber>") != -1);
+
+ // System.out.println(sw.toString());
+
+ }
+
+
+ public static class SamplePropertyBean {
+
+ private float floatNumber = 50;
+ private SamplePropertyBean innerProperty;
+ public boolean[] boolArray;
+ private double doubleNumber = 75;
+ private int integerNumber = 25;
+ private String[] stringArray;
+
+ public SamplePropertyBean() {
+
+ }
+
+ double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public SamplePropertyBean getInnerProperty() {
+ return innerProperty;
+ }
+
+ public void setInnerProperty(SamplePropertyBean prop) {
+ this.innerProperty = prop;
+ }
+
+ public String toString() {
+ return Double.toString(integerNumber + floatNumber + doubleNumber) + " & "
+ + ((innerProperty == null) ? "" : innerProperty.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformerTestCase.java
new file mode 100644
index 0000000000..95701cc0fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/javabeans/JavaBean2DOMNodeTransformerTestCase.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.StringWriter;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Node;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * Testcase to test the XMLTypeMapperExtension which is the back bone for all transformations supported by the JavaBeans
+ * Databinding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaBean2DOMNodeTransformerTestCase extends TestCase {
+ private JavaBean2DOMNodeTransformer aTransformer = new JavaBean2DOMNodeTransformer();
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTranformation() throws Exception {
+ TransformationContext context = EasyMock.createMock(TransformationContext.class);
+ DataType<Class> dataType = new DataType<Class>(null, SamplePropertyBean.class);
+ EasyMock.expect(context.getTargetDataType()).andReturn(dataType).anyTimes();
+ EasyMock.replay(context);
+
+ javax.xml.transform.Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ Object data = new int[]{10, 20, 30, 40};
+ Node aNode = aTransformer.transform(data, context);
+ StringWriter sw = new StringWriter();
+ transformer.transform(new DOMSource(aNode), new StreamResult(sw));
+
+ System.out.println(sw.toString());
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><int_collection><int>10</int><int>20</int>"
+ + "<int>30</int><int>40</int></int_collection>",
+ sw.toString());
+ }
+
+ public static class SamplePropertyBean {
+ private float floatNumber = 50;
+ private SamplePropertyBean innerProperty;
+ private double doubleNumber = 75;
+ private int integerNumber = 25;
+ private String[] stringArray;
+
+ public SamplePropertyBean() {
+
+ }
+
+ double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public SamplePropertyBean getInnerProperty() {
+ return innerProperty;
+ }
+
+ public void setInnerProperty(SamplePropertyBean prop) {
+ this.innerProperty = prop;
+ }
+
+ public String toString() {
+ return Double.toString(integerNumber + floatNumber + doubleNumber) + " & "
+ + ((innerProperty == null) ? "" : innerProperty.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java
new file mode 100644
index 0000000000..bc9ecb2713
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.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.core.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Node;
+
+public class DOM2StAXTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private static final String CRAZY_XML =
+ "<p:e1 xmlns=\"http://ns0\" xmlns:p=\"http://p1\">"
+ + "<p:e2 xmlns:p=\"http://p2\"/><e3/><e4 xmlns=\"\">E4</e4></p:e1>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(IPO_XML, null);
+ Node2XMLStreamReader t2 = new Node2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(node, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+ public void testTransformation2() {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(CRAZY_XML, null);
+ Node2XMLStreamReader t2 = new Node2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(node, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ System.out.println(xml);
+ assertTrue(xml.contains("<p:e2 xmlns:p=\"http://p2\""));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java
new file mode 100644
index 0000000000..d4eaf9b2a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.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.core.databinding.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.PipedTransformer;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for DataPipe
+ */
+public class DataPipeTestCase extends TestCase {
+
+ public final void testStreamPipe() throws IOException {
+ byte[] bytes = new byte[] {1, 2, 3};
+ StreamDataPipe pipe = new StreamDataPipe();
+ Assert.assertSame(OutputStream.class, pipe.getSourceType());
+ Assert.assertSame(InputStream.class, pipe.getTargetType());
+ OutputStream os = pipe.getSink();
+ os.write(bytes);
+ byte[] newBytes = new byte[16];
+ int count = pipe.getResult().read(newBytes);
+ Assert.assertEquals(3, count);
+ for (int i = 0; i < bytes.length; i++) {
+ Assert.assertEquals(bytes[i], newBytes[i]);
+ }
+ }
+
+ public final void testWriter2ReaderPipe() throws IOException {
+ String str = "ABC";
+ Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
+ Assert.assertSame(Writer.class, pipe.getSourceType());
+ Assert.assertSame(Reader.class, pipe.getTargetType());
+ pipe.getSink().write(str);
+ char[] buf = new char[16];
+ int count = pipe.getResult().read(buf);
+ Assert.assertEquals(3, count);
+ for (int i = 0; i < str.length(); i++) {
+ Assert.assertEquals(str.charAt(i), buf[i]);
+ }
+ }
+
+ public final void testPiped() throws Exception {
+ Node2Writer node2Writer = new Node2Writer();
+ Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
+ PipedTransformer<Node, Writer, Reader> transformer =
+ new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
+ Document document = DOMHelper.newDocument();
+ Element element = document.createElementNS("http://ns1", "root");
+ document.appendChild(element);
+ Reader reader = transformer.transform(document, null);
+ Assert.assertEquals(transformer.getWeight(), node2Writer.getWeight() + pipe.getWeight());
+ Assert.assertEquals(transformer.getSourceDataBinding(), node2Writer.getSourceDataBinding());
+ Assert.assertEquals(transformer.getTargetDataBinding(), pipe.getTargetDataBinding());
+ char[] buf = new char[120];
+ int count = reader.read(buf);
+ String xml = new String(buf, 0, count);
+ Assert.assertTrue(xml.contains("<root xmlns=\"http://ns1\"/>"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/JavaBean2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..6eb2c101df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/JavaBean2XMLStreamReaderTestCase.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.core.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.javabeans.JavaBean2XMLStreamReader;
+
+public class JavaBean2XMLStreamReaderTestCase extends TestCase {
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ JavaBean2XMLStreamReader t2 = new JavaBean2XMLStreamReader();
+ MyBean bean = new MyBean();
+ bean.str = "ABC";
+ bean.i = 1;
+ bean.arr = new long[] {1, 2, 3};
+ bean.bean = new AnotherBean();
+ bean.bean.setName("Name");
+ XMLStreamReader reader = t2.transform(bean, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ assertTrue(xml.contains("<JavaBean2XMLStreamReaderTestCase$MyBean>"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean>"
+ + "<i>1</i><str>ABC</str></JavaBean2XMLStreamReaderTestCase$MyBean>"));
+ }
+
+ private static class MyBean {
+ private String str;
+ private int i;
+ private long arr[];
+ private AnotherBean bean;
+
+ /**
+ * @return the arr
+ */
+ public long[] getArr() {
+ return arr;
+ }
+
+ /**
+ * @param arr the arr to set
+ */
+ public void setArr(long[] arr) {
+ this.arr = arr;
+ }
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+
+ /**
+ * @return the str
+ */
+ public String getStr() {
+ return str;
+ }
+
+ /**
+ * @param str the str to set
+ */
+ public void setStr(String str) {
+ this.str = str;
+ }
+
+ /**
+ * @return the bean
+ */
+ public AnotherBean getBean() {
+ return bean;
+ }
+
+ /**
+ * @param bean the bean to set
+ */
+ public void setBean(AnotherBean bean) {
+ this.bean = bean;
+ }
+
+ }
+
+ private static class AnotherBean {
+ private String name;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/Node2StringTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/Node2StringTestCase.java
new file mode 100755
index 0000000000..9b9aa3b893
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/Node2StringTestCase.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.databinding.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Node2StringTestCase extends TestCase {
+ public void testTransformation() throws Exception {
+ Document document = DOMHelper.newDocument();
+ Element element = document.createElementNS("http://ns1", "test");
+ document.appendChild(element);
+
+ new Node2String().transform(document, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java
new file mode 100644
index 0000000000..a2318b2faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.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.core.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.PipedTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+public class PushTransformationTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ String2XMLStreamReader t1 = new String2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(IPO_XML, null);
+ XMLStreamReader2SAX t2 = new XMLStreamReader2SAX();
+ PipedTransformer<XMLStreamReader, ContentHandler, Node> t3 =
+ new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
+ Node node = t3.transform(reader, null);
+ Assert.assertNotNull(node);
+ Node2String t4 = new Node2String();
+ String xml = t4.transform(node, null);
+ Assert.assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/StAXHelperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/StAXHelperTestCase.java
new file mode 100644
index 0000000000..7d18e83ac6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/StAXHelperTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Test Case for StAXHelper
+ */
+public class StAXHelperTestCase extends TestCase {
+ private static final String XML =
+ "<a:foo xmlns:a='http://a' name='foo'><bar name='bar'>" + "<doo a:name='doo' xmlns:a='http://doo'/>"
+ + "</bar></a:foo>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testHelper() throws Exception {
+ XMLStreamReader reader = StAXHelper.createXMLStreamReader(XML);
+ String xml = StAXHelper.save(reader);
+ reader = StAXHelper.createXMLStreamReader(xml);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/TraxTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/TraxTransformerTestCase.java
new file mode 100644
index 0000000000..7e9494d423
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/TraxTransformerTestCase.java
@@ -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.
+ */
+
+package org.apache.tuscany.core.databinding.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Node;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ *
+ */
+public class TraxTransformerTestCase extends TestCase {
+ private URL url;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ url = getClass().getResource("foo.xml");
+ }
+
+ public void testTransformDOM() throws IOException {
+ InputStream is = url.openStream();
+ InputStream2Node t1 = new InputStream2Node();
+ Node node = t1.transform(is, null);
+ is.close();
+ Writer writer = new StringWriter();
+ Node2Writer t2 = new Node2Writer();
+ t2.transform(node, writer, null);
+ String str = writer.toString();
+ StringReader reader = new StringReader(str);
+ Reader2Node t3 = new Reader2Node();
+ node = t3.transform(reader, null);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ Node2OutputStream t4 = new Node2OutputStream();
+ t4.transform(node, os, null);
+ InputSource inputSource = new InputSource(new ByteArrayInputStream(os.toByteArray()));
+ InputSource2Node t5 = new InputSource2Node();
+ node = t5.transform(inputSource, null);
+ }
+
+ public void testTransformSAX() throws IOException {
+ MyContentHandler handler = new MyContentHandler();
+ InputStream is = url.openStream();
+ InputStream2SAX t1 = new InputStream2SAX();
+ t1.transform(is, handler, null);
+ is.close();
+
+ String xml = "<foo xmlns=\"http://foo\">bar</foo>";
+
+ InputSource inputSource = new InputSource(new StringReader(xml));
+ InputSource2SAX t2 = new InputSource2SAX();
+ MyContentHandler handler2 = new MyContentHandler();
+ t2.transform(inputSource, handler2, null);
+
+ }
+
+ private static class MyContentHandler extends DefaultHandler {
+
+ @Override
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
+ throws SAXException {
+ super.startElement(namespaceURI, localName, qName, atts);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java
new file mode 100644
index 0000000000..20ae7eecb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.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.core.deployer;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+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.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Include;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.bootstrap.Bootstrapper;
+import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
+import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
+import org.apache.tuscany.core.mock.component.BasicInterface;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * Verifies the default boostrap deployer
+ *
+ * @version $Rev$ $Date$
+ */
+public class BootstrapDeployerTestCase extends TestCase {
+ private DeployerImpl deployer;
+ private DeploymentContext deploymentContext;
+ private ComponentDefinition<SystemCompositeImplementation> componentDefinition;
+ private SystemCompositeImplementation implementation;
+
+ @SuppressWarnings("unchecked")
+ public void testBoot1Load() throws LoaderException {
+ CompositeComponent parent = createNiceMock(CompositeComponent.class);
+ URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
+ implementation.setScdlLocation(scdl);
+ deployer.load(parent, componentDefinition, deploymentContext);
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> composite =
+ implementation.getComponentType();
+ assertNotNull(composite);
+ assertEquals("boot1", composite.getName());
+
+ // check parse of <service>
+ Map<String, ServiceDefinition> services = composite.getDeclaredServices();
+ assertEquals(1, services.size()); // included doesn't count
+ services = composite.getServices();
+ assertEquals(2, services.size()); // included counts
+ ServiceDefinition serviceDefinition = services.get("service");
+ assertNotNull(serviceDefinition);
+ assertEquals("service", serviceDefinition.getName());
+ assertEquals(BasicInterface.class, serviceDefinition.getServiceContract().getInterfaceClass());
+ Collection<BindingDefinition> bindings = serviceDefinition.getBindings();
+ assertTrue(bindings.isEmpty());
+
+ // check parse of <component>
+ Map<String, ComponentDefinition<? extends Implementation<?>>> components = composite.getDeclaredComponents();
+ assertEquals(1, components.size()); // included doesn't count
+ components = composite.getComponents();
+ assertEquals(2, components.size()); // included counts
+ ComponentDefinition<? extends Implementation<?>> component = components.get("component");
+ assertNotNull(component);
+ PropertyValue<?> propVal = component.getPropertyValues().get("publicProperty");
+ assertEquals("propval", propVal.getValueFactory().getInstance());
+
+ // check introspection of implementation
+ ComponentType<?, ?, ?> componentType = component.getImplementation().getComponentType();
+ assertNotNull(componentType); // details checked in SystemComponentTypeLoaderTestCase
+
+ // check included component
+ Map<String, Include> includes = composite.getIncludes();
+ assertEquals(1, includes.size());
+ Include include = includes.get("boot1-include");
+ assertNotNull(include);
+ CompositeComponentType included = include.getIncluded();
+ assertNotNull(included);
+ assertEquals(1, included.getComponents().size());
+ }
+
+ public void testBoot1Deployment() throws Exception {
+ URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
+ implementation.setScdlLocation(scdl);
+ CompositeComponent parent = createNiceMock(CompositeComponent.class);
+ parent.register(isA(SCAObject.class));
+ replay(parent);
+ // load the boot1 file using the bootstrap deployer
+ componentDefinition.setName("simple");
+ Component component = deployer.deploy(parent, componentDefinition);
+ assertNotNull(component);
+ verify(parent);
+ }
+
+ public void testBoot2Deployment() throws Exception {
+ URL scdl = BootstrapDeployerTestCase.class.getResource("boot2.scdl");
+ implementation.setScdlLocation(scdl);
+ CompositeComponent parent = createNiceMock(CompositeComponent.class);
+ parent.register(isA(SCAObject.class));
+ replay(parent);
+
+ // load the boot2 file using the bootstrap deployer
+ componentDefinition.setName("newDeployer");
+ CompositeComponent component = (CompositeComponent) deployer.deploy(parent, componentDefinition);
+ assertNotNull(component);
+ verify(parent);
+ component.start();
+ SCAObject newDeployer = component.getSystemChild(ComponentNames.TUSCANY_DEPLOYER);
+ assertNotNull(newDeployer);
+ SCAObject wireService = component.getSystemChild(ComponentNames.TUSCANY_WIRE_SERVICE);
+ assertNotNull(wireService);
+
+/* // FIXME
+ // load the boot2 file using the newly loaded deployer
+ parent.reset();
+ parent.expects(once()).method("register").withAnyArguments();
+ componentDefinition.setName("newDeployer2");
+ component = newDeployer.deploy((CompositeComponent) parent.proxy(), componentDefinition);
+ assertNotNull(component);
+ parent.verify();
+ component.start();
+ Deployer newDeployer2 = (Deployer) component.getServiceInstance("deployer");
+ assertNotNull(newDeployer2);
+*/
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+ Bootstrapper bootstrapper = new DefaultBootstrapper(new NullMonitorFactory(), xmlFactory, null);
+ deployer = (DeployerImpl) bootstrapper.createDeployer();
+ deploymentContext = new RootDeploymentContext(null, xmlFactory, null, null);
+ implementation = new SystemCompositeImplementation();
+ implementation.setClassLoader(getClass().getClassLoader());
+ componentDefinition = new ComponentDefinition<SystemCompositeImplementation>(implementation);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/ConversationalIntrospectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/ConversationalIntrospectionTestCase.java
new file mode 100644
index 0000000000..5b0fe34705
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/ConversationalIntrospectionTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.idl.java;
+
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.idl.InvalidConversationalOperationException;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import static org.apache.tuscany.spi.model.InteractionScope.CONVERSATIONAL;
+import static org.apache.tuscany.spi.model.InteractionScope.NONCONVERSATIONAL;
+import org.apache.tuscany.spi.model.Operation;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalIntrospectionTestCase extends TestCase {
+ private JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
+
+ public void testServiceContractConversationalInformationIntrospection() throws Exception {
+ JavaServiceContract contract = registry.introspect(Foo.class);
+ assertEquals(CONVERSATIONAL, contract.getInteractionScope());
+ int seq = contract.getOperations().get("operation").getConversationSequence();
+ assertEquals(Operation.CONVERSATION_CONTINUE, seq);
+ seq = contract.getOperations().get("endOperation").getConversationSequence();
+ assertEquals(Operation.CONVERSATION_END, seq);
+ }
+
+ public void testBadServiceContract() throws Exception {
+ try {
+ registry.introspect(BadFoo.class);
+ fail();
+ } catch (InvalidConversationalOperationException e) {
+ //expected
+ }
+ }
+
+ public void testNonConversationalInformationIntrospection() throws Exception {
+ JavaServiceContract contract = registry.introspect(NonConversationalFoo.class);
+ assertEquals(NONCONVERSATIONAL, contract.getInteractionScope());
+ int seq = contract.getOperations().get("operation").getConversationSequence();
+ assertEquals(Operation.NO_CONVERSATION, seq);
+ }
+
+ @Scope("CONVERSATION")
+ private interface Foo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface BadFoo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface NonConversationalFoo {
+ void operation();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java
new file mode 100644
index 0000000000..e3a7deb10a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.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.core.idl.java;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessor;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+import org.easymock.EasyMock;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
+ private JavaInterfaceProcessorRegistryImpl impl;
+
+ public void testSimpleInterface() throws InvalidServiceContractException {
+ JavaServiceContract contract = impl.introspect(Simple.class);
+ // TODO spec to clairfy interface name
+ assertEquals(JavaIntrospectionHelper.getBaseName(Simple.class), contract.getInterfaceName());
+ assertEquals(Simple.class, contract.getInterfaceClass());
+ Map<String, Operation<Type>> operations = contract.getOperations();
+ assertEquals(1, operations.size());
+ Operation<Type> baseInt = operations.get("baseInt");
+ assertNotNull(baseInt);
+
+ DataType<Type> returnType = baseInt.getOutputType();
+ assertEquals(Integer.TYPE, returnType.getPhysical());
+ assertEquals(Integer.TYPE, returnType.getLogical());
+
+ List<DataType<Type>> parameterTypes = baseInt.getInputType().getLogical();
+ assertEquals(1, parameterTypes.size());
+ DataType<Type> arg0 = parameterTypes.get(0);
+ assertEquals(Integer.TYPE, arg0.getPhysical());
+ assertEquals(Integer.TYPE, arg0.getLogical());
+
+ List<DataType<Type>> faultTypes = baseInt.getFaultTypes();
+ assertEquals(1, faultTypes.size());
+ DataType<Type> fault0 = faultTypes.get(0);
+ assertEquals(IllegalArgumentException.class, fault0.getPhysical());
+ assertEquals(IllegalArgumentException.class, fault0.getLogical());
+ }
+
+ public void testUnregister() throws Exception {
+ JavaInterfaceProcessor processor = createMock(JavaInterfaceProcessor.class);
+ processor.visitInterface(eq(Base.class), EasyMock.same((Class)null), isA(JavaServiceContract.class));
+ expectLastCall().once();
+ replay(processor);
+ impl.registerProcessor(processor);
+ impl.introspect(Base.class);
+ impl.unregisterProcessor(processor);
+ impl.introspect(Base.class);
+ verify(processor);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ impl = new JavaInterfaceProcessorRegistryImpl();
+
+ }
+
+ private static interface Base {
+ int baseInt(int param) throws IllegalArgumentException;
+ }
+
+ private static interface Simple extends Base {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/IntrospectionRegistryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/IntrospectionRegistryTestCase.java
new file mode 100644
index 0000000000..fb5e7fbb1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/IntrospectionRegistryTestCase.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Field;
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessor;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl.Monitor;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IntrospectionRegistryTestCase extends TestCase {
+
+ private Monitor monitor;
+
+ public void testRegister() throws Exception {
+ IntrospectionRegistryImpl registry = new IntrospectionRegistryImpl(monitor);
+ ImplementationProcessor processor = EasyMock.createNiceMock(ImplementationProcessor.class);
+ registry.registerProcessor(processor);
+ }
+
+ public void testUnegister() throws Exception {
+ IntrospectionRegistryImpl registry = new IntrospectionRegistryImpl(monitor);
+ ImplementationProcessor processor = EasyMock.createNiceMock(ImplementationProcessor.class);
+ registry.registerProcessor(processor);
+ registry.unregisterProcessor(processor);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWalk() throws Exception {
+ IntrospectionRegistryImpl registry = new IntrospectionRegistryImpl(monitor);
+ ImplementationProcessor processor = EasyMock.createMock(ImplementationProcessor.class);
+ processor.visitClass(EasyMock.isA(CompositeComponent.class),
+ EasyMock.eq(Bar.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+ processor.visitConstructor(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Constructor.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+ processor.visitMethod(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Method.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+ processor.visitField(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Field.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+ processor.visitSuperClass(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Class.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+ processor.visitEnd(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Class.class),
+ EasyMock.isA(PojoComponentType.class),
+ EasyMock.isA(DeploymentContext.class));
+
+ // mock.expects(once()).method("visitClass");
+// mock.expects(once()).method("visitMethod");
+// mock.expects(once()).method("visitField");
+// mock.expects(once()).method("visitConstructor");
+// mock.expects(once()).method("visitSuperClass");
+// mock.expects(once()).method("visitEnd");
+ EasyMock.replay(processor);
+ registry.registerProcessor(processor);
+ registry.introspect(EasyMock.createNiceMock(CompositeComponent.class),
+ Bar.class,
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>(),
+ EasyMock.createNiceMock(DeploymentContext.class));
+ EasyMock.verify(processor);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ monitor = new NullMonitorFactory().getMonitor(Monitor.class);
+ }
+
+ private class Baz {
+
+ }
+
+ private class Bar extends Baz {
+
+ protected String bar;
+
+ public Bar() {
+ }
+
+ public void bar() {
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/PojoAtomicComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/PojoAtomicComponentTestCase.java
new file mode 100644
index 0000000000..6fcef3622e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/PojoAtomicComponentTestCase.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PojoAtomicComponentTestCase extends TestCase {
+ private PojoObjectFactory<Foo> factory;
+
+ @SuppressWarnings({"unchecked"})
+ public void testDestroy() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ EventInvoker<Object> invoker = EasyMock.createMock(EventInvoker.class);
+ invoker.invokeEvent(EasyMock.notNull());
+ EasyMock.replay(invoker);
+ config.setDestroyInvoker(invoker);
+ AtomicComponent component = new TestAtomicComponent(config);
+ assertTrue(component.isDestroyable());
+ component.destroy(new Object());
+ EasyMock.verify(invoker);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testInit() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ EventInvoker<Object> invoker = EasyMock.createMock(EventInvoker.class);
+ invoker.invokeEvent(EasyMock.notNull());
+ EasyMock.replay(invoker);
+ config.setInitInvoker(invoker);
+ AtomicComponent component = new TestAtomicComponent(config);
+ component.init(new Object());
+ EasyMock.verify(invoker);
+ }
+
+ public void testOptimizable() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ TestAtomicComponent component = new TestAtomicComponent(config);
+ assertTrue(component.isOptimizable());
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testDestroyableButOptimizable() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ EventInvoker<Object> invoker = EasyMock.createMock(EventInvoker.class);
+ invoker.invokeEvent(EasyMock.notNull());
+ EasyMock.replay(invoker);
+ config.setDestroyInvoker(invoker);
+ TestAtomicComponent component = new TestAtomicComponent(config);
+ assertTrue(component.isOptimizable());
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testStatelessOptimizable() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ TestStatelessAtomicComponent component = new TestStatelessAtomicComponent(config);
+ assertTrue(component.isOptimizable());
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testNotOptimizable() throws Exception {
+ PojoConfiguration config = new PojoConfiguration();
+ config.setInstanceFactory(factory);
+ EventInvoker<Object> invoker = EasyMock.createMock(EventInvoker.class);
+ invoker.invokeEvent(EasyMock.notNull());
+ EasyMock.replay(invoker);
+ config.setDestroyInvoker(invoker);
+ TestStatelessAtomicComponent component = new TestStatelessAtomicComponent(config);
+ assertFalse(component.isOptimizable());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new PojoObjectFactory<Foo>(Foo.class.getConstructor());
+ }
+
+ private class TestAtomicComponent extends PojoAtomicComponent {
+
+ public TestAtomicComponent(PojoConfiguration configuration) {
+ super(configuration);
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ }
+
+ private class TestStatelessAtomicComponent extends PojoAtomicComponent {
+
+ public TestStatelessAtomicComponent(PojoConfiguration configuration) {
+ super(configuration);
+ }
+
+ public Scope getScope() {
+ return Scope.STATELESS;
+ }
+
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ }
+
+ private static class Foo {
+ public Foo() {
+ }
+ }
+
+}
+
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/TestUtils.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/TestUtils.java
new file mode 100644
index 0000000000..e18fc99861
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/TestUtils.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.implementation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class TestUtils {
+ private static final JavaInterfaceProcessorRegistry REGISTRY = new JavaInterfaceProcessorRegistryImpl();
+
+ private TestUtils() {
+ }
+
+ public static List<InboundWire> populateInboundWires(AtomicComponent component, List<InboundWire> wires)
+ throws InvalidServiceContractException {
+ for (InboundWire wire : wires) {
+ wire.setContainer(component);
+ }
+ return wires;
+ }
+
+ public static List<InboundWire> createInboundWires(List<Class<?>> interfazes)
+ throws InvalidServiceContractException {
+ List<InboundWire> wires = new ArrayList<InboundWire>(interfazes.size());
+ for (Class<?> interfaze : interfazes) {
+ InboundWire wire = createInboundWire(interfaze);
+ wires.add(wire);
+ }
+ return wires;
+ }
+
+ public static InboundWire createInboundWire(Class<?> interfaze) throws InvalidServiceContractException {
+ InboundWire wire = new InboundWireImpl();
+ JavaServiceContract contract = REGISTRY.introspect(interfaze);
+ wire.setServiceContract(contract);
+ return wire;
+ }
+
+ public static InboundWire createInboundWire(Class<?> interfaze, CompositeComponent parent)
+ throws InvalidServiceContractException {
+ InboundWire wire = createInboundWire(interfaze);
+ wire.setContainer(parent);
+ return wire;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireResolutionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireResolutionTestCase.java
new file mode 100644
index 0000000000..c644c3d7c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireResolutionTestCase.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 org.apache.tuscany.core.implementation.composite;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * Verfies specific autowire resolution scenarios
+ *
+ * @version $Rev$ $Date$
+ */
+public class AutowireResolutionTestCase extends TestCase {
+
+ public void testConstruction() {
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ replay(parent);
+ CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
+ assertEquals("test", component.getName());
+ assertSame(parent, component.getParent());
+ verify(parent);
+ }
+
+ public void testResolvedByAutowire() throws Exception {
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ InboundWire wire = TestUtils.createInboundWire(Foo.class, parent);
+ EasyMock.expect(parent.resolveAutowire(eq(Foo.class))).andReturn(wire);
+ EasyMock.expect(parent.resolveSystemAutowire(eq(Foo.class))).andReturn(null);
+ replay(parent);
+ CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
+ assertSame(wire, component.resolveAutowire(Foo.class));
+ verify(parent);
+ }
+
+ public void testSystemResolvedByAutowire() throws Exception {
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ InboundWire wire = TestUtils.createInboundWire(Foo.class, parent);
+ EasyMock.expect(parent.resolveSystemAutowire(eq(Foo.class))).andReturn(wire);
+ replay(parent);
+ CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
+ assertSame(wire, component.resolveSystemAutowire(Foo.class));
+ verify(parent);
+ }
+
+ /**
+ * Verify parent resolution strategy for application serviceBindings
+ */
+ public void testNamespaceIsolationAutowire() throws Exception {
+ Foo foo = new Foo() {
+ };
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
+ parent.registerJavaObject("foo", Foo.class, foo);
+ CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
+ assertNotNull(component.resolveAutowire(Foo.class));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public static interface Foo {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireTestCase.java
new file mode 100644
index 0000000000..341efcd09c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/AutowireTestCase.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.core.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.easymock.EasyMock;
+
+/**
+ * Performs basic autowiring tests to composite artifacts
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class AutowireTestCase extends TestCase {
+
+ /**
+ * Tests autowiring to an system atomic component
+ */
+ public void testSystemAtomicAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, true);
+ parent.start();
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ interfaces.add(Source2.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.replay(component);
+ parent.register(component);
+ InboundWire source = parent.resolveSystemAutowire(Source.class);
+ assertNotNull(source);
+ InboundWire sourceBase = parent.resolveSystemAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ InboundWire source2 = parent.resolveSystemAutowire(Source2.class);
+ assertSame(source.getContainer(), source2.getContainer());
+ assertNull(parent.resolveSystemExternalAutowire(Source.class));
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Tests autowiring to an system atomic component
+ */
+ public void testAtomicAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
+ parent.start();
+
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ interfaces.add(Source2.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ TestUtils.populateInboundWires(component, wires);
+
+ EasyMock.replay(component);
+ parent.register(component);
+
+ InboundWire source = parent.resolveAutowire(Source.class);
+ assertNotNull(source);
+ InboundWire sourceBase = parent.resolveAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ InboundWire source2 = parent.resolveAutowire(Source2.class);
+ assertSame(source.getContainer(), source2.getContainer());
+ assertNull(parent.resolveExternalAutowire(Source.class));
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Tests autowiring to a system service
+ */
+ public void testSystemServiceAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, true);
+ parent.start();
+
+ ServiceBinding serviceBinding = EasyMock.createMock(ServiceBinding.class);
+ InboundWire wire = TestUtils.createInboundWire(Source.class);
+ wire.setContainer(serviceBinding);
+ EasyMock.expect(serviceBinding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(serviceBinding);
+
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(serviceBinding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
+
+ EasyMock.expect(service.getServiceBindings()).andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ parent.register(service);
+
+ InboundWire source = parent.resolveSystemExternalAutowire(Source.class);
+ assertSame(serviceBinding, source.getContainer());
+ InboundWire sourceBase = parent.resolveSystemExternalAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ InboundWire source2 = parent.resolveSystemExternalAutowire(Source2.class);
+ assertNull(source2);
+ EasyMock.verify(serviceBinding);
+ }
+
+ /**
+ * Tests autowiring to a service
+ */
+ public void testServiceAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, true);
+ parent.start();
+
+ ServiceBinding serviceBinding = EasyMock.createMock(ServiceBinding.class);
+ InboundWire wire = TestUtils.createInboundWire(Source.class);
+ wire.setContainer(serviceBinding);
+ EasyMock.expect(serviceBinding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(serviceBinding);
+
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(serviceBinding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+
+ EasyMock.expect(service.getServiceBindings()).andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ parent.register(service);
+
+ InboundWire source = parent.resolveExternalAutowire(Source.class);
+ assertSame(serviceBinding, source.getContainer());
+ InboundWire sourceBase = parent.resolveExternalAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ InboundWire source2 = parent.resolveExternalAutowire(Source2.class);
+ assertNull(source2);
+ EasyMock.verify(serviceBinding);
+ }
+
+
+ /**
+ * Tests autowiring to a system reference
+ */
+ public void testSystemReferenceAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, true);
+ parent.start();
+
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ binding.setReference(EasyMock.isA(Reference.class));
+ InboundWire wire = TestUtils.createInboundWire(Source.class);
+ wire.setContainer(binding);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Reference reference = new ReferenceImpl("foo", null, wire.getServiceContract(), true);
+ reference.addReferenceBinding(binding);
+ parent.register(reference);
+
+ InboundWire source = parent.resolveSystemAutowire(Source.class);
+ assertNotNull(source);
+ InboundWire sourceBase = parent.resolveSystemAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ EasyMock.verify(binding);
+ }
+
+ /**
+ * Tests autowiring to a reference
+ */
+ public void testReferenceAutowire() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, true);
+ parent.start();
+
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ binding.setReference(EasyMock.isA(Reference.class));
+ InboundWire wire = TestUtils.createInboundWire(Source.class);
+ wire.setContainer(binding);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Reference reference = new ReferenceImpl("foo", null, wire.getServiceContract(), false);
+ reference.addReferenceBinding(binding);
+ parent.register(reference);
+
+ InboundWire source = parent.resolveAutowire(Source.class);
+ assertNotNull(source);
+ InboundWire sourceBase = parent.resolveAutowire(SourceBase.class);
+ assertSame(source, sourceBase);
+ EasyMock.verify(binding);
+ }
+
+
+ public static class SourceImpl implements Source, Source2 {
+ public SourceImpl() {
+ }
+ }
+
+ public static interface SourceBase {
+ }
+
+ public static interface Source extends SourceBase {
+ }
+
+ public static interface Source2 {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java
new file mode 100644
index 0000000000..2c47eab4ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainerMonitor;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+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 junit.framework.TestCase;
+import org.apache.tuscany.core.binding.local.LocalBindingBuilder;
+import org.apache.tuscany.core.binding.local.LocalBindingDefinition;
+import org.apache.tuscany.core.builder.BuilderRegistryImpl;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.java.JavaComponentBuilder;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.apache.tuscany.core.mock.component.OtherTarget;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class CompositeBuilderTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+
+ @SuppressWarnings("unchecked")
+ public void testBuild() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl(null, null, null, null);
+
+ CompositeBuilder builder = new CompositeBuilder();
+ WireService wireService = new JDKWireService();
+ builder.setWireService(wireService);
+ BuilderRegistryImpl builderRegistry = new BuilderRegistryImpl(null, wireService);
+ JavaComponentBuilder jBuilder = new JavaComponentBuilder();
+ jBuilder.setWireService(wireService);
+ builderRegistry.register(JavaImplementation.class, jBuilder);
+ builderRegistry.register(CompositeImplementation.class, builder);
+ builderRegistry.register(LocalBindingDefinition.class, new LocalBindingBuilder());
+ builder.setBuilderRegistry(builderRegistry);
+ CompositeComponent component =
+ (CompositeComponent) builder.build(parent, createTopComponentDef(), deploymentContext);
+
+ component.start();
+ CompositeComponent sourceComponent = (CompositeComponent) component.getChild("SourceComponent");
+ assertTrue(sourceComponent.getChild("InnerSourceService") instanceof Service);
+ AtomicComponent innerSourceComponent = (AtomicComponent) sourceComponent.getChild("InnerSourceComponent");
+ Source innerSourceInstance = (Source) deploymentContext.getCompositeScope().getInstance(innerSourceComponent);
+ assertNotNull(innerSourceInstance);
+ component.stop();
+ }
+
+ private ComponentDefinition createTopComponentDef() throws Exception {
+
+ CompositeComponentType<JavaMappedService, CompositeReferenceDefinition, JavaMappedProperty<?>> outerType =
+ new CompositeComponentType<JavaMappedService, CompositeReferenceDefinition, JavaMappedProperty<?>>();
+ outerType.add(createSourceComponentDef());
+ outerType.add(createTargetComponentDef());
+
+ CompositeImplementation outerImpl = new CompositeImplementation();
+ outerImpl.setComponentType(outerType);
+
+ return new ComponentDefinition<CompositeImplementation>(outerImpl);
+ }
+
+ private ComponentDefinition<CompositeImplementation> createSourceComponentDef() throws Exception {
+
+ CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, JavaMappedProperty<?>> innerType =
+ new CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, JavaMappedProperty<?>>();
+ innerType.add(createInnerSourceComponentDef());
+ CompositeReferenceDefinition reference = new CompositeReferenceDefinition();
+ reference.setName("TargetComponentRef");
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ JavaServiceContract targetContract = registry.introspect(Target.class);
+ reference.setServiceContract(targetContract);
+ innerType.add(reference);
+ ServiceDefinition service = new ServiceDefinition();
+ service.setName("InnerSourceService");
+ JavaServiceContract sourceContract = registry.introspect(Source.class);
+ service.setServiceContract(sourceContract);
+ service.setTarget(new URI("InnerSourceComponent"));
+ innerType.add(service);
+
+ CompositeImplementation innerImpl = new CompositeImplementation();
+ innerImpl.setComponentType(innerType);
+
+ ComponentDefinition<CompositeImplementation> sourceComponentDefinition =
+ new ComponentDefinition<CompositeImplementation>("SourceComponent", innerImpl);
+
+ /*ReferenceTarget refTarget = new ReferenceTarget();
+ refTarget.setReferenceName("TargetComponentRef");
+ refTarget.addTarget(new URI("TargetComponent"));
+ sourceComponentDefinition.add(refTarget);*/
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(innerType.getReferences().get("TargetComponentRef"));
+ compRef.setName("TargetComponentRef");
+ compRef.addTarget(new URI("TargetComponent"));
+ sourceComponentDefinition.add(compRef);
+
+ return sourceComponentDefinition;
+ }
+
+ private ComponentDefinition<JavaImplementation> createInnerSourceComponentDef() throws Exception {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> sourceType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ sourceType.setImplementationScope(Scope.COMPOSITE);
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setName("targetReference");
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> targetContract = registry.introspect(Target.class);
+ targetContract.setCallbackClass(OtherTarget.class);
+ targetContract.setCallbackName("OtherTarget");
+ reference.setServiceContract(targetContract);
+ reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
+ sourceType.add(reference);
+
+ ServiceContract<?> sourceContract = registry.introspect(Source.class);
+
+ JavaMappedService sourceServiceDefinition = new JavaMappedService();
+ sourceServiceDefinition.setName("Source");
+ sourceServiceDefinition.setServiceContract(sourceContract);
+
+ sourceType.add(sourceServiceDefinition);
+ sourceType.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(SourceImpl.class.getConstructor()));
+ JavaImplementation sourceImpl = new JavaImplementation(SourceImpl.class, sourceType);
+ ComponentDefinition<JavaImplementation> innerSourceComponentDefinition =
+ new ComponentDefinition<JavaImplementation>("InnerSourceComponent", sourceImpl);
+
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(sourceType.getReferences().get("targetReference"));
+ compRef.setName("targetReference");
+ compRef.addTarget(new URI("TargetComponentRef"));
+ innerSourceComponentDefinition.add(compRef);
+ /*ReferenceTarget refTarget = new ReferenceTarget();
+ refTarget.setReferenceName("targetReference");
+ refTarget.addTarget(new URI("TargetComponentRef"));
+ innerSourceComponentDefinition.add(refTarget);
+ */
+ return innerSourceComponentDefinition;
+ }
+
+ private ComponentDefinition<JavaImplementation> createTargetComponentDef() throws Exception {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> targetType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ targetType.setImplementationScope(Scope.COMPOSITE);
+
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> targetContract = registry.introspect(Target.class);
+ targetContract.setCallbackClass(OtherTarget.class);
+ targetContract.setCallbackName("OtherTarget");
+
+ JavaMappedService serviceDefinition = new JavaMappedService();
+ serviceDefinition.setName("Target");
+ serviceDefinition.setServiceContract(targetContract);
+ serviceDefinition.setCallbackReferenceName("otherTarget");
+
+ targetType.add(serviceDefinition);
+ targetType.setConstructorDefinition(new ConstructorDefinition<TargetImpl>(TargetImpl.class.getConstructor()));
+ JavaImplementation targetImpl = new JavaImplementation(TargetImpl.class, targetType);
+ return new ComponentDefinition<JavaImplementation>("TargetComponent", targetImpl);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ScopeContainerMonitor monitor = EasyMock.createNiceMock(ScopeContainerMonitor.class);
+ CompositeScopeContainer container = new CompositeScopeContainer(monitor);
+ container.start();
+ deploymentContext = new RootDeploymentContext(null, null, container, null);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java
new file mode 100644
index 0000000000..1f7c8618d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.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.core.implementation.composite;
+
+import java.util.Collections;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.Service;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentImplBasicTestCase extends TestCase {
+ private AtomicComponent component;
+
+ public void testGetScope() {
+ CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
+ Assert.assertEquals(Scope.SYSTEM, composite.getScope());
+ }
+
+ public void testReferencesServices() throws Exception {
+ CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ composite.register(getReference("bar"));
+ }
+
+ public void testOnEvent() {
+ CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
+ Event event = new Event() {
+ public Object getSource() {
+ return null;
+ }
+ };
+ RuntimeEventListener listener = createMock(RuntimeEventListener.class);
+ listener.onEvent(isA(CompositeStart.class));
+ listener.onEvent(eq(event));
+ expectLastCall();
+ replay(listener);
+ composite.addListener(listener);
+ composite.start();
+ composite.onEvent(event);
+ }
+
+ public void testPrepare() throws Exception {
+ CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
+ composite.prepare();
+ }
+
+ private Reference getReference(String name) throws InvalidServiceContractException {
+ ReferenceBinding binding = EasyMock.createNiceMock(ReferenceBinding.class);
+ EasyMock.expect(binding.isSystem()).andReturn(false).atLeastOnce();
+ InboundWire wire = TestUtils.createInboundWire(Bar.class);
+ wire.setContainer(binding);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+
+ binding.getName();
+ expectLastCall().andReturn(name).anyTimes();
+ replay(binding);
+
+ Reference reference = new ReferenceImpl(name, null, wire.getServiceContract());
+ reference.addReferenceBinding(binding);
+ return reference;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ component.getInboundWires();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.replay(component);
+ }
+
+ private interface Bar {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplSystemWireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplSystemWireTestCase.java
new file mode 100644
index 0000000000..018e068120
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplSystemWireTestCase.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.PrepareException;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.builder.ConnectorImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentImplSystemWireTestCase extends TestCase {
+
+ /**
+ * Verifies system services in a CompositeComponentImpl are wired during the parent composite's prepare callback
+ */
+ public void testSystemServiceWire() throws Exception {
+ InboundWire inbound = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(inbound.getServiceContract()).andReturn(new JavaServiceContract(Foo.class)).atLeastOnce();
+ inbound.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap()).atLeastOnce();
+
+ QualifiedName qName = new QualifiedName("target/bar");
+ OutboundWire outbound = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(outbound.getTargetName()).andReturn(qName).atLeastOnce();
+ EasyMock.expect(outbound.isAutowire()).andReturn(false);
+
+ outbound.setTargetWire(EasyMock.eq(inbound));
+ EasyMock.expect(outbound.getServiceContract()).andReturn(new JavaServiceContract(Foo.class)).atLeastOnce();
+ List<OutboundWire> wires = new ArrayList<OutboundWire>();
+ wires.add(outbound);
+ Map<String, List<OutboundWire>> wireMap = new HashMap<String, List<OutboundWire>>();
+ wireMap.put("ref", wires);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, new ConnectorImpl(), null);
+ AtomicComponent source = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(source.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(source.getOutboundWires()).andReturn(wireMap);
+ source.getInboundWires();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.expect(source.isSystem()).andReturn(true).atLeastOnce();
+ EasyMock.expect(source.getParent()).andReturn(parent).atLeastOnce();
+
+ source.prepare();
+ EasyMock.replay(source);
+
+ EasyMock.expect(outbound.getContainer()).andReturn(source).atLeastOnce();
+ EasyMock.replay(outbound);
+
+ parent.register(source);
+
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.getName()).andReturn("target").atLeastOnce();
+ EasyMock.expect(target.getInboundWire("bar")).andReturn(inbound).atLeastOnce();
+ List<InboundWire> inboundWires = new ArrayList<InboundWire>();
+ inboundWires.add(inbound);
+ EasyMock.expect(target.getInboundWires()).andReturn(inboundWires).atLeastOnce();
+ EasyMock.expect(target.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ EasyMock.expect(target.getParent()).andReturn(parent).atLeastOnce();
+
+ target.prepare();
+ target.getOutboundWires();
+ EasyMock.expectLastCall().andReturn(Collections.emptyMap());
+ EasyMock.expect(target.isSystem()).andReturn(true).atLeastOnce();
+ EasyMock.replay(target);
+
+ EasyMock.expect(inbound.getContainer()).andReturn(target);
+ EasyMock.replay(inbound);
+
+ parent.register(target);
+ parent.prepare();
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ EasyMock.verify(inbound);
+ EasyMock.verify(outbound);
+ }
+
+
+ /**
+ * Verifies an application component cannot be wired to a system service in the same composite
+ */
+ public void testSystemServiceIsolationWire() throws Exception {
+ InboundWire inbound = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(inbound.getServiceContract()).andReturn(new JavaServiceContract(Foo.class)).atLeastOnce();
+ EasyMock.replay(inbound);
+
+ QualifiedName qName = new QualifiedName("target/bar");
+ OutboundWire outbound = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(outbound.isAutowire()).andReturn(false);
+ EasyMock.expect(outbound.getContainer()).andReturn(EasyMock.createNiceMock(SCAObject.class));
+ EasyMock.expect(outbound.getReferenceName()).andReturn("foo");
+ EasyMock.expect(outbound.getTargetName()).andReturn(qName).atLeastOnce();
+ EasyMock.replay(outbound);
+
+ List<OutboundWire> wires = new ArrayList<OutboundWire>();
+ wires.add(outbound);
+ Map<String, List<OutboundWire>> wireMap = new HashMap<String, List<OutboundWire>>();
+ wireMap.put("ref", wires);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, new ConnectorImpl(), null);
+ AtomicComponent source = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ List<InboundWire> inboundWires = new ArrayList<InboundWire>();
+ inboundWires.add(inbound);
+ source.getInboundWires();
+ EasyMock.expectLastCall().andReturn(inboundWires).atLeastOnce();
+ EasyMock.expect(source.getOutboundWires()).andReturn(wireMap);
+ EasyMock.expect(source.isSystem()).andReturn(true).atLeastOnce();
+ EasyMock.expect(source.getParent()).andReturn(parent).atLeastOnce();
+ EasyMock.replay(source);
+
+ parent.register(source);
+
+ AtomicComponent target = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(target.getName()).andReturn("target").atLeastOnce();
+ inboundWires.add(inbound);
+ EasyMock.expect(target.getInboundWires()).andReturn(inboundWires).atLeastOnce();
+ EasyMock.expect(target.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.replay(target);
+
+ parent.register(target);
+ try {
+ parent.prepare();
+ fail();
+ } catch (PrepareException e) {
+ //expected
+ }
+ EasyMock.verify(source);
+ EasyMock.verify(target);
+ EasyMock.verify(inbound);
+ EasyMock.verify(outbound);
+ }
+
+
+ private class Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java
new file mode 100644
index 0000000000..eb57c6733d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplTestCase.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentImplTestCase extends TestCase {
+
+ public void testSetUri() throws Exception {
+ CompositeComponentImpl component = new CompositeComponentImpl("foo", "foo/bar", null, null, null);
+ assertEquals("foo/bar", component.getURI());
+ }
+
+ public void testRegisterSystemService() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ assertNull(parent.getChild("bar"));
+ assertNotNull(parent.getSystemChild("bar"));
+ EasyMock.verify(component);
+ }
+
+ public void testRegister() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ assertNull(parent.getSystemChild("bar"));
+ assertNotNull(parent.getChild("bar"));
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verifies a system service and application component can be registered with the same name in a composite
+ */
+ public void testSystemServiceApplicationNamespaceIsolation() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ AtomicComponent component2 = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component2.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.expect(component2.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component2);
+ parent.register(component2);
+ EasyMock.verify(component);
+ EasyMock.verify(component2);
+ }
+
+ public void testSystemServiceLifecycle() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ component.stop();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ parent.start();
+ parent.stop();
+ EasyMock.verify(component);
+ }
+
+ public void testComponentLifecycle() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ component.stop();
+ EasyMock.replay(component);
+ parent.register(component);
+ parent.start();
+ parent.stop();
+ EasyMock.verify(component);
+ }
+
+ public void testSystemAutowire() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ component.stop();
+ EasyMock.replay(component);
+ parent.register(component);
+ parent.start();
+ assertNull(parent.resolveSystemExternalAutowire(Foo.class));
+ assertNotNull(parent.resolveSystemAutowire(Foo.class));
+ parent.stop();
+ EasyMock.verify(component);
+ }
+
+
+ public void testAutowire() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ component.stop();
+ EasyMock.replay(component);
+ parent.register(component);
+ parent.start();
+ assertNull(parent.resolveExternalAutowire(Foo.class));
+ assertNotNull(parent.resolveAutowire(Foo.class));
+ parent.stop();
+ EasyMock.verify(component);
+ }
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentResolutionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentResolutionTestCase.java
new file mode 100644
index 0000000000..f24e1f8e94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentResolutionTestCase.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 org.apache.tuscany.core.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.apache.tuscany.core.mock.component.Source;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies an atomic component can be resolved from its parent
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class CompositeComponentResolutionTestCase extends TestCase {
+
+ public void testSystemComponentResolution() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("foo", null, null, true);
+ parent.start();
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ assertNull(parent.getChild("source"));
+ assertTrue(parent.getSystemChild("source") instanceof AtomicComponent);
+ EasyMock.verify(component);
+ }
+
+ public void testComponentResolution() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("foo", null, null, null);
+ parent.start();
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ assertNull(parent.getSystemChild("source"));
+ assertTrue(parent.getChild("source") instanceof AtomicComponent);
+ EasyMock.verify(component);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLifecycleTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLifecycleTestCase.java
new file mode 100644
index 0000000000..f5d209fe4c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLifecycleTestCase.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.core.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.apache.tuscany.core.mock.component.Source;
+import org.easymock.EasyMock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class CompositeLifecycleTestCase extends TestCase {
+
+ public void testLifecycle() throws Exception {
+ CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
+ composite.start();
+ assertNull(composite.getChild("nothtere"));
+ composite.stop();
+ composite.start();
+ assertNull(composite.getChild("nothtere"));
+ composite.stop();
+ }
+
+ public void testSystemRestart() throws Exception {
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ component.stop();
+ EasyMock.expectLastCall().times(2);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+
+ EasyMock.replay(component);
+
+ CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
+ composite.start();
+ composite.register(component);
+
+ assertTrue(composite.getSystemChild("source") instanceof AtomicComponent);
+ composite.stop();
+ composite.start();
+ assertTrue(composite.getSystemChild("source") instanceof AtomicComponent);
+ composite.stop();
+ EasyMock.verify(component);
+ }
+
+ public void testRestart() throws Exception {
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.start();
+ component.stop();
+ EasyMock.expectLastCall().times(2);
+ EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+
+ EasyMock.replay(component);
+
+ CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
+ composite.start();
+ composite.register(component);
+
+ assertTrue(composite.getChild("source") instanceof AtomicComponent);
+ composite.stop();
+ composite.start();
+ assertTrue(composite.getChild("source") instanceof AtomicComponent);
+ composite.stop();
+ EasyMock.verify(component);
+ }
+
+ public void testChildStoppedBeforeParent() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
+ CompositeComponent child = new CompositeComponentImpl("child", null, null, null);
+ parent.register(child);
+ parent.start();
+ child.stop();
+ parent.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java
new file mode 100644
index 0000000000..9906528a84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeLoaderWireResolutionTestCase.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.InvalidPromotedReferenceException;
+import org.apache.tuscany.spi.loader.InvalidWireException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeReferenceDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.model.WireDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+
+/**
+ * This class tests the wire resolution function of the composite loader
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeLoaderWireResolutionTestCase extends TestCase {
+ private CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>> componentType;
+ private CompositeLoader compositeLoader = new CompositeLoader(null, null);
+
+ public void setUp() throws Exception {
+ componentType = new CompositeComponentType<ServiceDefinition, CompositeReferenceDefinition, Property<?>>();
+ componentType.setName("TestComposite");
+ //add a service to the composite
+ ServiceDefinition serviceDefn = new ServiceDefinition("compositeService1", null, true);
+ ServiceDefinition boundSvcDefn = new ServiceDefinition("boundSvc", null, true, null);
+ ServiceDefinition boundSvcDefnWithTarget =
+ new ServiceDefinition("boundSvcWithTarget", null, true);
+ boundSvcDefnWithTarget.setTarget(new URI("orgTarget"));
+ componentType.add(serviceDefn);
+ componentType.add(boundSvcDefn);
+ componentType.add(boundSvcDefnWithTarget);
+
+ CompositeReferenceDefinition compositeReference = new CompositeReferenceDefinition("compositeReference", null);
+ componentType.add(compositeReference);
+
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> pojoComponentType1 =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ServiceDefinition pojoSvc1 = new ServiceDefinition("pojoSvc1", null, false);
+ pojoComponentType1.add(pojoSvc1);
+ ComponentTypeReferenceDefinition pojoRef1 = new ComponentTypeReferenceDefinition("pojoRef1", null);
+ pojoComponentType1.add(pojoRef1);
+ JavaImplementation pojoImpl1 = new JavaImplementation(null, pojoComponentType1);
+
+ ComponentDefinition<JavaImplementation> component1 =
+ new ComponentDefinition<JavaImplementation>("Component1", pojoImpl1);
+ component1.add(new ComponentReferenceDefinition(pojoRef1));
+ componentType.add(component1);
+
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> pojoComponentType2 =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ServiceDefinition pojoSvc2 = new ServiceDefinition("pojoSvc2", null, false);
+ pojoComponentType2.add(pojoSvc2);
+ ServiceDefinition pojoSvc3 = new ServiceDefinition("pojoSvc3", null, false);
+ pojoComponentType2.add(pojoSvc3);
+ ComponentTypeReferenceDefinition pojoRef2 = new ComponentTypeReferenceDefinition("pojoRef2", null);
+ pojoComponentType2.add(pojoRef2);
+ ComponentTypeReferenceDefinition pojoRef3 = new ComponentTypeReferenceDefinition("pojoRef3", null);
+ pojoComponentType2.add(pojoRef3);
+ JavaImplementation pojoImpl2 = new JavaImplementation(null, pojoComponentType2);
+
+ ComponentDefinition<JavaImplementation> component2 =
+ new ComponentDefinition<JavaImplementation>("Component2", pojoImpl2);
+ component2.add(new ComponentReferenceDefinition(pojoRef2));
+ component2.add(new ComponentReferenceDefinition(pojoRef3));
+ componentType.add(component2);
+ }
+
+ public void testCompositeSvc2CompositeReferenceWire() throws Exception {
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("compositeReference"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testCompositeSvc2ComponentValid() throws Exception {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("Component1"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testCompositeSvc2ComponentQualifiedValid() throws Exception {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("Component2/pojoSvc3"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testCompositeSvc2ComponentQualifiedInvalid() throws URISyntaxException, InvalidPromotedReferenceException {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("Component2/pojoSvc5"));
+ componentType.add(wireDefn);
+ try {
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+ }
+
+ public void testCompositeSvc2ComponentUnQualifiedInvalid() throws URISyntaxException, InvalidPromotedReferenceException {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("Component2"));
+ componentType.add(wireDefn);
+ try {
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+ }
+
+ public void testComponent2CompositeReferenceValid() throws Exception {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("Component1"));
+ wireDefn.setTarget(new URI("compositeReference"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testComponent2CompositeReferenceQualifiedValid() throws Exception {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("Component2/pojoRef3"));
+ wireDefn.setTarget(new URI("compositeReference"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testComponent2CompositeReferenceUnQualifiedInvalid() throws URISyntaxException, InvalidPromotedReferenceException {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("Component2"));
+ wireDefn.setTarget(new URI("compositeReference"));
+ componentType.add(wireDefn);
+
+ try {
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+ }
+
+ public void testComponent2ComponentQualifedValid() throws Exception {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("Component1"));
+ wireDefn.setTarget(new URI("Component2/pojoSvc3"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ }
+
+ public void testComponent2ComponentUnQualifedInvalid() throws URISyntaxException, InvalidPromotedReferenceException {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("Component1"));
+ wireDefn.setTarget(new URI("Component2"));
+ componentType.add(wireDefn);
+ try {
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidWireDefinitions() throws URISyntaxException, InvalidPromotedReferenceException {
+ //undefined source and targets
+ WireDefinition wireDefn = new WireDefinition();
+ wireDefn.setSource(new URI("undefinedSource"));
+ wireDefn.setTarget(new URI("compositeReference"));
+ componentType.add(wireDefn);
+
+ try {
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+
+ try {
+ wireDefn.setSource(new URI("compositeService1"));
+ wireDefn.setTarget(new URI("undefinedTarget"));
+ componentType.add(wireDefn);
+ compositeLoader.resolveWires(componentType);
+ fail();
+ } catch (InvalidWireException e) {
+ // expected
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositePropagationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositePropagationTestCase.java
new file mode 100644
index 0000000000..36e6e98809
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositePropagationTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.apache.tuscany.core.mock.component.Source;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositePropagationTestCase extends TestCase {
+
+ private CompositeComponent parent;
+ private CompositeComponent child2;
+
+ public void testSystemLifecyclePropagation() throws Exception {
+ parent.start();
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = createMock(AtomicComponent.class);
+ expect(component.getName()).andReturn("source").anyTimes();
+ component.stop();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+
+ replay(component);
+ child2.register(component);
+ parent.stop();
+ verify(component);
+ }
+
+ public void testLifecyclePropagation() throws Exception {
+ parent.start();
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component = createMock(AtomicComponent.class);
+ expect(component.getName()).andReturn("source").anyTimes();
+ component.stop();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ replay(component);
+ child2.register(component);
+ parent.stop();
+ verify(component);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parent = new CompositeComponentImpl("parent", null, null, null);
+ CompositeComponent child1 = new CompositeComponentImpl("child1", parent, null, null);
+ child2 = new CompositeComponentImpl("child2", child1, null, null);
+ child1.register(child2);
+ parent.register(child1);
+ }
+
+ protected void tearDown() throws Exception {
+ parent.stop();
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java
new file mode 100644
index 0000000000..72c2ffd827
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/DuplicateRegistrationTestCase.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.DuplicateNameException;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.TestUtils;
+import org.apache.tuscany.core.mock.component.Source;
+import org.easymock.EasyMock;
+
+/**
+ * Verfies children with the same name cannot be registered in the same composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateRegistrationTestCase extends TestCase {
+
+ public void testDuplicateRegistration() throws Exception {
+ CompositeComponent parent = new CompositeComponentImpl(null, null, null, null);
+ parent.start();
+
+ List<Class<?>> interfaces = new ArrayList<Class<?>>();
+ interfaces.add(Source.class);
+ AtomicComponent component1 = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component1.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component1.isSystem()).andReturn(true).atLeastOnce();
+ component1.stop();
+ List<InboundWire> wires = TestUtils.createInboundWires(interfaces);
+ TestUtils.populateInboundWires(component1, wires);
+ EasyMock.expect(component1.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component1);
+
+ AtomicComponent component2 = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component2.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
+ component2.stop();
+ EasyMock.replay(component2);
+
+ parent.register(component1);
+ try {
+ parent.register(component2);
+ fail();
+ } catch (DuplicateNameException e) {
+ // ok
+ }
+ parent.stop();
+ }
+
+ public void testDuplicateNameSystemService() throws Exception {
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Source.class);
+ CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ List<InboundWire> wires = TestUtils.createInboundWires(services);
+ TestUtils.populateInboundWires(component, wires);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.replay(component);
+ parent.register(component);
+ AtomicComponent component2 = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
+ EasyMock.replay(component2);
+ try {
+ parent.register(component2);
+ fail();
+ } catch (DuplicateNameException e) {
+ // expected
+ }
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoaderTestCase.java
new file mode 100644
index 0000000000..7d4ebc1ac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ImplementationCompositeLoaderTestCase.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.core.implementation.composite;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.deployer.CompositeClassLoader;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.services.artifact.Artifact;
+import org.apache.tuscany.spi.services.artifact.ArtifactRepository;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reportMatcher;
+import static org.easymock.EasyMock.verify;
+import org.easymock.IArgumentMatcher;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationCompositeLoaderTestCase extends TestCase {
+ private static final QName IMPLEMENTATION_COMPOSITE = new QName(SCA_NS, "implementation.composite");
+
+ private ClassLoader cl;
+ private ImplementationCompositeLoader loader;
+ private XMLStreamReader reader;
+ private DeploymentContext context;
+ private ArtifactRepository artifactRepository;
+
+ public void testName() throws LoaderException, XMLStreamException, MalformedURLException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(IMPLEMENTATION_COMPOSITE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "group")).andReturn(null);
+ expect(reader.getAttributeValue(null, "version")).andReturn(null);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn(null);
+ expect(reader.getAttributeValue(null, "jarLocation")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ replay(reader);
+
+ replay(context);
+ replay(artifactRepository);
+
+ CompositeImplementation impl = loader.load(null, null, reader, context);
+ verify(reader);
+ verify(context);
+ verify(artifactRepository);
+ assertEquals(name, impl.getName());
+ assertNull(impl.getScdlLocation());
+ assertNull(impl.getClassLoader());
+ }
+
+ public void testWithArtifact() throws LoaderException, XMLStreamException, MalformedURLException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(IMPLEMENTATION_COMPOSITE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "group")).andReturn("com.example");
+ expect(reader.getAttributeValue(null, "version")).andReturn("1.0");
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn(null);
+ expect(reader.getAttributeValue(null, "jarLocation")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ replay(reader);
+
+ expect(context.getClassLoader()).andReturn(cl);
+ replay(context);
+ URL url = new URL("http://www.example.com/sca/base.jar");
+ artifactRepository.resolve(artifactMatcher(url, "com.example", name, "1.0"));
+ replay(artifactRepository);
+
+ CompositeImplementation impl = loader.load(null, null, reader, context);
+ verify(reader);
+ verify(context);
+ verify(artifactRepository);
+ assertEquals(name, impl.getName());
+ assertEquals(new URL("jar:http://www.example.com/sca/base.jar!/META-INF/sca/default.scdl"),
+ impl.getScdlLocation());
+ assertTrue(impl.getClassLoader() instanceof CompositeClassLoader);
+ }
+
+ public void testWithScdlLocation() throws LoaderException, XMLStreamException, MalformedURLException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(IMPLEMENTATION_COMPOSITE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "group")).andReturn(null);
+ expect(reader.getAttributeValue(null, "version")).andReturn(null);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn("bar.scdl");
+ expect(reader.getAttributeValue(null, "jarLocation")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ replay(reader);
+
+ expect(context.getScdlLocation()).andReturn(new URL("http://www.example.com/sca/base.scdl"));
+ expect(context.getClassLoader()).andReturn(cl);
+ replay(context);
+ replay(artifactRepository);
+
+ CompositeImplementation impl = loader.load(null, null, reader, context);
+ verify(reader);
+ verify(context);
+ verify(artifactRepository);
+ assertEquals(name, impl.getName());
+ assertEquals(new URL("http://www.example.com/sca/bar.scdl"), impl.getScdlLocation());
+ assertSame(cl, impl.getClassLoader());
+ }
+
+ public void testWithJarLocation() throws LoaderException, XMLStreamException, MalformedURLException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(IMPLEMENTATION_COMPOSITE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "group")).andReturn(null);
+ expect(reader.getAttributeValue(null, "version")).andReturn(null);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn(null);
+ expect(reader.getAttributeValue(null, "jarLocation")).andReturn("bar.jar");
+ expect(reader.next()).andReturn(END_ELEMENT);
+ replay(reader);
+
+ expect(context.getScdlLocation()).andReturn(new URL("http://www.example.com/sca/base.scdl"));
+ expect(context.getClassLoader()).andReturn(cl);
+ replay(context);
+ replay(artifactRepository);
+
+ CompositeImplementation impl = loader.load(null, null, reader, context);
+ verify(reader);
+ verify(context);
+ verify(artifactRepository);
+ assertEquals(name, impl.getName());
+ assertEquals(new URL("jar:http://www.example.com/sca/bar.jar!/META-INF/sca/default.scdl"),
+ impl.getScdlLocation());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ artifactRepository = createMock(ArtifactRepository.class);
+ reader = createMock(XMLStreamReader.class);
+ context = createMock(DeploymentContext.class);
+ cl = getClass().getClassLoader();
+ loader = new ImplementationCompositeLoader(null, artifactRepository);
+ }
+
+ protected static Artifact artifactMatcher(final URL url,
+ final String group,
+ final String name,
+ final String version) {
+ reportMatcher(new IArgumentMatcher() {
+
+ public boolean matches(Object object) {
+ if (!(object instanceof Artifact)) {
+ return false;
+ }
+
+ Artifact artifact = (Artifact) object;
+ boolean match = group.equals(artifact.getGroup())
+ && name.equals(artifact.getName())
+ && version.equals(artifact.getVersion())
+ && "jar".equals(artifact.getType());
+ if (match) {
+ artifact.setUrl(url);
+ }
+ return match;
+ }
+
+ public void appendTo(StringBuffer stringBuffer) {
+ stringBuffer.append(group).append(':').append(name).append(':').append(version);
+ }
+ });
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/JavaObjectRegistrationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/JavaObjectRegistrationTestCase.java
new file mode 100644
index 0000000000..f0fdd8b704
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/JavaObjectRegistrationTestCase.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.implementation.composite;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.DuplicateNameException;
+import org.apache.tuscany.spi.component.SCAObject;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaObjectRegistrationTestCase extends TestCase {
+ private CompositeComponent composite;
+
+ public void testRegistration() throws Exception {
+ MockComponent instance = new MockComponent();
+ composite.registerJavaObject("foo", MockComponent.class, instance);
+ SCAObject child = composite.getSystemChild("foo");
+ assertTrue(child instanceof AtomicComponent);
+ MockComponent resolvedInstance = (MockComponent) ((AtomicComponent) child).getTargetInstance();
+ assertSame(instance, resolvedInstance);
+ }
+
+ public void testDuplicateRegistration() throws Exception {
+ MockComponent instance = new MockComponent();
+ composite.registerJavaObject("foo", MockComponent.class, instance);
+ try {
+ composite.registerJavaObject("foo", MockComponent.class, instance);
+ fail();
+ } catch (DuplicateNameException e) {
+ // ok
+ }
+ }
+
+ public void testSystemAutowireToObject() throws Exception {
+ MockComponent instance = new MockComponent();
+ composite.registerJavaObject("foo", MockComponent.class, instance);
+ assertSame(instance, composite.resolveSystemAutowire(MockComponent.class).getTargetService());
+ assertNull(composite.resolveSystemExternalAutowire(MockComponent.class));
+ }
+
+ public void testApplicationAutowireToObject() throws Exception {
+ MockComponent instance = new MockComponent();
+ composite.registerJavaObject("foo", MockComponent.class, instance);
+ assertNotNull(composite.resolveAutowire(MockComponent.class));
+ assertNull(composite.resolveExternalAutowire(MockComponent.class));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ composite = new CompositeComponentImpl(null, null, null, null);
+ composite.start();
+ composite.publish(new CompositeStart(this, null));
+ }
+
+ protected void tearDown() throws Exception {
+ composite.publish(new CompositeStop(this, null));
+ composite.stop();
+ super.tearDown();
+ }
+
+ private static class MockComponent {
+ public String hello(String message) {
+ return message;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.java
new file mode 100644
index 0000000000..12299e762b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContextTestCase.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.implementation.composite;
+
+import org.osoa.sca.RequestContext;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ManagedRequestContextTestCase extends TestCase {
+
+ public void testGetServiceName() {
+ WorkContext workContext = EasyMock.createMock(WorkContext.class);
+ EasyMock.expect(workContext.getCurrentServiceName()).andReturn("foo");
+ EasyMock.replay(workContext);
+ RequestContext context = new ManagedRequestContext(workContext);
+ assertEquals("foo", context.getServiceName());
+ EasyMock.verify(workContext);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.java
new file mode 100644
index 0000000000..251833a554
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ReferenceImplTestCase.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.implementation.composite;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceImplTestCase extends TestCase {
+
+ public void testStart() {
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ binding.setReference(EasyMock.isA(Reference.class));
+ binding.start();
+ EasyMock.replay(binding);
+ Reference reference = new ReferenceImpl(null, null, null);
+ reference.addReferenceBinding(binding);
+ reference.start();
+ EasyMock.verify(binding);
+
+ }
+
+ public void testStop() {
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ binding.setReference(EasyMock.isA(Reference.class));
+ binding.stop();
+ EasyMock.replay(binding);
+ Reference reference = new ReferenceImpl(null, null, null);
+ reference.addReferenceBinding(binding);
+ reference.stop();
+ EasyMock.verify(binding);
+
+ }
+
+ public void testIsSystem() {
+ Reference service = new ReferenceImpl(null, null, null, true);
+ assertTrue(service.isSystem());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.java
new file mode 100644
index 0000000000..88d40a50eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/ServiceImplTestCase.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.implementation.composite;
+
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.component.ServiceBinding;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceImplTestCase extends TestCase {
+
+ public void testStart() {
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ binding.setService(EasyMock.isA(Service.class));
+ binding.start();
+ EasyMock.replay(binding);
+ Service service = new ServiceImpl(null, null, null);
+ service.addServiceBinding(binding);
+ service.start();
+ EasyMock.verify(binding);
+
+ }
+
+ public void testStop() {
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ binding.setService(EasyMock.isA(Service.class));
+ binding.stop();
+ EasyMock.replay(binding);
+ Service service = new ServiceImpl(null, null, null);
+ service.addServiceBinding(binding);
+ service.stop();
+ EasyMock.verify(binding);
+
+ }
+
+ public void testIsSystem() {
+ Service service = new ServiceImpl(null, null, null, null, true);
+ assertTrue(service.isSystem());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemComponentBuilderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemComponentBuilderTestCase.java
new file mode 100644
index 0000000000..4645075a7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemComponentBuilderTestCase.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.composite;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.implementation.system.builder.SystemComponentBuilder;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SystemComponentBuilderTestCase extends TestCase {
+
+ CompositeComponent parent;
+ DeploymentContext deploymentContext;
+ SystemComponentBuilder builder = new SystemComponentBuilder();
+ CompositeScopeContainer container;
+
+ /**
+ * Verifies lifecycle callbacks are made
+ */
+ public void testLifecycleBuild() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setInitLevel(50);
+ Method initMethod = FooImpl.class.getMethod("init");
+ initMethod.setAccessible(true);
+ type.setInitMethod(initMethod);
+ Method destroyMethod = FooImpl.class.getMethod("destroy");
+ destroyMethod.setAccessible(true);
+ type.setDestroyMethod(destroyMethod);
+ type.setImplementationScope(Scope.COMPOSITE);
+ ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
+ type.setConstructorDefinition(ctorDef);
+ SystemImplementation impl = new SystemImplementation();
+ impl.setComponentType(type);
+ impl.setImplementationClass(FooImpl.class);
+ ComponentDefinition<SystemImplementation> definition = new ComponentDefinition<SystemImplementation>(impl);
+ AtomicComponent component = builder.build(parent, definition, deploymentContext);
+ component.setScopeContainer(container);
+ component.start();
+ container.onEvent(new CompositeStart(this, null));
+ FooImpl foo = (FooImpl) component.getTargetInstance();
+ assertTrue(foo.initialized);
+ container.onEvent(new CompositeStop(this, null));
+ assertTrue(foo.destroyed);
+ }
+
+ /**
+ * Verifies properties are built properly
+ */
+ public void testPropertyBuild() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setInitLevel(50);
+ Method initMethod = FooImpl.class.getMethod("init");
+ initMethod.setAccessible(true);
+ type.setInitMethod(initMethod);
+ Method destroyMethod = FooImpl.class.getMethod("destroy");
+ destroyMethod.setAccessible(true);
+ type.setDestroyMethod(destroyMethod);
+ type.setImplementationScope(Scope.COMPOSITE);
+ JavaMappedProperty mappedProp = new JavaMappedProperty();
+ mappedProp.setName("prop");
+ Method propMethod = FooImpl.class.getMethod("setProp", String.class);
+ propMethod.setAccessible(true);
+ mappedProp.setMember(propMethod);
+ type.add(mappedProp);
+ ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
+ type.setConstructorDefinition(ctorDef);
+ SystemImplementation impl = new SystemImplementation();
+ impl.setComponentType(type);
+ impl.setImplementationClass(FooImpl.class);
+ ComponentDefinition<SystemImplementation> definition = new ComponentDefinition<SystemImplementation>(impl);
+ PropertyValue<String> propVal = new PropertyValue<String>();
+ propVal.setName("prop");
+ propVal.setValueFactory(new SingletonObjectFactory<String>("value"));
+ definition.add(propVal);
+ AtomicComponent component = builder.build(parent, definition, deploymentContext);
+ component.setScopeContainer(container);
+ component.start();
+ FooImpl foo = (FooImpl) component.getTargetInstance();
+ assertEquals("value", foo.prop);
+ container.onEvent(new CompositeStop(this, null));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ container = new CompositeScopeContainer(null);
+ container.start();
+ deploymentContext = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(deploymentContext.getCompositeScope()).andReturn(container).atLeastOnce();
+ EasyMock.replay(deploymentContext);
+ }
+
+ private static interface Foo {
+
+ }
+
+ private static class FooImpl implements Foo {
+ private boolean initialized;
+ private boolean destroyed;
+ private String prop;
+ private Foo ref;
+
+ public FooImpl() {
+ }
+
+ public void init() {
+ if (initialized) {
+ fail();
+ }
+ initialized = true;
+ }
+
+ public void destroy() {
+ if (destroyed) {
+ fail();
+ }
+ destroyed = true;
+ }
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ public String getProp() {
+ return prop;
+ }
+
+ public void setProp(String prop) {
+ this.prop = prop;
+ }
+
+ public Foo getRef() {
+ return ref;
+ }
+
+ public void setRef(Foo ref) {
+ this.ref = ref;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponentTestCase.java
new file mode 100644
index 0000000000..9c482b994f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponentTestCase.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.implementation.composite;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.TargetException;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SystemSingletonAtomicComponentTestCase extends TestCase {
+
+ public void testGetInstance() throws TargetException {
+ FooImpl foo = new FooImpl();
+ SystemSingletonAtomicComponent<Foo, FooImpl> component =
+ new SystemSingletonAtomicComponent<Foo, FooImpl>("foo", null, Foo.class, foo);
+ assertEquals(foo, component.getTargetInstance());
+ }
+
+ public void testGetInstanceMultipleServices() throws TargetException {
+ FooImpl foo = new FooImpl();
+ List<Class<?>> services = new ArrayList<Class<?>>();
+ services.add(Foo.class);
+ services.add(Bar.class);
+ SystemSingletonAtomicComponent<Foo, FooImpl> component =
+ new SystemSingletonAtomicComponent<Foo, FooImpl>("foo", null, services, foo);
+ assertEquals(foo, component.getTargetInstance());
+ }
+
+ private interface Foo {
+
+ }
+
+ private interface Bar {
+
+ }
+
+ private class FooImpl implements Foo, Bar {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentMetadataInjectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentMetadataInjectionTestCase.java
new file mode 100644
index 0000000000..5186119345
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentMetadataInjectionTestCase.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.implementation.java;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests SCA metadata such as <code>@ComponentName</code> and <code>@SCAObject</code> are handled properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaAtomicComponentMetadataInjectionTestCase extends TestCase {
+
+ public void testComponentNameSet() throws Exception {
+ // TODO implement
+ }
+
+ public void testCompositeContextSet() throws Exception {
+ // TODO implement
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentNegativeMetadataTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentNegativeMetadataTestCase.java
new file mode 100644
index 0000000000..dfd62c8c53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponentNegativeMetadataTestCase.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.core.implementation.java;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Performs rudimentary negative testing by using malformed metadata on a POJO
+ *
+ * @version $Rev $Date
+ */
+public class JavaAtomicComponentNegativeMetadataTestCase extends TestCase {
+
+ /**
+ * Tests that a pojo with <code>@ComponentName</code> specified on a non-String type generates an error.
+ * <p/>
+ * <strong>NB:</strong> the test assumes an error with a message containing "@ComponentName" is generated
+ */
+ public void testBadNameType() throws Exception {
+ // TODO implement
+ }
+
+ /**
+ * Tests that a pojo with <code>@Context</code> specified on a non-CompositeContext type generates an error.
+ * <p/>
+ * <strong>NB:</strong> the test assumes an error with a message containing "@Context" is generated
+ */
+ public void testContextType() throws Exception {
+ // TODO implement
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java
new file mode 100644
index 0000000000..d484a5d944
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaBuilderPropertyTestCase.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies that the java component builder handles configured properties correctly
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaBuilderPropertyTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+ private CompositeComponent parent;
+ private ScopeRegistry registry;
+
+ @SuppressWarnings("unchecked")
+ public void testPropertyHandling() throws Exception {
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ builder.setScopeRegistry(registry);
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>>();
+ JavaMappedProperty<String> property = new JavaMappedProperty<String>();
+ property.setName("test");
+ property.setDefaultValueFactory(new SingletonObjectFactory<String>("foo"));
+ property.setMember(JavaBuilderPropertyTestCase.Foo.class.getMethod("setTest", String.class));
+ type.add(property);
+ type.setConstructorDefinition(new ConstructorDefinition<Foo>(Foo.class.getConstructor((Class[]) null)));
+ type.setImplementationScope(Scope.STATELESS);
+ JavaImplementation impl = new JavaImplementation(Foo.class, type);
+ ComponentDefinition<JavaImplementation> definition = new ComponentDefinition<JavaImplementation>(impl);
+ PropertyValue propertyValue = new PropertyValue(property.getName(), property.getDefaultValueFactory());
+ definition.getPropertyValues().put(property.getName(), propertyValue);
+ AtomicComponent component = builder.build(parent, definition, deploymentContext);
+ JavaBuilderPropertyTestCase.Foo foo = (JavaBuilderPropertyTestCase.Foo) component.createInstance();
+ assertEquals("foo", foo.getTest());
+ }
+
+ public void testIntPropertyHandling() throws Exception {
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ builder.setScopeRegistry(registry);
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>>();
+ JavaMappedProperty<Integer> property = new JavaMappedProperty<Integer>();
+ property.setName("test");
+ property.setDefaultValueFactory(new SingletonObjectFactory<Integer>(1));
+ property.setMember(JavaBuilderPropertyTestCase.FooInt.class.getMethod("setTest", Integer.TYPE));
+ type.add(property);
+ type.setConstructorDefinition(new ConstructorDefinition<FooInt>(FooInt.class.getConstructor((Class[]) null)));
+ type.setImplementationScope(Scope.STATELESS);
+ JavaImplementation impl = new JavaImplementation(Foo.class, type);
+ ComponentDefinition<JavaImplementation> definition = new ComponentDefinition<JavaImplementation>(impl);
+ ObjectFactory<?> defaultValueFactory = property.getDefaultValueFactory();
+ PropertyValue<Integer> propertyValue =
+ new PropertyValue<Integer>(property.getName(), defaultValueFactory);
+ definition.getPropertyValues().put(property.getName(), propertyValue);
+ AtomicComponent component = builder.build(parent, definition, deploymentContext);
+ FooInt foo = (FooInt) component.createInstance();
+ assertEquals(1, foo.getTest());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ deploymentContext = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.replay(deploymentContext);
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ ScopeContainer mockContainer = EasyMock.createNiceMock(ScopeContainer.class);
+ EasyMock.replay(mockContainer);
+ registry = EasyMock.createMock(ScopeRegistry.class);
+ EasyMock.expect(registry.getScopeContainer(EasyMock.isA(Scope.class))).andReturn(mockContainer);
+ EasyMock.replay(registry);
+ }
+
+ private static class Foo {
+ private String test;
+
+ public Foo() {
+ }
+
+ public String getTest() {
+ return test;
+ }
+
+ public void setTest(String test) {
+ this.test = test;
+ }
+ }
+
+ private static class FooInt {
+ private int test;
+
+ public FooInt() {
+ }
+
+ public int getTest() {
+ return test;
+ }
+
+ public void setTest(int test) {
+ this.test = test;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderConversationIDTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderConversationIDTestCase.java
new file mode 100644
index 0000000000..5c83af0e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderConversationIDTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.java;
+
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * @version $Rev: 473859 $ $Date: 2006-11-11 22:31:55 -0500 (Sat, 11 Nov 2006) $
+ */
+public class JavaComponentBuilderConversationIDTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testResourceInjection() throws Exception {
+ ScopeContainer container = EasyMock.createNiceMock(ScopeContainer.class);
+ ScopeRegistry registry = EasyMock.createMock(ScopeRegistry.class);
+ EasyMock.expect(registry.getScopeContainer(Scope.STATELESS)).andReturn(container);
+ EasyMock.replay(registry);
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ builder.setScopeRegistry(registry);
+ WorkContext workContext = new WorkContextImpl();
+ workContext.setIdentifier(Scope.CONVERSATION, "convID");
+ builder.setWorkContext(workContext);
+
+ ConstructorDefinition<Foo> ctorDef = new ConstructorDefinition<Foo>(Foo.class.getConstructor());
+ PojoComponentType type = new PojoComponentType();
+ Field field = Foo.class.getDeclaredField("conversationID");
+ type.setConversationIDMember(field);
+ type.setImplementationScope(Scope.STATELESS);
+ type.setConstructorDefinition(ctorDef);
+
+ JavaImplementation impl = new JavaImplementation(Foo.class, type);
+ ComponentDefinition<JavaImplementation> definition = new ComponentDefinition<JavaImplementation>("foo", impl);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, null);
+ Foo foo = (Foo) component.createInstance();
+ assertEquals("convID", foo.conversationID);
+ }
+
+ private static class Foo {
+
+ @ConversationID
+ protected String conversationID;
+
+ public Foo() {
+ }
+
+ }
+}
+
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderMetadataTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderMetadataTestCase.java
new file mode 100644
index 0000000000..e4adae73d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderMetadataTestCase.java
@@ -0,0 +1,112 @@
+package org.apache.tuscany.core.implementation.java;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies component type metadata is properly applied to the component
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaComponentBuilderMetadataTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+ private Constructor<SourceImpl> constructor;
+ private CompositeComponent parent;
+ private PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+ private ComponentDefinition<JavaImplementation> definition;
+ private ScopeContainer scopeContainer;
+
+ public void testInitLevel() throws Exception {
+ type.setInitLevel(1);
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ assertEquals(1, component.getInitLevel());
+ }
+
+ public void testMaxAge() throws Exception {
+ type.setMaxAge(100);
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ assertEquals(100, component.getMaxAge());
+ }
+
+ public void testMaxIdleTime() throws Exception {
+ type.setMaxIdleTime(100);
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ assertEquals(100, component.getMaxIdleTime());
+ }
+
+ public void testNoMaxAgeNoMaxIdleTime() throws Exception {
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ assertEquals(-1, component.getMaxAge());
+ assertEquals(-1, component.getMaxIdleTime());
+ }
+
+ public void testScope() throws Exception {
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ component.setScopeContainer(scopeContainer);
+ assertEquals(Scope.COMPOSITE, component.getScope());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parent = new CompositeComponentImpl(null, null, null, null);
+ constructor = SourceImpl.class.getConstructor((Class[]) null);
+ createDeploymentContext();
+ createComponentDefinitionAndType();
+ }
+
+
+ private void createDeploymentContext() {
+ scopeContainer = EasyMock.createMock(ScopeContainer.class);
+ scopeContainer.start();
+ scopeContainer.stop();
+ scopeContainer.register(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.expect(scopeContainer.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ EasyMock.replay(scopeContainer);
+ deploymentContext = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.replay(deploymentContext);
+ }
+
+ private void createComponentDefinitionAndType() throws Exception {
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setImplementationScope(Scope.COMPOSITE);
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setName("target");
+ reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
+ type.add(reference);
+ ServiceContract<?> contract = new JavaServiceContract(Source.class);
+ JavaMappedService serviceDefinition = new JavaMappedService();
+ serviceDefinition.setName("Source");
+ serviceDefinition.setServiceContract(contract);
+ type.add(serviceDefinition);
+ type.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(constructor));
+ JavaImplementation sourceImpl = new JavaImplementation(SourceImpl.class, type);
+ definition = new ComponentDefinition<JavaImplementation>(sourceImpl);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderReferenceTestCase.java
new file mode 100644
index 0000000000..c9d1f93a57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderReferenceTestCase.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+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.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.InteractionScope;
+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.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.composite.CompositeComponentImpl;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaComponentBuilderReferenceTestCase extends TestCase {
+ private DeploymentContext deploymentContext;
+ private WireService wireService;
+ private Constructor<SourceImpl> constructor;
+ private CompositeComponent parent;
+ private OutboundWire wire;
+ private ScopeContainer scopeContainer;
+
+ public void testBuildReference() throws Exception {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> sourceType =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ sourceType.setImplementationScope(Scope.COMPOSITE);
+ JavaMappedReference reference = new JavaMappedReference();
+ reference.setName("target");
+ reference.setMember(SourceImpl.class.getMethod("setTarget", Target.class));
+ sourceType.add(reference);
+ ServiceContract<?> contract = new JavaServiceContract(Source.class);
+ JavaMappedService serviceDefinition = new JavaMappedService();
+ serviceDefinition.setName("Source");
+ serviceDefinition.setServiceContract(contract);
+ sourceType.add(serviceDefinition);
+ sourceType.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(constructor));
+ JavaImplementation sourceImpl = new JavaImplementation(SourceImpl.class, sourceType);
+ ComponentDefinition<JavaImplementation> definition = new ComponentDefinition<JavaImplementation>(sourceImpl);
+
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ builder.setWireService(wireService);
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, deploymentContext);
+ component.setScopeContainer(scopeContainer);
+ component.addOutboundWire(wire);
+ deploymentContext.getCompositeScope().start();
+ component.start();
+
+ Source source = (Source) component.getTargetInstance();
+ assertNotNull(source.getTarget());
+ component.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireService = new JDKWireService();
+ parent = new CompositeComponentImpl(null, null, null, null);
+ constructor = SourceImpl.class.getConstructor((Class[]) null);
+ createDeploymentContext();
+ createWire();
+ }
+
+
+ private void createDeploymentContext() throws Exception {
+ scopeContainer = EasyMock.createMock(ScopeContainer.class);
+ scopeContainer.start();
+ scopeContainer.stop();
+ scopeContainer.register(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.expect(scopeContainer.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ scopeContainer.getInstance(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
+
+ public Object answer() throws Throwable {
+ AtomicComponent component = (AtomicComponent) EasyMock.getCurrentArguments()[0];
+ Object instance = cache.get(component);
+ if (instance == null) {
+ instance = component.createInstance();
+ cache.put(component, instance);
+ }
+ return instance;
+ }
+ }).anyTimes();
+ EasyMock.replay(scopeContainer);
+ deploymentContext = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(deploymentContext.getCompositeScope()).andReturn(scopeContainer).atLeastOnce();
+ EasyMock.replay(deploymentContext);
+ }
+
+ private void createWire() {
+ SCAObject scaObject = EasyMock.createNiceMock(SCAObject.class);
+ Map<Operation<?>, OutboundInvocationChain> chains = Collections.emptyMap();
+ wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.getReferenceName()).andReturn("target").atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn(chains).atLeastOnce();
+ EasyMock.expect(wire.isOptimizable()).andReturn(false);
+ JavaServiceContract targetContract = new JavaServiceContract(Target.class);
+ targetContract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ EasyMock.expect(wire.getServiceContract()).andReturn(targetContract).atLeastOnce();
+ EasyMock.expect(wire.getContainer()).andReturn(scaObject).atLeastOnce();
+ EasyMock.replay(wire);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderResourceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderResourceTestCase.java
new file mode 100644
index 0000000000..f5ee684e0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilderResourceTestCase.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.core.implementation.java;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentBuilderResourceTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testResourceInjection() throws Exception {
+ ScopeContainer container = EasyMock.createNiceMock(ScopeContainer.class);
+ ScopeRegistry registry = EasyMock.createMock(ScopeRegistry.class);
+ EasyMock.expect(registry.getScopeContainer(Scope.STATELESS)).andReturn(container);
+ EasyMock.replay(registry);
+ JavaComponentBuilder builder = new JavaComponentBuilder();
+ builder.setScopeRegistry(registry);
+ ConstructorDefinition<Foo> ctorDef = new ConstructorDefinition<Foo>(Foo.class.getConstructor());
+ PojoComponentType type = new PojoComponentType();
+ Resource resource = new Resource();
+ resource.setType(String.class);
+ resource.setName("resource");
+ resource.setMember(Foo.class.getDeclaredField("resource"));
+ type.add(resource);
+ type.setImplementationScope(Scope.STATELESS);
+ type.setConstructorDefinition(ctorDef);
+ JavaImplementation impl = new JavaImplementation(Foo.class, type);
+ ComponentDefinition<JavaImplementation> definition = new ComponentDefinition<JavaImplementation>("foo", impl);
+ InboundWire resourceWire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(resourceWire.getTargetService()).andReturn("result");
+ EasyMock.replay(resourceWire);
+
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(String.class)).andReturn(resourceWire);
+ EasyMock.replay(parent);
+ JavaAtomicComponent component = (JavaAtomicComponent) builder.build(parent, definition, null);
+ Foo foo = (Foo) component.createInstance();
+ assertEquals("result", foo.resource);
+ EasyMock.verify(parent);
+ }
+
+ private static class Foo {
+
+ protected String resource;
+
+ public Foo() {
+ }
+
+ }
+}
+
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoaderTestCase.java
new file mode 100644
index 0000000000..ef74c86d2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaComponentTypeLoaderTestCase.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.implementation.java;
+
+import java.net.URL;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.IntrospectionRegistry;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentTypeLoaderTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testPojoComponentTypeCreatedForIntrospection() throws Exception {
+ IntrospectionRegistry registry = EasyMock.createMock(IntrospectionRegistry.class);
+ registry.introspect(
+ (CompositeComponent) EasyMock.isNull(),
+ (Class) EasyMock.isNull(),
+ EasyMock.isA(PojoComponentType.class),
+ (DeploymentContext) EasyMock.isNull());
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return EasyMock.getCurrentArguments()[2];
+ }
+ });
+ EasyMock.replay(registry);
+ JavaComponentTypeLoader loader = new JavaComponentTypeLoader(null, registry);
+ loader.loadByIntrospection(null, new JavaImplementation(), null);
+ EasyMock.verify(registry);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testPojoComponentTypeCreatedForSideFileLoadAndReturned() throws Exception {
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ registry.load(
+ (CompositeComponent) EasyMock.isNull(),
+ EasyMock.isA(PojoComponentType.class),
+ (URL) EasyMock.isNull(),
+ EasyMock.eq(PojoComponentType.class),
+ (DeploymentContext) EasyMock.isNull());
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ return EasyMock.getCurrentArguments()[1];
+ }
+ });
+ EasyMock.replay(registry);
+ JavaComponentTypeLoader loader = new JavaComponentTypeLoader(registry, null);
+ assertEquals(PojoComponentType.class, loader.loadFromSidefile(null, null, null).getClass());
+ EasyMock.verify(registry);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java
new file mode 100644
index 0000000000..0fe6df8b6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.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.core.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+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.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * Validates wiring from a Java atomic context
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaReferenceWireTestCase extends TestCase {
+
+ @SuppressWarnings({"unchecked"})
+ public void testReferenceSet() throws Exception {
+ ScopeContainer scope = createMock();
+ scope.start();
+ final Target target = new TargetImpl();
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.addReferenceSite("target", SourceImpl.class.getMethod("setTarget", Target.class));
+ Constructor<SourceImpl> ctr = SourceImpl.class.getConstructor();
+ configuration.setInstanceFactory(new PojoObjectFactory<SourceImpl>(ctr));
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ wire.getInvocationChains();
+ EasyMock.expectLastCall().andReturn(new HashMap<Operation<?>, OutboundInvocationChain>()).atLeastOnce();
+ EasyMock.expect(wire.getReferenceName()).andReturn("target").atLeastOnce();
+ EasyMock.expect(wire.isOptimizable()).andReturn(false);
+ EasyMock.replay(wire);
+ WireService service = EasyMock.createMock(WireService.class);
+ EasyMock.expect(service.createProxy(EasyMock.eq(Target.class), EasyMock.eq(wire), EasyMock.isA(Map.class)))
+ .andAnswer(new IAnswer<Target>() {
+ public Target answer() throws Throwable {
+ OutboundWire wire = (OutboundWire) EasyMock.getCurrentArguments()[1];
+ wire.getInvocationChains();
+ return target;
+ }
+
+ }).atLeastOnce();
+ EasyMock.replay(service);
+ configuration.setWireService(service);
+ configuration.setName("source");
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(scope);
+ component.addOutboundWire(wire);
+ component.start();
+ Source source = (Source) component.getTargetInstance();
+ assertSame(target, source.getTarget());
+ scope.stop();
+ EasyMock.verify(wire);
+ EasyMock.verify(scope);
+ EasyMock.verify(service);
+ }
+
+ private ScopeContainer createMock() throws TargetException {
+ ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
+ scope.start();
+ scope.stop();
+ scope.register(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.expect(scope.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ scope.getInstance(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
+
+ public Object answer() throws Throwable {
+ AtomicComponent component = (AtomicComponent) EasyMock.getCurrentArguments()[0];
+ Object instance = cache.get(component);
+ if (instance == null) {
+ instance = component.createInstance();
+ cache.put(component, instance);
+ }
+ return instance;
+ }
+ }).anyTimes();
+ EasyMock.replay(scope);
+ return scope;
+ }
+
+ private interface Source {
+ Target getTarget();
+ }
+
+ private static class SourceImpl implements Source {
+ private Target target;
+
+ public SourceImpl() {
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+ }
+
+ private interface Target {
+
+ String getString();
+
+ void setString(String val);
+ }
+
+ private static class TargetImpl implements Target {
+ private String string;
+
+ public TargetImpl() {
+ }
+
+ public String getString() {
+ return string;
+ }
+
+ public void setString(String string) {
+ this.string = string;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerBasicInvocationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerBasicInvocationTestCase.java
new file mode 100644
index 0000000000..30f7948673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerBasicInvocationTestCase.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.implementation.java;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.wire.InboundWire;
+import static org.apache.tuscany.spi.wire.TargetInvoker.NONE;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+public class JavaTargetInvokerBasicInvocationTestCase extends TestCase {
+ private Method echoMethod;
+ private Method arrayMethod;
+ private Method nullParamMethod;
+ private Method primitiveMethod;
+ private Method checkedMethod;
+ private Method runtimeMethod;
+ private InboundWire wire;
+ private WorkContext context;
+ private ExecutionMonitor monitor;
+
+ public JavaTargetInvokerBasicInvocationTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ echoMethod = TestBean.class.getDeclaredMethod("echo", String.class);
+ arrayMethod = TestBean.class.getDeclaredMethod("arrayEcho", String[].class);
+ nullParamMethod = TestBean.class.getDeclaredMethod("nullParam", (Class[]) null);
+ primitiveMethod = TestBean.class.getDeclaredMethod("primitiveEcho", Integer.TYPE);
+ checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null);
+ runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null);
+ wire = EasyMock.createNiceMock(InboundWire.class);
+ context = EasyMock.createNiceMock(WorkContext.class);
+ monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ assertNotNull(echoMethod);
+ assertNotNull(checkedMethod);
+ assertNotNull(runtimeMethod);
+ }
+
+ public void testObjectInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget("foo", NONE);
+ assertEquals("foo", ret);
+ }
+
+ public void testArrayInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(arrayMethod, component, wire, context, monitor);
+
+ String[] args = new String[]{"foo", "bar"};
+ Object ret = invoker.invokeTarget(new Object[]{args}, NONE);
+ String[] retA = (String[]) ret;
+ assertNotNull(retA);
+ assertEquals(2, retA.length);
+ assertEquals("foo", retA[0]);
+ assertEquals("bar", retA[1]);
+ }
+
+ public void testNullInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(nullParamMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget(null, NONE);
+ String retS = (String) ret;
+ assertEquals("foo", retS);
+ }
+
+ public void testPrimitiveInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(primitiveMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget(new Integer[]{1}, NONE);
+ Integer retI = (Integer) ret;
+ assertEquals(1, retI.intValue());
+ }
+
+ public void testInvokeCheckedException() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(checkedMethod, component, wire, context, monitor);
+ try {
+ invoker.invokeTarget(null, NONE);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null && TestException.class.equals(e.getCause().getClass())) {
+ return;
+ }
+ } catch (Throwable e) {
+ //ok
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ public void testInvokeRuntimeException() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(runtimeMethod, component, wire, context, monitor);
+ try {
+ invoker.invokeTarget(null, NONE);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null && e.getCause() instanceof TestRuntimeException) {
+ return;
+ }
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ private class TestBean {
+
+ public String echo(String msg) throws Exception {
+ assertEquals("foo", msg);
+ return msg;
+ }
+
+ public String[] arrayEcho(String[] msg) throws Exception {
+ assertNotNull(msg);
+ assertEquals(2, msg.length);
+ assertEquals("foo", msg[0]);
+ assertEquals("bar", msg[1]);
+ return msg;
+ }
+
+ public String nullParam() throws Exception {
+ return "foo";
+ }
+
+ public int primitiveEcho(int i) throws Exception {
+ return i;
+ }
+
+ public void checkedException() throws TestException {
+ throw new TestException();
+ }
+
+ public void runtimeException() throws TestRuntimeException {
+ throw new TestRuntimeException();
+ }
+ }
+
+ public class TestException extends Exception {
+ }
+
+ public class TestRuntimeException extends RuntimeException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerMediationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerMediationTestCase.java
new file mode 100644
index 0000000000..936673d0a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerMediationTestCase.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.implementation.java;
+
+import java.lang.reflect.Method;
+
+import static org.apache.tuscany.spi.wire.TargetInvoker.NONE;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Tests invoking on a different interface from the one actually implemented by the target
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaTargetInvokerMediationTestCase extends TestCase {
+
+ private Method hello;
+
+ public void setUp() throws Exception {
+ hello = Hello.class.getMethod("hello", String.class);
+ }
+
+ public void testMediation() throws Exception {
+ Target target = EasyMock.createMock(Target.class);
+ EasyMock.expect(target.hello("foo")).andReturn("foo");
+ EasyMock.replay(target);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(target);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(hello, component, null, null, null);
+ assertEquals("foo", invoker.invokeTarget("foo", NONE));
+ }
+
+ public interface Hello {
+ String hello(String message) throws Exception;
+ }
+
+ private interface Target {
+ String hello(String message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerNonBlockingInvocationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerNonBlockingInvocationTestCase.java
new file mode 100644
index 0000000000..25466a01ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerNonBlockingInvocationTestCase.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.core.implementation.java;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import static org.apache.tuscany.spi.wire.TargetInvoker.NONE;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies dispatching invocations to a Java implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaTargetInvokerNonBlockingInvocationTestCase extends TestCase {
+
+ private Method echoMethod;
+ private Method arrayMethod;
+ private Method nullParamMethod;
+ private Method primitiveMethod;
+ private Method checkedMethod;
+ private Method runtimeMethod;
+ private InboundWire wire;
+ private WorkContext context;
+ private ExecutionMonitor monitor;
+
+ public JavaTargetInvokerNonBlockingInvocationTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void testInvoke() throws Exception {
+ AsyncTarget target = EasyMock.createMock(AsyncTarget.class);
+ target.invoke();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(target);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(target);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ ExecutionMonitor monitor = EasyMock.createMock(ExecutionMonitor.class);
+ EasyMock.replay(monitor);
+
+ Message msg = new MessageImpl();
+ Object id = new Object();
+ msg.setMessageId(id);
+
+ WorkContext context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCorrelationId(id);
+ EasyMock.replay(context);
+ Method method = AsyncTarget.class.getMethod("invoke");
+ method.setAccessible(true);
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(method, component, wire, context, monitor);
+ invoker.invoke(msg);
+ EasyMock.verify(target);
+ EasyMock.verify(component);
+ }
+
+ public void setUp() throws Exception {
+ echoMethod = TestBean.class.getDeclaredMethod("echo", String.class);
+ arrayMethod = TestBean.class.getDeclaredMethod("arrayEcho", String[].class);
+ nullParamMethod = TestBean.class.getDeclaredMethod("nullParam", (Class[]) null);
+ primitiveMethod = TestBean.class.getDeclaredMethod("primitiveEcho", Integer.TYPE);
+ checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null);
+ runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null);
+ wire = EasyMock.createNiceMock(InboundWire.class);
+ context = EasyMock.createNiceMock(WorkContext.class);
+ monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ assertNotNull(echoMethod);
+ assertNotNull(checkedMethod);
+ assertNotNull(runtimeMethod);
+ }
+
+ public void testObjectInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget("foo", NONE);
+ assertEquals("foo", ret);
+ }
+
+ public void testArrayInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(arrayMethod, component, wire, context, monitor);
+
+ String[] args = new String[]{"foo", "bar"};
+ Object ret = invoker.invokeTarget(new Object[]{args}, NONE);
+ String[] retA = (String[]) ret;
+ assertNotNull(retA);
+ assertEquals(2, retA.length);
+ assertEquals("foo", retA[0]);
+ assertEquals("bar", retA[1]);
+ }
+
+ public void testNullInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(nullParamMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget(null, NONE);
+ String retS = (String) ret;
+ assertEquals("foo", retS);
+ }
+
+ public void testPrimitiveInvoke() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(primitiveMethod, component, wire, context, monitor);
+ Object ret = invoker.invokeTarget(new Integer[]{1}, NONE);
+ Integer retI = (Integer) ret;
+ assertEquals(1, retI.intValue());
+ }
+
+ public void testInvokeCheckedException() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(checkedMethod, component, wire, context, monitor);
+ try {
+ invoker.invokeTarget(null, NONE);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null && TestException.class.equals(e.getCause().getClass())) {
+ return;
+ }
+ } catch (Throwable e) {
+ //ok
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ public void testInvokeRuntimeException() throws Throwable {
+ TestBean bean = new TestBean();
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(bean);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(runtimeMethod, component, wire, context, monitor);
+ try {
+ invoker.invokeTarget(null, NONE);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null && e.getCause() instanceof TestRuntimeException) {
+ return;
+ }
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ private class TestBean {
+
+ public String echo(String msg) throws Exception {
+ assertEquals("foo", msg);
+ return msg;
+ }
+
+ public String[] arrayEcho(String[] msg) throws Exception {
+ assertNotNull(msg);
+ assertEquals(2, msg.length);
+ assertEquals("foo", msg[0]);
+ assertEquals("bar", msg[1]);
+ return msg;
+ }
+
+ public String nullParam() throws Exception {
+ return "foo";
+ }
+
+ public int primitiveEcho(int i) throws Exception {
+ return i;
+ }
+
+ public void checkedException() throws TestException {
+ throw new TestException();
+ }
+
+ public void runtimeException() throws TestRuntimeException {
+ throw new TestRuntimeException();
+ }
+ }
+
+ public class TestException extends Exception {
+ }
+
+ public class TestRuntimeException extends RuntimeException {
+ }
+
+ public interface AsyncTarget {
+ void invoke();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerSequenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerSequenceTestCase.java
new file mode 100644
index 0000000000..acb2ed5e14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerSequenceTestCase.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.core.implementation.java;
+
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaTargetInvokerSequenceTestCase extends TestCase {
+
+ /**
+ * Verifies an invocation marked as non-conversational has an existing or new instance returned
+ */
+ public void testNoSequence() throws Exception {
+ Foo foo = EasyMock.createMock(Foo.class);
+ foo.invoke();
+ EasyMock.replay(foo);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(foo);
+ EasyMock.expect(component.getScope()).andReturn(Scope.CONVERSATION);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(Foo.class.getMethod("invoke"), component, null, null, null);
+ Message msg = new MessageImpl();
+ msg.setConversationSequence(TargetInvoker.NONE);
+ invoker.invoke(msg);
+ EasyMock.verify(foo);
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verifies that an invocation marked as starting a conversation has a new instance returned
+ */
+ public void testStartSequence() throws Exception {
+ Foo foo = EasyMock.createMock(Foo.class);
+ foo.invoke();
+ EasyMock.replay(foo);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(foo);
+ EasyMock.expect(component.getScope()).andReturn(Scope.CONVERSATION);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(Foo.class.getMethod("invoke"), component, null, null, null);
+ Message msg = new MessageImpl();
+ msg.setConversationSequence(TargetInvoker.START);
+ invoker.invoke(msg);
+ EasyMock.verify(foo);
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verifies that an invocation marked as continuing a conversation has an associated instance returned
+ */
+ public void testContinueSequence() throws Exception {
+ Foo foo = EasyMock.createMock(Foo.class);
+ foo.invoke();
+ EasyMock.replay(foo);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getAssociatedTargetInstance()).andReturn(foo);
+ EasyMock.expect(component.getScope()).andReturn(Scope.CONVERSATION);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(Foo.class.getMethod("invoke"), component, null, null, null);
+ Message msg = new MessageImpl();
+ msg.setConversationSequence(TargetInvoker.CONTINUE);
+ invoker.invoke(msg);
+ EasyMock.verify(foo);
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verifies that an invocation marked as ending a conversation has an associated instance returned and it is removed
+ * following the dispatch to the instance
+ */
+ public void testEndSequence() throws Exception {
+ Foo foo = EasyMock.createMock(Foo.class);
+ foo.invoke();
+ EasyMock.replay(foo);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getAssociatedTargetInstance()).andReturn(foo);
+ EasyMock.expect(component.getScope()).andReturn(Scope.CONVERSATION);
+ component.removeInstance();
+ component.destroy(EasyMock.eq(foo));
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(Foo.class.getMethod("invoke"), component, null, null, null);
+ Message msg = new MessageImpl();
+ msg.setConversationSequence(TargetInvoker.END);
+ invoker.invoke(msg);
+ EasyMock.verify(foo);
+ EasyMock.verify(component);
+ }
+
+
+ private interface Foo {
+ void invoke();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerStatelessDestroyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerStatelessDestroyTestCase.java
new file mode 100644
index 0000000000..c87649f99e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerStatelessDestroyTestCase.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.implementation.java;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+public class JavaTargetInvokerStatelessDestroyTestCase extends TestCase {
+
+ public JavaTargetInvokerStatelessDestroyTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void testDestroy() throws Exception {
+ Method echoMethod = Echo.class.getDeclaredMethod("echo", String.class);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(new JavaTargetInvokerStatelessDestroyTestCase.Echo());
+ EasyMock.expect(component.getScope()).andReturn(Scope.STATELESS);
+ component.destroy(EasyMock.isA(Echo.class));
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component, null, null, null);
+ invoker.setCacheable(false);
+ assertEquals("foo", invoker.invokeTarget("foo", JavaTargetInvoker.NONE));
+ EasyMock.verify(component);
+ }
+
+ public static class Echo {
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerTestCase.java
new file mode 100644
index 0000000000..043af2d891
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaTargetInvokerTestCase.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.core.implementation.java;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+public class JavaTargetInvokerTestCase extends TestCase {
+
+ public JavaTargetInvokerTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void testInvoke() throws Exception {
+ Method echoMethod = Echo.class.getDeclaredMethod("echo", String.class);
+ JavaAtomicComponent component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn(new Echo());
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.replay(component);
+ JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component, null, null, null);
+ invoker.setCacheable(false);
+ assertEquals("foo", invoker.invokeTarget("foo", JavaTargetInvoker.NONE));
+ EasyMock.verify(component);
+ }
+
+ public static class Echo {
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/MultiplicityTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/MultiplicityTestCase.java
new file mode 100644
index 0000000000..ba478c9634
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/MultiplicityTestCase.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.core.implementation.java;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests wires that are configured with a multiplicity
+ *
+ * @version $Rev$ $Date$
+ */
+public class MultiplicityTestCase extends TestCase {
+
+ public void testMultiplicity() throws Exception {
+ // TODO implement
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/ResourceInjectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/ResourceInjectionTestCase.java
new file mode 100644
index 0000000000..f4cc56f158
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/ResourceInjectionTestCase.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.core.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.ResourceObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceInjectionTestCase extends TestCase {
+
+ public void testResourceMemberInjection() throws Exception {
+ ScopeContainer containter = EasyMock.createNiceMock(ScopeContainer.class);
+ Constructor<Foo> ctor = Foo.class.getConstructor();
+ Field field = Foo.class.getDeclaredField("resource");
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName("component");
+ configuration.setInstanceFactory(new PojoObjectFactory<Foo>(ctor));
+ configuration.addResourceSite("bar", field);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(containter);
+
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn("result");
+ EasyMock.replay(wire);
+
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(wire);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, null);
+ component.addResourceFactory("bar", factory);
+
+ Foo foo = (Foo) component.createInstance();
+ assertEquals("result", foo.resource);
+ EasyMock.verify(parent);
+ }
+
+
+ public void testResourceConstructorInjection() throws Exception {
+ ScopeContainer containter = EasyMock.createNiceMock(ScopeContainer.class);
+ Constructor<FooConstructor> ctor = FooConstructor.class.getConstructor(String.class);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName("component");
+ configuration.setInstanceFactory(new PojoObjectFactory<FooConstructor>(ctor));
+ List<String> ctorNames = new ArrayList<String>();
+ ctorNames.add("bar");
+ configuration.setConstructorParamNames(ctorNames);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(containter);
+
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn("result");
+ EasyMock.replay(wire);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(wire);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, null);
+ component.addResourceFactory("bar", factory);
+
+ FooConstructor foo = (FooConstructor) component.createInstance();
+ assertEquals("result", foo.resource);
+ EasyMock.verify(parent);
+ }
+
+ public static class Foo {
+ protected String resource;
+
+ public Foo() {
+ }
+
+ }
+
+ public static class FooConstructor {
+ protected String resource;
+
+ public FooConstructor(String resource) {
+ this.resource = resource;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java
new file mode 100644
index 0000000000..898f89383a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/CallbackInvocationTestCase.java
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.integration;
+
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.annotations.Callback;
+
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+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.WireService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.builder.ConnectorImpl;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.implementation.java.JavaComponentBuilder;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+
+/**
+ * Verifies callback integration scenarios with Java components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackInvocationTestCase extends TestCase {
+ private ScopeContainer container;
+ private DeploymentContext context;
+ private JavaComponentBuilder builder;
+ private WireService wireService;
+ private WorkScheduler scheduler;
+ private WorkContext workContext;
+
+ /**
+ * Verifies callback wires are built and callback invocations are handled properly
+ */
+ public void testComponentToComponentCallback() throws Exception {
+ ComponentDefinition<JavaImplementation> targetDefinition = createTarget();
+ JavaAtomicComponent fooComponent =
+ (JavaAtomicComponent) builder.build(null, targetDefinition, context);
+ fooComponent.setScopeContainer(container);
+ wireService.createWires(fooComponent, targetDefinition);
+ container.register(fooComponent);
+
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ parent.getChild(isA(String.class));
+ expectLastCall().andReturn(fooComponent).anyTimes();
+ replay(parent);
+
+ ComponentDefinition<JavaImplementation> sourceDefinition = createSource("fooClient");
+ JavaAtomicComponent clientComponent =
+ (JavaAtomicComponent) builder.build(parent, sourceDefinition, context);
+ clientComponent.setScopeContainer(container);
+ wireService.createWires(clientComponent, sourceDefinition);
+ container.register(clientComponent);
+
+ Connector connector = new ConnectorImpl(new JDKWireService(), null, scheduler, workContext);
+
+ connector.connect(clientComponent);
+ FooClient client = (FooClient) clientComponent.getTargetInstance();
+ client.invoke();
+ assertTrue(client.invoked);
+ client.invokeMultiCallback();
+ assertTrue(client.count == 2);
+ }
+
+ /**
+ * Verifies exception is thrown when callback is not implemented
+ */
+ public void testCallbackNotRegistered() throws Exception {
+ ComponentDefinition<JavaImplementation> targetDefinition = createTarget();
+ JavaAtomicComponent fooComponent =
+ (JavaAtomicComponent) builder.build(null, targetDefinition, context);
+ fooComponent.setScopeContainer(container);
+ wireService.createWires(fooComponent, targetDefinition);
+ container.register(fooComponent);
+
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ parent.getChild(isA(String.class));
+ expectLastCall().andReturn(fooComponent).anyTimes();
+ replay(parent);
+
+ ComponentDefinition<JavaImplementation> sourceDefinition = createPlainSource("fooPlainClient");
+ JavaAtomicComponent clientComponent =
+ (JavaAtomicComponent) builder.build(parent, sourceDefinition, context);
+ clientComponent.setScopeContainer(container);
+ wireService.createWires(clientComponent, sourceDefinition);
+ container.register(clientComponent);
+
+ Connector connector = new ConnectorImpl(new JDKWireService(), null, scheduler, workContext);
+
+ connector.connect(clientComponent);
+ FooPlainClient client = (FooPlainClient) clientComponent.getTargetInstance();
+ try {
+ client.invoke();
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ }
+ }
+
+ /**
+ * Verifies a callback in response to an invocation from two different client components is routed back to the
+ * appropriate client.
+ */
+ public void testTwoSourceComponentToComponentCallback() throws Exception {
+ ComponentDefinition<JavaImplementation> targetDefinition = createTarget();
+ JavaAtomicComponent fooComponent =
+ (JavaAtomicComponent) builder.build(null, targetDefinition, context);
+ fooComponent.setScopeContainer(container);
+ wireService.createWires(fooComponent, targetDefinition);
+ container.register(fooComponent);
+
+ CompositeComponent parent = createMock(CompositeComponent.class);
+ parent.getChild(isA(String.class));
+ expectLastCall().andReturn(fooComponent).anyTimes();
+ replay(parent);
+
+ ComponentDefinition<JavaImplementation> sourceDefinition1 = createSource("fooCleint1");
+ ComponentDefinition<JavaImplementation> sourceDefinition2 = createSource("fooCleint2");
+ JavaAtomicComponent clientComponent1 =
+ (JavaAtomicComponent) builder.build(parent, sourceDefinition1, context);
+ clientComponent1.setScopeContainer(container);
+ wireService.createWires(clientComponent1, sourceDefinition1);
+ container.register(clientComponent1);
+ JavaAtomicComponent clientComponent2 =
+ (JavaAtomicComponent) builder.build(parent, sourceDefinition2, context);
+ clientComponent2.setScopeContainer(container);
+ wireService.createWires(clientComponent2, sourceDefinition2);
+ container.register(clientComponent2);
+
+ Connector connector = new ConnectorImpl(new JDKWireService(), null, scheduler, workContext);
+ connector.connect(clientComponent1);
+ connector.connect(clientComponent2);
+ FooClient client1 = (FooClient) clientComponent1.getTargetInstance();
+ client1.invoke();
+ assertTrue(client1.invoked);
+ FooClient client2 = (FooClient) clientComponent2.getTargetInstance();
+ client2.invoke();
+ assertTrue(client2.invoked);
+ }
+
+
+ private ComponentDefinition<JavaImplementation> createTarget() throws NoSuchMethodException,
+ InvalidServiceContractException {
+ ConstructorDefinition<FooImpl> ctorDef = new ConstructorDefinition<FooImpl>(FooImpl.class.getConstructor());
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setConstructorDefinition(ctorDef);
+ type.setImplementationScope(Scope.COMPOSITE);
+ Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract = registry.introspect(Foo.class);
+ contract.setCallbackClass(FooCallback.class);
+ contract.setCallbackName("callback");
+ JavaMappedService mappedService = new JavaMappedService("Foo", contract, false, "callback", method);
+ type.getServices().put("Foo", mappedService);
+
+ JavaImplementation impl = new JavaImplementation(FooImpl.class, type);
+ impl.setComponentType(type);
+ impl.setImplementationClass(FooImpl.class);
+ return new ComponentDefinition<JavaImplementation>("foo", impl);
+ }
+
+ private ComponentDefinition<JavaImplementation> createSource(String name)
+ throws NoSuchMethodException, URISyntaxException, InvalidServiceContractException {
+ ConstructorDefinition<FooClient> ctorDef =
+ new ConstructorDefinition<FooClient>(FooClient.class.getConstructor());
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setConstructorDefinition(ctorDef);
+ type.setImplementationScope(Scope.COMPOSITE);
+ Method method = FooClient.class.getMethod("setFoo", Foo.class);
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract = registry.introspect(Foo.class);
+ contract.setCallbackClass(FooCallback.class);
+ contract.setCallbackName("callback");
+ JavaMappedReference mappedReference = new JavaMappedReference("foo", contract, method);
+ type.getReferences().put("foo", mappedReference);
+ ReferenceTarget refTarget = new ReferenceTarget();
+ refTarget.setReferenceName("foo");
+ refTarget.getTargets().add(new URI("foo"));
+ JavaImplementation impl = new JavaImplementation(FooClient.class, type);
+ impl.setComponentType(type);
+ impl.setImplementationClass(FooClient.class);
+ ComponentDefinition<JavaImplementation> def = new ComponentDefinition<JavaImplementation>(name, impl);
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(type.getReferences().get("foo"));
+ compRef.addTarget(new URI("foo"));
+ def.add(compRef);
+ //def.getReferenceTargets().put("foo", refTarget);
+ return def;
+ }
+
+ private ComponentDefinition<JavaImplementation> createPlainSource(String name)
+ throws NoSuchMethodException, URISyntaxException, InvalidServiceContractException {
+ ConstructorDefinition<FooPlainClient> ctorDef =
+ new ConstructorDefinition<FooPlainClient>(FooPlainClient.class.getConstructor());
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ type.setConstructorDefinition(ctorDef);
+ type.setImplementationScope(Scope.COMPOSITE);
+ Method method = FooPlainClient.class.getMethod("setFoo", Foo.class);
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract = registry.introspect(Foo.class);
+ contract.setCallbackClass(FooCallback.class);
+ contract.setCallbackName("callback");
+ JavaMappedReference mappedReference = new JavaMappedReference("foo", contract, method);
+ type.getReferences().put("foo", mappedReference);
+ ReferenceTarget refTarget = new ReferenceTarget();
+ refTarget.setReferenceName("foo");
+ refTarget.getTargets().add(new URI("foo"));
+ JavaImplementation impl = new JavaImplementation(FooPlainClient.class, type);
+ ComponentDefinition<JavaImplementation> def = new ComponentDefinition<JavaImplementation>(name, impl);
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(type.getReferences().get("foo"));
+ compRef.addTarget(new URI("foo"));
+ def.add(compRef);
+ //def.getReferenceTargets().put("foo", refTarget);
+ return def;
+ }
+
+ @Callback(FooCallback.class)
+ public static interface Foo {
+ void call();
+
+ void callMultiCallback();
+
+ void callFromPlain();
+ }
+
+ public static class FooImpl implements Foo {
+ private FooCallback callback;
+
+ public FooImpl() {
+ }
+
+ @Callback
+ public void setCallback(FooCallback callback) {
+ this.callback = callback;
+ }
+
+ public void call() {
+ callback.callback();
+ }
+
+ public void callMultiCallback() {
+ callback.multiCallback();
+ callback.multiCallback();
+ }
+
+ public void callFromPlain() {
+ try {
+ callback.callback();
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static class FooClient implements FooCallback {
+
+ private Foo foo;
+ private boolean invoked;
+ private int count;
+
+ public FooClient() {
+ }
+
+ public void setFoo(Foo foo) {
+ this.foo = foo;
+ }
+
+ public void callback() {
+ if (invoked) {
+ fail();
+ }
+ invoked = true;
+ }
+
+ public void multiCallback() {
+ count++;
+ }
+
+ public void invoke() {
+ foo.call();
+ }
+
+ public void invokeMultiCallback() {
+ foo.callMultiCallback();
+ }
+ }
+
+ public interface FooCallback {
+ void callback();
+
+ void multiCallback();
+ }
+
+ public static class FooPlainClient /* implements FooCallback */ { // do NOT implement the callback
+
+ private Foo foo;
+
+ public FooPlainClient() {
+ }
+
+ public void setFoo(Foo foo) {
+ this.foo = foo;
+ }
+
+ public void invoke() {
+ foo.callFromPlain();
+ }
+
+ public void callback() {
+
+ }
+
+ public void multiCallback() {
+
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireService = new JDKWireService();
+ container = new CompositeScopeContainer(null);
+ container.start();
+ context = createMock(DeploymentContext.class);
+ context.getCompositeScope();
+ expectLastCall().andReturn(container).anyTimes();
+ replay(context);
+
+ scheduler = createMock(WorkScheduler.class);
+ scheduler.scheduleWork(isA(Runnable.class));
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ Runnable runnable = (Runnable) getCurrentArguments()[0];
+ runnable.run();
+ return null;
+ }
+ });
+ replay(scheduler);
+
+ builder = new JavaComponentBuilder();
+ workContext = new WorkContextImpl();
+ builder.setWorkContext(workContext);
+ builder.setWireService(new JDKWireService(workContext, null));
+ builder.setWorkScheduler(scheduler);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java
new file mode 100644
index 0000000000..f2d88955e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.integration;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.builder.WiringException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.InteractionScope;
+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.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.tuscany.core.builder.ConnectorImpl;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.component.scope.HttpSessionScopeContainer;
+import org.apache.tuscany.core.component.scope.RequestScopeContainer;
+import org.apache.tuscany.core.component.scope.StatelessScopeContainer;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+import org.easymock.EasyMock;
+
+/**
+ * Validates wiring from a wire to Java atomic component by scope
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class OutboundWireToJavaTestCase extends TestCase {
+ private WorkContext workContext = new WorkContextImpl();
+ private WireService wireService = new JDKWireService(new WorkContextImpl(), null);
+
+ public void testToStatelessScope() throws Exception {
+ StatelessScopeContainer scope = new StatelessScopeContainer(workContext, null);
+ scope.start();
+ final OutboundWire wire = getWire(scope);
+ Target service = wireService.createProxy(Target.class, wire);
+ assertNotNull(service);
+ service.setString("foo");
+ assertEquals(null, service.getString());
+ scope.stop();
+ }
+
+ public void testToRequestScope() throws Exception {
+ final RequestScopeContainer scope = new RequestScopeContainer(workContext, null);
+ scope.start();
+
+ scope.onEvent(new RequestStart(this));
+
+ final OutboundWire wire = getWire(scope);
+ Target service = wireService.createProxy(Target.class, wire);
+ assertNotNull(service);
+ service.setString("foo");
+
+ // another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ scope.onEvent(new RequestStart(this));
+ Target service2 = wireService.createProxy(Target.class, wire);
+ Target target2 = wireService.createProxy(Target.class, wire);
+ assertEquals(null, service2.getString());
+ service2.setString("bar");
+ assertEquals("bar", service2.getString());
+ assertEquals("bar", target2.getString());
+ scope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+
+ assertEquals("foo", service.getString());
+ scope.onEvent(new RequestEnd(this));
+ scope.stop();
+ }
+
+ public void testToSessionScope() throws Exception {
+ HttpSessionScopeContainer scope = new HttpSessionScopeContainer(workContext, null);
+ scope.start();
+ Object session1 = new Object();
+ workContext.setIdentifier(Scope.SESSION, session1);
+ scope.onEvent(new HttpSessionStart(this, session1));
+
+ final OutboundWire wire = getWire(scope);
+ Target service = wireService.createProxy(Target.class, wire);
+ Target target = wireService.createProxy(Target.class, wire);
+ assertNotNull(service);
+ service.setString("foo");
+ assertEquals("foo", service.getString());
+ assertEquals("foo", target.getString());
+
+ workContext.clearIdentifier(Scope.SESSION);
+
+ //second session
+ Object session2 = new Object();
+ workContext.setIdentifier(Scope.SESSION, session2);
+ scope.onEvent(new HttpSessionStart(this, session2));
+
+ Target service2 = wireService.createProxy(Target.class, wire);
+ assertNotNull(service2);
+ assertNull(service2.getString());
+ Target target2 = wireService.createProxy(Target.class, wire);
+ service2.setString("bar");
+ assertEquals("bar", service2.getString());
+ assertEquals("bar", target2.getString());
+
+ scope.onEvent(new HttpSessionEnd(this, session2));
+ workContext.clearIdentifier(Scope.SESSION);
+
+ workContext.setIdentifier(Scope.SESSION, session1);
+ assertEquals("foo", service.getString());
+
+ scope.onEvent(new HttpSessionEnd(this, session1));
+
+ scope.stop();
+ }
+
+ public void testToCompositeScope() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ scope.onEvent(new CompositeStart(this, null));
+ final OutboundWire wire = getWire(scope);
+ Target service = wireService.createProxy(Target.class, wire);
+ Target target = wireService.createProxy(Target.class, wire);
+ assertNotNull(service);
+ service.setString("foo");
+ assertEquals("foo", service.getString());
+ assertEquals("foo", target.getString());
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ }
+
+ private OutboundWire getWire(ScopeContainer scope) throws NoSuchMethodException,
+ InvalidServiceContractException, WiringException {
+ ConnectorImpl connector = new ConnectorImpl();
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory<TargetImpl>(TargetImpl.class.getConstructor()));
+ configuration.setParent(parent);
+ configuration.setWorkContext(workContext);
+ configuration.setName("source");
+
+ JavaAtomicComponent source = new JavaAtomicComponent(configuration);
+ source.setScopeContainer(scope);
+ OutboundWire outboundWire = createOutboundWire(new QualifiedName("target/Target"), Target.class);
+ outboundWire.setContainer(source);
+ source.addOutboundWire(outboundWire);
+ configuration.setName("target");
+ JavaAtomicComponent target = new JavaAtomicComponent(configuration);
+ target.setScopeContainer(scope);
+ InboundWire targetWire = MockFactory.createInboundWire("Target", Target.class);
+ targetWire.setContainer(target);
+ target.addInboundWire(targetWire);
+ InboundWire inboundWire = target.getInboundWire("Target");
+ inboundWire.setContainer(target);
+
+ EasyMock.expect(parent.getChild("target")).andReturn(target);
+ EasyMock.replay(parent);
+
+ connector.connect(source);
+ target.start();
+ return outboundWire;
+ }
+
+ private static <T> OutboundWire createOutboundWire(QualifiedName targetName, Class<T> interfaze)
+ throws InvalidServiceContractException {
+ OutboundWire wire = new OutboundWireImpl();
+ JavaServiceContract contract = new JavaServiceContract(interfaze);
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ wire.setServiceContract(contract);
+ wire.setTargetName(targetName);
+ wire.addInvocationChains(createInvocationChains(interfaze));
+ return wire;
+ }
+
+ private static Map<Operation<?>, OutboundInvocationChain> createInvocationChains(Class<?> interfaze)
+ throws InvalidServiceContractException {
+ Map<Operation<?>, OutboundInvocationChain> invocations = new HashMap<Operation<?>, OutboundInvocationChain>();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract = registry.introspect(interfaze);
+ for (Operation operation : contract.getOperations().values()) {
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ invocations.put(operation, chain);
+ }
+ return invocations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..9fd3fbfc9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/AllowsPassByReferenceProcessorTestCase.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.implementation.processor;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev: 452761 $ $Date: 2006-10-04 12:03:20 +0530 (Wed, 04 Oct 2006) $
+ */
+public class AllowsPassByReferenceProcessorTestCase extends TestCase {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+ AllowsPassByReferenceProcessor processor;
+
+ public void testClassAnnotation() throws Exception {
+ processor.visitClass(null, Foo.class, type, null);
+ assertEquals(true, type.isAllowsPassByReference());
+
+ processor.visitClass(null, Bar.class, type, null);
+ assertEquals(false, type.isAllowsPassByReference());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor = new AllowsPassByReferenceProcessor();
+ }
+
+ @AllowsPassByReference
+ private class Foo {
+ }
+
+ //no annotation
+ private class Bar {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java
new file mode 100644
index 0000000000..c67d226b41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorAutowireTestCase extends TestCase {
+
+ ConstructorProcessor processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testAutowire() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Bar.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getReferences().get("myRef"));
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Bar.class, Bar.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertEquals(2, type.getConstructorDefinition().getInjectionNames().size());
+ assertNotNull(type.getReferences().get("myRef1"));
+ assertNotNull(type.getReferences().get("myRef2"));
+ }
+
+ public void testNoName() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo2> ctor = Foo2.class.getConstructor(Bar.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getReferences().get(Bar.class.getName() + "0"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Bar.class, Bar.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidAutowireException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ /**
+ * Verifies processing executes with additional extension annotations
+ */
+ public void testRandomAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo3> ctor = Foo3.class.getConstructor(String.class, String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertEquals(1, type.getProperties().size());
+ assertNotNull(type.getProperties().get("prop1"));
+ }
+
+ private static interface Bar {
+
+ }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Autowire(name = "myRef") Bar ref) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef1", "myRef2"})
+ public Foo(@Autowire Bar ref1, @Autowire Bar ref2) {
+
+ }
+
+ }
+
+ private static class Foo2 {
+ @org.osoa.sca.annotations.Constructor()
+ public Foo2(@Autowire Bar ref) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor({"ref1"})
+ public BadFoo(@Autowire Bar ref1, @Autowire Bar ref2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
+ public BadFoo(@Autowire List ref, @Autowire(name = "myOtherRef") List ref2) {
+
+ }
+
+ }
+
+ public static class Foo3 {
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo3(@Property(name = "prop1") String prop, @Baz String baz) {
+ }
+ }
+
+ public @interface Baz {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorExtensibilityTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorExtensibilityTestCase.java
new file mode 100644
index 0000000000..25a8ab9a1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorExtensibilityTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import java.lang.reflect.Constructor;
+
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * Verifies the constructor processor works when parameters are marked with custom extension annotations
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstructorProcessorExtensibilityTestCase extends TestCase {
+ private ConstructorProcessor processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testProcessFirst() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class, String.class);
+ processor.visitConstructor(null, ctor1, type, null);
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
+ }
+
+ /**
+ * Verifies the constructor processor can be called after another processor has evaluated the constructor and found
+ * an annotation
+ *
+ * @throws Exception
+ */
+ public void testProcessLast() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class, String.class);
+ ConstructorDefinition<Foo> definition = new ConstructorDefinition<Foo>(ctor1);
+ definition.getInjectionNames().add("");
+ definition.getInjectionNames().add("mybar");
+ type.setConstructorDefinition(definition);
+ processor.visitConstructor(null, ctor1, type, null);
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
+ }
+
+
+ private @interface Bar {
+
+ }
+
+ private static class Foo {
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Property(name = "foo") String foo, @Bar String bar) {
+
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorTestCase.java
new file mode 100644
index 0000000000..4e48523e8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorProcessorTestCase.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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.Multiplicity;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorProcessorTestCase extends TestCase {
+ private ConstructorProcessor processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testDuplicateConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitClass(null, BadFoo.class, type, null);
+ fail();
+ } catch (DuplicateConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(null, ctor1, type, null);
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
+ }
+
+ public void testNoAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
+ processor.visitConstructor(null, ctor1, type, null);
+ assertNull(type.getConstructorDefinition());
+ }
+
+ public void testBadAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
+ try {
+ processor.visitConstructor(null, ctor1, type, null);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testMixedParameters() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.class, String.class);
+ processor.visitConstructor(null, ctor1, type, null);
+ assertEquals("java.lang.String0", type.getConstructorDefinition().getInjectionNames().get(0));
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(1));
+ assertEquals("bar", type.getConstructorDefinition().getInjectionNames().get(2));
+ }
+
+ public void testAllAutowireWithNoNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<AllAutowireNoName> ctor1 =
+ AllAutowireNoName.class.getConstructor(String.class, String.class, String.class);
+ processor.visitConstructor(null, ctor1, type, null);
+ assertEquals("java.lang.String0", type.getConstructorDefinition().getInjectionNames().get(0));
+ assertEquals("java.lang.String1", type.getConstructorDefinition().getInjectionNames().get(1));
+ assertEquals("java.lang.String2", type.getConstructorDefinition().getInjectionNames().get(2));
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor("foo")
+ public BadFoo(String foo) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"foo", "bar"})
+ public BadFoo(String foo, String bar) {
+
+ }
+ }
+
+ private static class Foo {
+ @org.osoa.sca.annotations.Constructor("foo")
+ public Foo(String foo) {
+
+ }
+ }
+
+ private static class NoAnnotation {
+ public NoAnnotation() {
+ }
+ }
+
+ private static class BadAnnotation {
+ @org.osoa.sca.annotations.Constructor("foo")
+ public BadAnnotation(String foo, Foo ref) {
+ }
+ }
+
+
+ public static final class Mixed {
+ @org.osoa.sca.annotations.Constructor
+ public Mixed(@Autowire String param1,
+ @Property(name = "foo")String param2,
+ @Reference(name = "bar")String param3) {
+ }
+ }
+
+ public static final class AllAutowireNoName {
+ @org.osoa.sca.annotations.Constructor
+ public AllAutowireNoName(@Autowire String param1, @Autowire String param2, @Autowire String param3) {
+ }
+ }
+
+ public static final class Multiple {
+ @org.osoa.sca.annotations.Constructor
+ public Multiple(@Autowire Collection<String> param1,
+ @Property(name = "foo")String[] param2,
+ @Reference(name = "bar", required = true)List<String> param3,
+ @Property(name = "abc")Set<String> param4,
+ @Reference(name = "xyz")String[] param5) {
+ }
+ }
+
+ public void testMultiplicity() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Multiple> ctor1 =
+ Multiple.class.getConstructor(Collection.class, String[].class, List.class, Set.class, String[].class);
+ processor.visitConstructor(null, ctor1, type, null);
+ JavaMappedReference ref0 = type.getReferences().get("java.util.Collection0");
+ assertNotNull(ref0);
+ assertEquals(Multiplicity.ONE_N, ref0.getMultiplicity());
+ JavaMappedReference ref1 = type.getReferences().get("bar");
+ assertNotNull(ref1);
+ assertEquals(Multiplicity.ONE_N, ref1.getMultiplicity());
+ JavaMappedReference ref2 = type.getReferences().get("xyz");
+ assertNotNull(ref2);
+ assertEquals(Multiplicity.ZERO_N, ref2.getMultiplicity());
+ JavaMappedProperty prop1 = type.getProperties().get("foo");
+ assertNotNull(prop1);
+ assertTrue(prop1.isMany());
+ JavaMappedProperty prop2 = type.getProperties().get("abc");
+ assertNotNull(prop2);
+ assertTrue(prop2.isMany());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorPropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorPropertyTestCase.java
new file mode 100644
index 0000000000..fb125ca0f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorPropertyTestCase.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.core.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.implementation.java.DuplicatePropertyException;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorPropertyTestCase extends TestCase {
+
+ ConstructorProcessor processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ JavaMappedProperty<?> property = type.getProperties().get("myProp");
+ assertEquals(property.isMustSupply(), true);
+ assertEquals("myProp", property.getName());
+ }
+
+ public void testTwoPropertiesSameType() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getProperties().get("myProp1"));
+ assertNotNull(type.getProperties().get("myProp2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getProperties().get("myProp"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+// public void testMultiplicityRequired() throws Exception {
+ // TODO multiplicity
+// }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property(name = "myProp", required = true) String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public Foo(@Property Integer prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property(name = "myProp1") String prop1, @Property(name = "myProp2") String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property List prop) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public BadFoo(@Property(name = "myProp") String prop1, @Property(name = "myProp") String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public BadFoo(@Property String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public BadFoo(@Property Integer prop, @Property Integer prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
+ public BadFoo(@Property List ref, @Property(name = "myOtherRef") List ref2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java
new file mode 100644
index 0000000000..152f3b63d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorReferenceTestCase.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorReferenceTestCase extends TestCase {
+
+ ConstructorProcessor processor;
+
+ public void testReference() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ JavaMappedReference reference = type.getReferences().get("myRef");
+ assertEquals("myRef", reference.getName());
+ }
+
+ public void testTwoReferencesSameType() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getReferences().get("myRef1"));
+ assertNotNull(type.getReferences().get("myRef2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getReferences().get("myRef"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+ }
+
+// public void testMultiplicityRequired() throws Exception {
+ // TODO multiplicity
+// }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference(name = "myRef", required = true) String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference(name = "myRef1") String prop1, @Reference(name = "myRef2") String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myRef")
+ public Foo(@Reference Integer prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference List prop) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Reference(name = "myRef") String prop1, @Reference(name = "myRef") String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Reference String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myRef")
+ public BadFoo(@Reference Integer ref, @Reference Integer ref2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
+ public BadFoo(@Reference List ref, @Reference(name = "myOtherRef") List ref2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorResourceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorResourceTestCase.java
new file mode 100644
index 0000000000..c691a4d6bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorResourceTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.api.annotation.Resource;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorResourceTestCase extends TestCase {
+
+ ConstructorProcessor processor =
+ new ConstructorProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testResource() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ org.apache.tuscany.spi.implementation.java.Resource resource = type.getResources().get("myResource");
+ assertFalse(resource.isOptional());
+ }
+
+ public void testTwoResourcesSameType() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getResources().get("myResource1"));
+ assertNotNull(type.getResources().get("myResource2"));
+ }
+
+ public void testDuplicateResource() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (DuplicateResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(String.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ processor.visitConstructor(null, ctor, type, null);
+ assertNotNull(type.getResources().get("myResource"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ processor.visitConstructor(null, ctor, type, null);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource(name = "myResource") String resource) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myResource")
+ public Foo(@Resource Integer resource) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource(name = "myResource1") String res1, @Resource(name = "myResource2") String res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource List res) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Resource(name = "myResource") String res1, @Resource(name = "myResource") String res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Resource String res) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public BadFoo(@Resource Integer res, @Resource Integer res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRes", "myRes2"})
+ public BadFoo(@Resource List res, @Resource(name = "myOtherRes") List res2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java
new file mode 100644
index 0000000000..1ad92bfee9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ContextProcessorTestCase.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessorTestCase extends TestCase {
+ private ContextProcessor processor;
+ private CompositeComponent composite;
+
+ // FIXME: resurrect to test ComponentContext injection
+/*
+ public void testCompositeContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(composite, method, type, null);
+ assertNotNull(type.getResources().get("context"));
+ }
+*/
+
+ // FIXME: resurrect to test ComponentContext injection
+/*
+ public void testCompositeContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("context");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitField(composite, field, type, null);
+ assertNotNull(type.getResources().get("context"));
+ }
+*/
+
+ public void testRequestContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(composite, method, type, null);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testRequestContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("requestContext");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitField(composite, field, type, null);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testInvalidParamType() throws Exception {
+ Method method = Foo.class.getMethod("setContext", String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(composite, method, type, null);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidParamTypeField() throws Exception {
+ Field field = Foo.class.getDeclaredField("badContext");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitField(composite, field, type, null);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+
+ public void testInvalidParamNum() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(composite, method, type, null);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidNoParams() throws Exception {
+ Method method = Foo.class.getMethod("setContext");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(composite, method, type, null);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testNoContext() throws Exception {
+ Method method = Foo.class.getMethod("noContext", ComponentContext.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(composite, method, type, null);
+ assertEquals(0, type.getResources().size());
+ }
+
+ public void testNoContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("noContext");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitField(composite, field, type, null);
+ assertEquals(0, type.getResources().size());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new ContextProcessor();
+ processor.setWireService(EasyMock.createNiceMock(WireService.class));
+ processor.setWorkContext(EasyMock.createNiceMock(WorkContext.class));
+ composite = EasyMock.createNiceMock(CompositeComponent.class);
+ }
+
+ private class Foo {
+ @Context
+ protected ComponentContext context;
+
+ @Context
+ protected Object badContext;
+
+ protected ComponentContext noContext;
+
+ @Context
+ protected RequestContext requestContext;
+
+ @Context
+ public void setContext(ComponentContext context) {
+
+ }
+
+ @Context
+ public void setContext(String context) {
+
+ }
+
+ @Context
+ public void setContext(ComponentContext context, String string) {
+
+ }
+
+ @Context
+ public void setContext() {
+
+ }
+
+ public void noContext(ComponentContext context) {
+
+ }
+
+ @Context
+ public void setRequestContext(RequestContext requestContext) {
+ this.requestContext = requestContext;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConversationProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConversationProcessorTestCase.java
new file mode 100644
index 0000000000..0433fed3a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConversationProcessorTestCase.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.core.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationProcessorTestCase extends TestCase {
+ private ConversationProcessor processor = new ConversationProcessor();
+
+ public void testMaxIdleTime() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, FooMaxIdle.class, type, null);
+ assertEquals(10000L, type.getMaxIdleTime());
+ assertEquals(-1, type.getMaxAge());
+ }
+
+ public void testMaxAge() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, FooMaxAge.class, type, null);
+ assertEquals(10000L, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testBadFooBoth() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitClass(null, BadFooBoth.class, type, null);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+
+ public void testImplicitScope() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, ImplicitFooScope.class, type, null);
+ assertEquals(org.apache.tuscany.spi.model.Scope.CONVERSATION, type.getImplementationScope());
+ }
+
+ public void testBadFooScope() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitClass(null, BadFooScope.class, type, null);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+
+ public void testJustConversation() throws Exception {
+ // TODO do we want these semantics
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, FooJustConversation.class, type, null);
+ assertEquals(org.apache.tuscany.spi.model.Scope.CONVERSATION, type.getImplementationScope());
+ assertEquals(-1, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testSetConversationIDField() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Field field = FooWithConversationIDField.class.getDeclaredField("conversationID");
+ processor.visitField(null, field, type, null);
+ assertNotNull(type.getConversationIDMember());
+ assertEquals(field, type.getConversationIDMember());
+ }
+
+ public void testSetConversationIDMethod() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
+ processor.visitMethod(null, method, type, null);
+ assertNotNull(type.getConversationIDMember());
+ assertEquals(method, type.getConversationIDMember());
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxIdleTime = "10 seconds")
+ private class FooMaxIdle {
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class FooMaxAge {
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxAge = "10 seconds", maxIdleTime = "10 seconds")
+ private class BadFooBoth {
+ }
+
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class ImplicitFooScope {
+ }
+
+ @Scope("STATELESS")
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class BadFooScope {
+ }
+
+ @ConversationAttributes
+ private class FooJustConversation {
+ }
+
+ private class FooWithConversationIDField {
+ @ConversationID
+ private String conversationID;
+ }
+
+ private class FooWithConversationIDMethod {
+ @ConversationID
+ void setConversationID(String conversationID) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConvertTimeMillisTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConvertTimeMillisTestCase.java
new file mode 100644
index 0000000000..556416a797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConvertTimeMillisTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConvertTimeMillisTestCase extends TestCase {
+ private MockProcessor registy;
+
+ public void testConvertSeconds() throws Exception {
+ assertEquals(10000L, registy.convertTimeMillis("10 seconds"));
+ assertEquals(10000L, registy.convertTimeMillis("10 SECONDS"));
+ try {
+ registy.convertTimeMillis("10seconds");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertMinutes() throws Exception {
+ assertEquals(600000L, registy.convertTimeMillis("10 minutes"));
+ assertEquals(600000L, registy.convertTimeMillis("10 MINUTES"));
+ try {
+ registy.convertTimeMillis("10minutes");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertHours() throws Exception {
+ assertEquals(36000000L, registy.convertTimeMillis("10 hours"));
+ assertEquals(36000000L, registy.convertTimeMillis("10 HOURS"));
+ try {
+ registy.convertTimeMillis("10hours");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertDays() throws Exception {
+ assertEquals(864000000L, registy.convertTimeMillis("10 days"));
+ assertEquals(864000000L, registy.convertTimeMillis("10 DAYS"));
+ try {
+ registy.convertTimeMillis("10days");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertYears() throws Exception {
+ assertEquals(315569260000L, registy.convertTimeMillis("10 years"));
+ assertEquals(315569260000L, registy.convertTimeMillis("10 YEARS"));
+ try {
+ registy.convertTimeMillis("10years");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertDefault() throws Exception {
+ assertEquals(10000L, registy.convertTimeMillis("10 "));
+ assertEquals(10000L, registy.convertTimeMillis("10"));
+ }
+
+ public void testInvalid() throws Exception {
+ try {
+ registy.convertTimeMillis("foo");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registy = new MockProcessor();
+ }
+
+ private class MockProcessor extends ConversationProcessor {
+
+ @Override
+ protected long convertTimeMillis(String expr) throws NumberFormatException {
+ return super.convertTimeMillis(expr);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/DestroyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/DestroyProcessorTestCase.java
new file mode 100644
index 0000000000..6929250298
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/DestroyProcessorTestCase.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.core.implementation.processor;
+
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Destroy;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DestroyProcessorTestCase extends TestCase {
+
+ public void testDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = Foo.class.getMethod("destroy");
+ processor.visitMethod(null, method, type, null);
+ assertNotNull(type.getDestroyMethod());
+ }
+
+ public void testBadDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = Bar.class.getMethod("badDestroy", String.class);
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalDestructorException e) {
+ // expected
+ }
+ }
+
+ public void testTwoDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = Bar.class.getMethod("destroy");
+ Method method2 = Bar.class.getMethod("destroy2");
+ processor.visitMethod(null, method, type, null);
+ try {
+ processor.visitMethod(null, method2, type, null);
+ fail();
+ } catch (DuplicateDestructorException e) {
+ // expected
+ }
+ }
+
+
+ private class Foo {
+
+ @Destroy
+ public void destroy() {
+ }
+ }
+
+
+ private class Bar {
+
+ @Destroy
+ public void destroy() {
+ }
+
+ @Destroy
+ public void destroy2() {
+ }
+
+ @Destroy
+ public void badDestroy(String foo) {
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessorTestCase.java
new file mode 100644
index 0000000000..22770cbfce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/EagerInitProcessorTestCase.java
@@ -0,0 +1,54 @@
+package org.apache.tuscany.core.implementation.processor;
+
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessorTestCase extends TestCase {
+
+ public void testNoLevel() throws ProcessingException {
+ EagerInitProcessor processor = new EagerInitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, NoLevel.class, type, null);
+ assertEquals(50, type.getInitLevel());
+ }
+
+ public void testLevel() throws ProcessingException {
+ EagerInitProcessor processor = new EagerInitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, Level.class, type, null);
+ assertEquals(50, type.getInitLevel());
+ }
+
+ public void testSubclass() throws ProcessingException {
+ EagerInitProcessor processor = new EagerInitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, SubClass.class, type, null);
+ assertEquals(50, type.getInitLevel());
+ }
+
+ @EagerInit
+ private class NoLevel {
+ }
+
+ @EagerInit
+ private class Level {
+ }
+
+ private class SubClass extends Level {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicAndPropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicAndPropertyTestCase.java
new file mode 100644
index 0000000000..93de605e33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicAndPropertyTestCase.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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicAndPropertyTestCase extends TestCase {
+
+ private PropertyProcessor propertyProcessor;
+ private HeuristicPojoProcessor heuristicProcessor;
+
+ /**
+ * Verifies the property and heuristic processors don't collide
+ */
+ @SuppressWarnings("unchecked")
+ public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor ctor = Foo.class.getConstructor(String.class);
+ type.setConstructorDefinition(new ConstructorDefinition(ctor));
+ propertyProcessor.visitConstructor(null, ctor, type, null);
+ heuristicProcessor.visitEnd(null, Foo.class, type, null);
+ assertEquals(1, type.getProperties().size());
+ assertNotNull(type.getProperties().get("foo"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ImplementationProcessorServiceImpl service =
+ new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl());
+ propertyProcessor = new PropertyProcessor(service);
+ heuristicProcessor = new HeuristicPojoProcessor(service);
+ }
+
+ public static class Foo {
+ public Foo(@Property(name = "foo") String prop) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicConstructorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicConstructorTestCase.java
new file mode 100644
index 0000000000..92f6d54366
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicConstructorTestCase.java
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicConstructorTestCase extends TestCase {
+
+ private HeuristicPojoProcessor processor =
+ new HeuristicPojoProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ /**
+ * Verifies a single constructor is chosen with a parameter as the type
+ */
+ public void testSingleConstructorWithParam() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ JavaMappedProperty<String> prop = new JavaMappedProperty<String>();
+ prop.setName("foo");
+ prop.setJavaType(String.class);
+ type.getProperties().put("foo", prop);
+ processor.visitEnd(null, Foo1.class, type, null);
+ assertNotNull(type.getConstructorDefinition().getConstructor());
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a reference as the type
+ */
+ public void testSingleConstructorWithRef() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ JavaMappedReference ref = new JavaMappedReference();
+ ref.setName("foo");
+ ServiceContract contract = new JavaServiceContract(String.class);
+ ref.setServiceContract(contract);
+ type.getReferences().put("foo", ref);
+ processor.visitEnd(null, Foo1.class, type, null);
+ assertNotNull(type.getConstructorDefinition().getConstructor());
+ assertEquals("foo", type.getConstructorDefinition().getInjectionNames().get(0));
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a property and a reference as the type
+ */
+ public void testSingleConstructorWithPropRef() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+
+ JavaMappedProperty<String> prop = new JavaMappedProperty<String>();
+ prop.setName("foo");
+ prop.setJavaType(String.class);
+ type.getProperties().put("foo", prop);
+
+ JavaMappedReference ref = new JavaMappedReference();
+ ref.setName("ref");
+ ServiceContract contract = new JavaServiceContract(Foo1.class);
+ ref.setServiceContract(contract);
+ type.getReferences().put("ref", ref);
+ processor.visitEnd(null, Foo2.class, type, null);
+ assertNotNull(type.getConstructorDefinition().getConstructor());
+ assertEquals(2, type.getConstructorDefinition().getInjectionNames().size());
+ }
+
+
+ public void testSingleConstructorResolvableParam() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo5.class, type, null);
+ assertEquals(String.class, type.getProperties().get("string").getJavaType());
+ }
+
+ public void testSingleConstructorResolvableRef() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo6.class, type, null);
+ assertEquals(Ref.class,
+ type.getReferences().get("heuristicconstructortestcase$ref").getServiceContract().getInterfaceClass());
+ }
+
+ public void testSingleConstructorAmbiguousRef() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ JavaMappedReference ref = new JavaMappedReference();
+ ref.setName("ref");
+ ServiceContract contract = new JavaServiceContract(Foo1.class);
+ ref.setServiceContract(contract);
+ type.getReferences().put("ref", ref);
+ JavaMappedReference ref2 = new JavaMappedReference();
+ ref2.setName("ref2");
+ ref2.setServiceContract(contract);
+ type.getReferences().put("ref2", ref2);
+ try {
+ processor.visitEnd(null, Foo4.class, type, null);
+ fail();
+ } catch (AmbiguousConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorPropertyAnnotatedParamsOnly() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo7.class, type, null);
+ assertNotNull(type.getProperties().get("myProp"));
+ }
+
+ public void testConstructorReferenceAnnotatedParamsOnly() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo8.class, type, null);
+ assertNotNull(type.getReferences().get("myRef"));
+ }
+
+ public void testConstructorAutowireAnnotatedParamsOnly() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo9.class, type, null);
+ assertNotNull(type.getReferences().get("myAutowire"));
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testDefaultConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo3.class, type, null);
+ assertNotNull(type.getConstructorDefinition().getConstructor());
+ }
+
+ public void testSameTypesButAnnotated() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo12.class, type, null);
+ assertEquals(2, type.getProperties().size());
+ assertNotNull(type.getProperties().get("prop1"));
+ assertNotNull(type.getProperties().get("prop2"));
+ }
+
+ /**
+ * Verifies processing executes with additional extension annotations
+ */
+ public void testRandomAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo11.class, type, null);
+ assertEquals(1, type.getProperties().size());
+ assertNotNull(type.getProperties().get("prop1"));
+ }
+
+ public void testAutowire() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo13.class, type, null);
+ assertEquals(1, type.getReferences().size());
+ assertNotNull(type.getReferences().get(String.class.getName() + "0"));
+ }
+
+ public void testMultipleAutowire() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo15.class, type, null);
+ assertEquals(2, type.getReferences().size());
+ assertNotNull(type.getReferences().get(String.class.getName() + "0"));
+ assertNotNull(type.getReferences().get(String.class.getName() + "1"));
+ }
+
+ public void testNoAutowireNameInConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo16.class, type, null);
+ assertEquals(2, type.getReferences().size());
+ assertNotNull(type.getReferences().get(String.class.getName() + "0"));
+ assertNotNull(type.getReferences().get("bar"));
+ assertNotNull(type.getProperties().get("foo"));
+ }
+
+ public void testPrivateConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitEnd(null, Foo14.class, type, null);
+ fail();
+ } catch (NoConstructorException e) {
+ // expected
+ }
+ }
+
+
+ public void testMultipleConstructors() throws Exception {
+ // throw new UnsupportedOperationException("Finish heuristic multiple constructors - Foo10");
+ }
+
+
+ public static class Foo1 {
+ public Foo1(String val) {
+ }
+ }
+
+ public static class Foo2 {
+ public Foo2(String val, Foo1 ref) {
+ }
+ }
+
+ public static class Foo3 {
+ }
+
+ public static class Foo4 {
+ public Foo4(Foo1 ref) {
+ }
+ }
+
+ public static class Prop {
+
+ }
+
+ @Remotable
+ public static interface Ref {
+
+ }
+
+ public static class Foo5 {
+ public Foo5(String val) {
+ }
+ }
+
+ public static class Foo6 {
+ public Foo6(Ref ref) {
+ }
+ }
+
+ public static class Foo7 {
+ public Foo7(@Property(name = "myProp") String prop) {
+ }
+ }
+
+
+ public static class Foo8 {
+ public Foo8(@Reference(name = "myRef") String ref) {
+ }
+ }
+
+ public static class Foo9 {
+ public Foo9(@Autowire(name = "myAutowire") String autowire) {
+ }
+ }
+
+ public static class Foo10 {
+
+ public Foo10() {
+ }
+
+ public Foo10(String prop) {
+ }
+
+ public Foo10(@Property(name = "prop1") String prop1, @Property(name = "prop2") String prop2) {
+
+ }
+ }
+
+ public static class Foo11 {
+
+ public Foo11(@Property(name = "prop1") String prop, @Baz String baz) {
+ }
+ }
+
+ public static class Foo12 {
+
+ public Foo12(@Property(name = "prop1") String prop, @Property(name = "prop2") String baz) {
+ }
+ }
+
+ public @interface Baz {
+
+ }
+
+ public static class Foo13 {
+ public Foo13(@Autowire String foo) {
+ }
+ }
+
+ public static final class Foo14 {
+ private Foo14() {
+ }
+ }
+
+ public static final class Foo15 {
+ public Foo15(@Autowire String param1, @Autowire String param2) {
+ }
+ }
+
+ public static final class Foo16 {
+ public Foo16(@Autowire String param1,
+ @Property(name = "foo") String param2,
+ @Reference(name = "bar") String param3) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessorTestCase.java
new file mode 100644
index 0000000000..2b3c12a3aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeuristicPojoProcessorTestCase.java
@@ -0,0 +1,395 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * Verfies component type information is properly introspected from an unadorned POJO according to the SCA Java Client
+ * and Implementation Model Specification
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeuristicPojoProcessorTestCase extends TestCase {
+
+ private HeuristicPojoProcessor processor =
+ new HeuristicPojoProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ /**
+ * Verifies a single service interface is computed when only one interface is implemented
+ */
+ public void testSingleInterface() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(null, SingleInterfaceImpl.class, type, null);
+ assertEquals(1, type.getServices().size());
+ assertEquals(PropertyInterface.class,
+ type.getServices().get(PropertyInterface.class.getSimpleName())
+ .getServiceContract().getInterfaceClass());
+ assertTrue(type.getProperties().isEmpty());
+ assertTrue(type.getReferences().isEmpty());
+ }
+
+ /**
+ * Verifies property and reference setters are computed
+ */
+ public void testPropertyReference() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor =
+ SingleInterfaceWithPropertyReferenceImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceWithPropertyReferenceImpl>(ctor));
+ processor.visitEnd(null, SingleInterfaceWithPropertyReferenceImpl.class, type, null);
+ assertEquals(1, type.getServices().size());
+ assertEquals(Interface1.class,
+ type.getServices().get(Interface1.class.getSimpleName())
+ .getServiceContract().getInterfaceClass());
+ assertEquals(1, type.getProperties().size());
+ assertEquals(ComplexProperty.class, type.getProperties().get("property").getJavaType());
+ assertEquals(1, type.getReferences().size());
+ assertEquals(Ref.class, type.getReferences().get("reference").getServiceContract().getInterfaceClass());
+ }
+
+ /**
+ * Verifies that a property setter is not introspected if an analogous operation is in the service interface
+ */
+ public void testPropertySetterInInterface() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(null, SingleInterfaceImpl.class, type, null);
+ assertEquals(0, type.getProperties().size());
+ }
+
+ /**
+ * Verifies that a reference setter is not introspected if an analogous operation is in the service interface
+ */
+ public void testReferenceSetterInInterface() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<RefInterfaceImpl> ctor = RefInterfaceImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<RefInterfaceImpl>(ctor));
+ processor.visitEnd(null, RefInterfaceImpl.class, type, null);
+ assertEquals(0, type.getReferences().size());
+ }
+
+ /**
+ * Verifies collection generic types or array types are introspected as references according to spec rules
+ */
+ public void testReferenceCollectionType() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<ReferenceCollectionImpl>(ctor));
+ processor.visitEnd(null, ReferenceCollectionImpl.class, type, null);
+ assertEquals(0, type.getProperties().size());
+ assertEquals(4, type.getReferences().size());
+ }
+
+ /**
+ * Verifies collection generic types or array types are introspected as properties according to spec rules
+ */
+ public void testPropertyCollectionType() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<PropertyCollectionImpl>(ctor));
+ processor.visitEnd(null, PropertyCollectionImpl.class, type, null);
+ assertEquals(0, type.getReferences().size());
+ assertEquals(4, type.getProperties().size());
+ }
+
+ /**
+ * Verifies references are calculated when the type marked with is @Remotable
+ */
+ public void testRemotableRef() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<RemotableRefImpl>(ctor));
+ processor.visitEnd(null, RemotableRefImpl.class, type, null);
+ assertEquals(2, type.getReferences().size());
+ assertEquals(0, type.getProperties().size());
+ }
+
+ public void testParentInterface() throws ProcessingException, NoSuchMethodException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Child> ctor = Child.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<Child>(ctor));
+ processor.visitEnd(null, Child.class, type, null);
+ assertTrue(type.getServices().containsKey(Interface1.class.getSimpleName()));
+ }
+
+ /**
+ * Verifies a service inteface is calculated when only props and refs are given
+ */
+ public void testExcludedPropertyAndReference() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ JavaMappedReference ref = new JavaMappedReference();
+ ref.setName("reference");
+ type.add(ref);
+ JavaMappedReference ref2 = new JavaMappedReference();
+ ref2.setName("reference2");
+ type.add(ref2);
+ JavaMappedProperty<?> prop1 = new JavaMappedProperty();
+ prop1.setName("string1");
+ type.add(prop1);
+ JavaMappedProperty<?> prop2 = new JavaMappedProperty();
+ prop2.setName("string2");
+ type.add(prop2);
+ processor.visitEnd(null, MockService.class, type, null);
+ assertEquals(1, type.getServices().size());
+ }
+
+ public void testProtectedRemotableRefField() throws ProcessingException, NoSuchMethodException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<ProtectedRemotableRefFieldImpl>(ctor));
+ processor.visitEnd(null, ProtectedRemotableRefFieldImpl.class, type, null);
+ assertNotNull(type.getReferences().get("otherRef"));
+ }
+
+ public void testProtectedRemotableRefMethod() throws ProcessingException, NoSuchMethodException {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
+ type.setConstructorDefinition(new ConstructorDefinition<ProtectedRemotableRefMethodImpl>(ctor));
+ processor.visitEnd(null, ProtectedRemotableRefMethodImpl.class, type, null);
+ assertNotNull(type.getReferences().get("otherRef"));
+ }
+
+ public void testSetDataTypes() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor(int.class);
+ type.setConstructorDefinition(new ConstructorDefinition<PropertyIntTypeOnConstructor>(ctor));
+ processor.visitEnd(null, ProtectedRemotableRefMethodImpl.class, type, null);
+ org.apache.tuscany.spi.model.Property<?> foo = type.getProperties().get("foo");
+ assertEquals(int.class, foo.getJavaType());
+ assertEquals(SimpleTypeMapperExtension.XSD_INT, foo.getXmlType());
+ }
+
+ private static class PropertyIntTypeOnConstructor {
+ private int foo;
+
+ public PropertyIntTypeOnConstructor(@Property(name = "foo")int foo) {
+ this.foo = foo;
+ }
+
+ public int getFoo() {
+ return foo;
+ }
+ }
+
+ private interface PropertyInterface {
+ void setString1(String val);
+ }
+
+ private interface Interface1 {
+ }
+
+ private static class Parent implements Interface1 {
+
+ }
+
+ private static class Child extends Parent {
+ public Child() {
+ }
+
+ }
+
+ private static class SingleInterfaceImpl implements PropertyInterface {
+ public SingleInterfaceImpl() {
+ }
+
+ public void setString1(String val) {
+ }
+
+ }
+
+ private interface HeuristicServiceInterface {
+ void fooOperation(String ref);
+
+ void setInvalid1(); // No parameter
+
+ void setInvalid2(String str, int i); // More than one parameter
+
+ String setInvalid3(String str); // return should be void
+ }
+
+ public static class MockService implements PropertyInterface, RefInterface, HeuristicServiceInterface {
+
+ @Property
+ public void setString1(String val) {
+ }
+
+ @Property
+ public void setString2(String val) {
+ }
+
+ @Reference
+ public void setReference(Ref ref) {
+ }
+
+ @Reference
+ public void setReference2(Ref ref) {
+ }
+
+ public void fooOperation(String ref) {
+
+ }
+
+ public void setInvalid1() {
+ }
+
+ public void setInvalid2(String str, int i) {
+ }
+
+ public String setInvalid3(String str) {
+ return null;
+ }
+
+ }
+
+ @Service
+ private interface Ref {
+ }
+
+ private class ComplexProperty {
+ }
+
+ private interface RefInterface {
+ void setReference(Ref ref);
+ }
+
+ private static class RefInterfaceImpl implements RefInterface {
+ public RefInterfaceImpl() {
+ }
+
+ public void setReference(Ref ref) {
+ }
+ }
+
+ private static class SingleInterfaceWithPropertyReferenceImpl implements Interface1 {
+ public SingleInterfaceWithPropertyReferenceImpl() {
+ }
+
+ public void setReference(Ref ref) {
+ }
+
+ public void setProperty(ComplexProperty prop) {
+ }
+ }
+
+ private static class ReferenceCollectionImpl implements Interface1 {
+ public ReferenceCollectionImpl() {
+ }
+
+ public void setCollectionReference(Collection<Ref> ref) {
+ }
+
+ public void setNonGenericCollectionReference(Collection ref) {
+ }
+
+ public void setListReference(List<Ref> ref) {
+ }
+
+ public void setArrayReference(Ref[] ref) {
+ }
+ }
+
+ private static class PropertyCollectionImpl implements Interface1 {
+ public PropertyCollectionImpl() {
+ }
+
+ public void setCollectionProperty(Collection<ComplexProperty> prop) {
+ }
+
+ public void setCollectionProperty2(Collection<String> prop) {
+ }
+
+ public void setArrayProperty(ComplexProperty[] prop) {
+ }
+
+ public void setArrayProperty2(String[] prop) {
+ }
+ }
+
+ @Remotable
+ private interface RemotableRef {
+ }
+
+ private static class RemotableRefImpl implements Interface1 {
+ protected RemotableRef otherRef;
+
+ public RemotableRefImpl() {
+ }
+
+ public void setRef(RemotableRef ref) {
+
+ }
+ }
+
+ private static class ProtectedRemotableRefFieldImpl implements Interface1 {
+ protected RemotableRef otherRef;
+
+ public ProtectedRemotableRefFieldImpl() {
+ }
+
+ public ProtectedRemotableRefFieldImpl(RemotableRef otherRef) {
+ this.otherRef = otherRef;
+ }
+
+ }
+
+ private static class ProtectedRemotableRefMethodImpl implements Interface1 {
+ public ProtectedRemotableRefMethodImpl() {
+ }
+
+ protected void setOtherRef(RemotableRef otherRef) {
+ }
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.java
new file mode 100644
index 0000000000..4e6c1063d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/HeutisticExtensibleConstructorTestCase.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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * Verifies constructors that have extensible annotation types, i.e. that have parameters marked by annotations which
+ * are themselves processed by some other implementation processor
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeutisticExtensibleConstructorTestCase extends TestCase {
+
+ private HeuristicPojoProcessor processor =
+ new HeuristicPojoProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ /**
+ * Verifies heuristic processing can be called priot to an extension annotation processors being called.
+ */
+ public void testBarAnnotationProcessedFirst() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ ConstructorDefinition<Foo> definition = new ConstructorDefinition<Foo>(ctor);
+ type.setConstructorDefinition(definition);
+ JavaMappedProperty property = new JavaMappedProperty();
+ property.setName("myBar");
+ definition.getInjectionNames().add("myBar");
+ type.getProperties().put("myBar", property);
+ processor.visitEnd(null, Foo.class, type, null);
+ assertEquals(2, type.getProperties().size());
+ }
+
+ /**
+ * Verifies heuristic processing can be called before an extension annotation processors is called.
+ * <p/>
+ * For example, given:
+ * <pre> Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = "foo") String prop2)</pre>
+ * <p/>
+ * Heuristic evaluation of @Property can occur prior to another implementation processor evaluating @Bar
+ *
+ * @throws Exception
+ */
+ public void testBarAnnotationProcessedLast() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitEnd(null, Foo.class, type, null);
+
+ // now simulate process the bar impl
+ ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ List<String> injectionNames = definition.getInjectionNames();
+ injectionNames.remove(0);
+ injectionNames.add(0, "mybar");
+ type.getProperties().put("mybar", new JavaMappedProperty<String>());
+
+ assertEquals(2, type.getProperties().size());
+ assertEquals("foo", definition.getInjectionNames().get(1));
+ }
+
+ /**
+ * Verifies heuristic processing can be called before an extension annotation processors is called with the
+ * extension parameter in a middle position. Specifically, verifies that the heuristic processor updates injection
+ * names and preserves their ordering.
+ */
+ public void testBarAnnotationProcessedFirstInMiddle() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
+ ConstructorDefinition<Foo2> definition = new ConstructorDefinition<Foo2>(ctor);
+ type.setConstructorDefinition(definition);
+ // insert placeholder for first param, which would be done by a processor
+ definition.getInjectionNames().add("");
+ JavaMappedProperty property = new JavaMappedProperty();
+ property.setName("myBar");
+ definition.getInjectionNames().add("myBar");
+ type.getProperties().put("myBar", property);
+ processor.visitEnd(null, Foo2.class, type, null);
+ assertEquals("baz", definition.getInjectionNames().get(0));
+ assertEquals(2, type.getProperties().size());
+ assertEquals(1, type.getReferences().size());
+ }
+
+ public @interface Bar {
+
+ }
+
+ public static class Foo {
+ public Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = "foo") String prop2) {
+ }
+ }
+
+ public static class Foo2 {
+ public Foo2(@org.osoa.sca.annotations.Reference(name = "baz") String prop1,
+ @Bar String prop2,
+ @org.osoa.sca.annotations.Property(name = "foo") String prop3) {
+ }
+ }
+
+
+}
+
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceTestCase.java
new file mode 100644
index 0000000000..e843467866
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceTestCase.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.core.implementation.processor;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationProcessorServiceTestCase extends TestCase {
+ private JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ private ImplementationProcessorService implService = new ImplementationProcessorServiceImpl(registry);
+
+
+ public void testCreateConversationalService() throws Exception {
+ JavaMappedService service = implService.createService(Foo.class);
+ service.setServiceContract(registry.introspect(Foo.class, true));
+ assertTrue(Foo.class.equals(service.getServiceContract().getInterfaceClass()));
+ assertTrue(service.isRemotable());
+ assertEquals(InteractionScope.CONVERSATIONAL, service.getServiceContract().getInteractionScope());
+ ServiceContract serviceContract = service.getServiceContract();
+ assertTrue(Bar.class.equals(serviceContract.getCallbackClass()));
+ assertTrue("ImplementationProcessorServiceTestCase$Bar".equals(serviceContract.getCallbackName()));
+ }
+
+ public void testCreateDefaultService() throws Exception {
+ JavaMappedService service = implService.createService(Baz.class);
+ service.setServiceContract(registry.introspect(Baz.class, true));
+ assertTrue(Baz.class.equals(service.getServiceContract().getInterfaceClass()));
+ assertTrue(!service.isRemotable());
+ assertEquals(InteractionScope.NONCONVERSATIONAL, service.getServiceContract().getInteractionScope());
+ }
+
+ public void testProcessParamProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<PropertyClass> ctor = PropertyClass.class.getConstructor(int.class);
+ Annotation[] paramAnnotations = ctor.getParameterAnnotations()[0];
+ List<String> injectionNames = new ArrayList<String>();
+ String[] names = new String[]{"foo"};
+ implService.processParam(int.class,
+ ctor.getGenericParameterTypes()[0],
+ paramAnnotations,
+ names,
+ 0,
+ type,
+ injectionNames);
+ org.apache.tuscany.spi.model.Property<?> property = type.getProperties().get("foo");
+ assertEquals(int.class, property.getJavaType());
+ assertEquals(SimpleTypeMapperExtension.XSD_INT, property.getXmlType());
+ }
+
+
+ @Callback(Bar.class)
+ @Remotable
+ @Scope("CONVERSATION")
+ public interface Foo {
+
+ }
+
+ public interface Bar {
+
+ }
+
+ public interface Baz {
+
+ }
+
+ public static class PropertyClass {
+ private int foo;
+
+ public PropertyClass(@Property(name = "foo") int foo) {
+ this.foo = foo;
+ }
+
+ public int getFoo() {
+ return foo;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceUniqueTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceUniqueTestCase.java
new file mode 100644
index 0000000000..da45ed2d46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ImplementationProcessorServiceUniqueTestCase.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.implementation.processor;
+
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImplementationProcessorServiceUniqueTestCase extends TestCase {
+
+ private ImplementationProcessorService service =
+ new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl());
+
+ public void testUniquess1() throws Exception {
+ Class[] classes = new Class[2];
+ classes[0] = String.class;
+ classes[1] = Integer.class;
+ assertTrue(service.areUnique(classes));
+ }
+
+ public void testUniquess2() throws Exception {
+ Class[] classes = new Class[2];
+ classes[0] = String.class;
+ classes[1] = String.class;
+ assertFalse(service.areUnique(classes));
+ }
+
+ public void testUniquess3() throws Exception {
+ Class[] classes = new Class[1];
+ classes[0] = String.class;
+ assertTrue(service.areUnique(classes));
+ }
+
+ public void testUniquess4() throws Exception {
+ Class[] classes = new Class[3];
+ classes[0] = String.class;
+ classes[1] = Integer.class;
+ classes[2] = String.class;
+ assertFalse(service.areUnique(classes));
+ }
+
+ public void testUniquess5() throws Exception {
+ Class[] classes = new Class[0];
+ assertTrue(service.areUnique(classes));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/InitProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/InitProcessorTestCase.java
new file mode 100644
index 0000000000..13fe7d003a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/InitProcessorTestCase.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.core.implementation.processor;
+
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InitProcessorTestCase extends TestCase {
+
+ public void testInit() throws Exception {
+ InitProcessor processor = new InitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = InitProcessorTestCase.Foo.class.getMethod("init");
+ processor.visitMethod(null, method, type, null);
+ assertNotNull(type.getInitMethod());
+ assertEquals(0, type.getInitLevel());
+ }
+
+ public void testBadInit() throws Exception {
+ InitProcessor processor = new InitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("badInit", String.class);
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalInitException e) {
+ // expected
+ }
+ }
+
+ public void testTwoInit() throws Exception {
+ InitProcessor processor = new InitProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("init");
+ Method method2 = InitProcessorTestCase.Bar.class.getMethod("init2");
+ processor.visitMethod(null, method, type, null);
+ try {
+ processor.visitMethod(null, method2, type, null);
+ fail();
+ } catch (DuplicateInitException e) {
+ // expected
+ }
+ }
+
+
+ private class Foo {
+ @Init
+ public void init() {
+ }
+ }
+
+
+ private class Bar {
+ @Init
+ public void init() {
+ }
+
+ @Init
+ public void init2() {
+ }
+
+ @Init
+ public void badInit(String foo) {
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java
new file mode 100644
index 0000000000..8982fa3991
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/MonitorProcessorTestCase.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.IllegalPropertyException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.api.annotation.Monitor;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.host.MonitorFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MonitorProcessorTestCase extends TestCase {
+
+ private MonitorProcessor processor;
+ private MonitorFactory monitorFactory;
+
+ public void testSetter() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = Foo.class.getMethod("setMonitor", Foo.class);
+ EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(Foo.class))).andReturn(null);
+ EasyMock.replay(monitorFactory);
+ processor.visitMethod(null, method, type, null);
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ assertTrue(properties.get("monitor").getDefaultValueFactory() instanceof SingletonObjectFactory);
+ EasyMock.verify(monitorFactory);
+ }
+
+
+ public void testBadSetter() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Method method = BadMonitor.class.getMethod("setMonitor");
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testField() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Field field = Foo.class.getDeclaredField("bar");
+ EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(Foo.class))).andReturn(null);
+ EasyMock.replay(monitorFactory);
+ processor.visitField(null, field, type, null);
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ assertTrue(properties.get("bar").getDefaultValueFactory() instanceof SingletonObjectFactory);
+ EasyMock.verify(monitorFactory);
+ }
+
+ public void testConstructor() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Bar> ctor = Bar.class.getConstructor(BazMonitor.class);
+ EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
+ EasyMock.replay(monitorFactory);
+ processor.visitConstructor(null, ctor, type, null);
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ assertTrue(
+ properties.get(BazMonitor.class.getName()).getDefaultValueFactory() instanceof SingletonObjectFactory);
+ EasyMock.verify(monitorFactory);
+ }
+
+ /**
+ * Verifies calling the monitor processor to evaluate a constructor can be done after a property parameter is
+ * processed
+ */
+ public void testConstructorAfterProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Bar> ctor = Bar.class.getConstructor(String.class, BazMonitor.class);
+ EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
+ EasyMock.replay(monitorFactory);
+ ConstructorDefinition<Bar> definition = new ConstructorDefinition<Bar>(ctor);
+ JavaMappedProperty prop = new JavaMappedProperty();
+ definition.getInjectionNames().add("prop");
+ type.setConstructorDefinition(definition);
+ type.getProperties().put("prop", prop);
+ processor.visitConstructor(null, ctor, type, null);
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ assertEquals(BazMonitor.class.getName(), definition.getInjectionNames().get(1));
+ assertEquals(2, type.getProperties().size());
+ String name = BazMonitor.class.getName();
+ assertTrue(properties.get(name).getDefaultValueFactory() instanceof SingletonObjectFactory);
+ EasyMock.verify(monitorFactory);
+ }
+
+ /**
+ * Verifies calling the monitor processor to evaluate a constructor can be done before a property parameter is
+ * processed
+ */
+ public void testConstructorBeforeProperty() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ Constructor<Bar> ctor = Bar.class.getConstructor(String.class, BazMonitor.class);
+ EasyMock.expect(monitorFactory.getMonitor(EasyMock.eq(BazMonitor.class))).andReturn(null);
+ EasyMock.replay(monitorFactory);
+ processor.visitConstructor(null, ctor, type, null);
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ ConstructorDefinition definition = type.getConstructorDefinition();
+ assertEquals(2, definition.getInjectionNames().size());
+ assertEquals(BazMonitor.class.getName(), definition.getInjectionNames().get(1));
+ String name = BazMonitor.class.getName();
+ assertTrue(properties.get(name).getDefaultValueFactory() instanceof SingletonObjectFactory);
+ EasyMock.verify(monitorFactory);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ monitorFactory = EasyMock.createMock(MonitorFactory.class);
+ JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
+ ImplementationProcessorServiceImpl processor = new ImplementationProcessorServiceImpl(registry);
+ this.processor = new MonitorProcessor(monitorFactory, processor);
+ }
+
+ private class Foo {
+
+ @Monitor
+ protected Foo bar;
+
+ @Monitor
+ public void setMonitor(Foo foo) {
+ }
+ }
+
+
+ private class BadMonitor {
+
+ @Monitor
+ public void setMonitor() {
+ }
+ }
+
+ private interface BazMonitor {
+
+ }
+
+ private static class Bar {
+
+ public Bar(@Monitor BazMonitor monitor) {
+ }
+
+ public Bar(String prop, @Monitor BazMonitor monitor) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java
new file mode 100644
index 0000000000..a4a60f13a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/PropertyProcessorTestCase.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.implementation.java.DuplicatePropertyException;
+import org.apache.tuscany.spi.implementation.java.IllegalPropertyException;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PropertyProcessorTestCase extends TestCase {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+ PropertyProcessor processor;
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(null, Foo.class.getMethod("setFoo", String.class), type, null);
+ assertNotNull(type.getProperties().get("foo"));
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(null, Foo.class.getMethod("setFooRequired", String.class), type, null);
+ JavaMappedProperty prop = type.getProperties().get("fooRequired");
+ assertNotNull(prop);
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(null, Foo.class.getMethod("setBarMethod", String.class), type, null);
+ assertNotNull(type.getProperties().get("bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(null, Foo.class.getDeclaredField("baz"), type, null);
+ assertNotNull(type.getProperties().get("baz"));
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(null, Foo.class.getDeclaredField("bazRequired"), type, null);
+ JavaMappedProperty prop = type.getProperties().get("bazRequired");
+ assertNotNull(prop);
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(null, Foo.class.getDeclaredField("bazField"), type, null);
+ assertNotNull(type.getProperties().get("theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(null, Bar.class.getDeclaredField("dup"), type, null);
+ try {
+ processor.visitField(null, Bar.class.getDeclaredField("baz"), type, null);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(null, Bar.class.getMethod("dupMethod", String.class), type, null);
+ try {
+ processor.visitMethod(null, Bar.class.getMethod("dupSomeMethod", String.class), type, null);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(null, Bar.class.getMethod("badMethod"), type, null);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
+ processor = new PropertyProcessor(new ImplementationProcessorServiceImpl(registry));
+ }
+
+ private class Foo {
+
+ @Property
+ protected String baz;
+ @Property(required = true)
+ protected String bazRequired;
+ @Property(name = "theBaz")
+ protected String bazField;
+
+ @Property
+ public void setFoo(String string) {
+ }
+
+ @Property(required = true)
+ public void setFooRequired(String string) {
+ }
+
+ @Property(name = "bar")
+ public void setBarMethod(String string) {
+ }
+
+ }
+
+ private class Bar {
+
+ @Property
+ protected String dup;
+
+ @Property(name = "dup")
+ protected String baz;
+
+ @Property
+ public void dupMethod(String s) {
+ }
+
+ @Property(name = "dupMethod")
+ public void dupSomeMethod(String s) {
+ }
+
+ @Property
+ public void badMethod() {
+ }
+
+ }
+
+ private class Multiple {
+ @Property
+ protected List<String> refs1;
+
+ @Property
+ protected String[] refs2;
+
+ @Property
+ public void setRefs3(String[] refs) {
+ }
+
+ @Property
+ public void setRefs4(Collection<String> refs) {
+ }
+
+ }
+
+ public void testMultiplicityCollection() throws Exception {
+ processor.visitField(null, Multiple.class.getDeclaredField("refs1"), type, null);
+ JavaMappedProperty prop = type.getProperties().get("refs1");
+ assertNotNull(prop);
+ assertSame(String.class, prop.getJavaType());
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArray() throws Exception {
+ processor.visitField(null, Multiple.class.getDeclaredField("refs2"), type, null);
+ JavaMappedProperty prop = type.getProperties().get("refs2");
+ assertNotNull(prop);
+ assertSame(String.class, prop.getJavaType());
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArrayMethod() throws Exception {
+ processor.visitMethod(null, Multiple.class.getMethod("setRefs3", String[].class), type, null);
+ JavaMappedProperty prop = type.getProperties().get("refs3");
+ assertNotNull(prop);
+ assertSame(String.class, prop.getJavaType());
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityCollectionMethod() throws Exception {
+ processor.visitMethod(null, Multiple.class.getMethod("setRefs4", Collection.class), type, null);
+ JavaMappedProperty prop = type.getProperties().get("refs4");
+ assertNotNull(prop);
+ assertSame(String.class, prop.getJavaType());
+ assertTrue(prop.isMany());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..80d3687170
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ReferenceProcessorTestCase.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.core.implementation.processor;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProcessorTestCase extends TestCase {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ ReferenceProcessor processor = new ReferenceProcessor(new JavaInterfaceProcessorRegistryImpl());
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(null, ReferenceProcessorTestCase.Foo.class.getMethod("setFoo", Ref.class), type, null);
+ JavaMappedReference reference = type.getReferences().get("foo");
+ assertNotNull(reference);
+ ServiceContract contract = reference.getServiceContract();
+ assertEquals(Ref.class, contract.getInterfaceClass());
+ assertEquals("ReferenceProcessorTestCase$Ref", contract.getInterfaceName());
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(null,
+ ReferenceProcessorTestCase.Foo.class.getMethod("setFooRequired", Ref.class),
+ type,
+ null);
+ JavaMappedReference prop = type.getReferences().get("fooRequired");
+ assertNotNull(prop);
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(null,
+ ReferenceProcessorTestCase.Foo.class.getMethod("setBarMethod", Ref.class),
+ type,
+ null);
+ assertNotNull(type.getReferences().get("bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(null, ReferenceProcessorTestCase.Foo.class.getDeclaredField("baz"), type, null);
+ JavaMappedReference reference = type.getReferences().get("baz");
+ assertNotNull(reference);
+ ServiceContract contract = reference.getServiceContract();
+ assertEquals(Ref.class, contract.getInterfaceClass());
+ assertEquals("ReferenceProcessorTestCase$Ref", contract.getInterfaceName());
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(null, ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazRequired"), type, null);
+ JavaMappedReference prop = type.getReferences().get("bazRequired");
+ assertNotNull(prop);
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(null, ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazField"), type, null);
+ assertNotNull(type.getReferences().get("theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(null, ReferenceProcessorTestCase.Bar.class.getDeclaredField("dup"), type, null);
+ try {
+ processor.visitField(null, ReferenceProcessorTestCase.Bar.class.getDeclaredField("baz"), type, null);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(null, ReferenceProcessorTestCase.Bar.class.getMethod("dupMethod", Ref.class), type, null);
+ try {
+ processor.visitMethod(null,
+ ReferenceProcessorTestCase.Bar.class.getMethod("dupSomeMethod", Ref.class),
+ type,
+ null);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(null, ReferenceProcessorTestCase.Bar.class.getMethod("badMethod"), type, null);
+ fail();
+ } catch (IllegalReferenceException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor = new ReferenceProcessor(new JavaInterfaceProcessorRegistryImpl());
+ }
+
+ private interface Ref {
+ }
+
+ private class Foo {
+
+ @Reference
+ protected Ref baz;
+ @Reference(required = true)
+ protected Ref bazRequired;
+ @Reference(name = "theBaz")
+ protected Ref bazField;
+
+ @Reference
+ public void setFoo(Ref ref) {
+ }
+
+ @Reference(required = true)
+ public void setFooRequired(Ref ref) {
+ }
+
+ @Reference(name = "bar")
+ public void setBarMethod(Ref ref) {
+ }
+
+ }
+
+ private class Bar {
+
+ @Reference
+ protected Ref dup;
+
+ @Reference(name = "dup")
+ protected Ref baz;
+
+ @Reference
+ public void dupMethod(Ref s) {
+ }
+
+ @Reference(name = "dupMethod")
+ public void dupSomeMethod(Ref s) {
+ }
+
+ @Reference
+ public void badMethod() {
+ }
+
+ }
+
+ private class Multiple {
+ @Reference(required = true)
+ protected List<Ref> refs1;
+
+ @Reference(required = false)
+ protected Ref[] refs2;
+
+ @Reference(required = true)
+ public void setRefs3(Ref[] refs) {
+ }
+
+ @Reference(required = false)
+ public void setRefs4(Collection<Ref> refs) {
+ }
+
+ }
+
+ public void testMultiplicity1ToN() throws Exception {
+ processor.visitField(null, Multiple.class.getDeclaredField("refs1"), type, null);
+ JavaMappedReference prop = type.getReferences().get("refs1");
+ assertNotNull(prop);
+ assertSame(Ref.class, prop.getServiceContract().getInterfaceClass());
+ assertEquals(Multiplicity.ONE_N, prop.getMultiplicity());
+ }
+
+ public void testMultiplicityTo0ToN() throws Exception {
+ processor.visitField(null, Multiple.class.getDeclaredField("refs2"), type, null);
+ JavaMappedReference prop = type.getReferences().get("refs2");
+ assertNotNull(prop);
+ assertSame(Ref.class, prop.getServiceContract().getInterfaceClass());
+ assertEquals(Multiplicity.ZERO_N, prop.getMultiplicity());
+ }
+
+ public void testMultiplicity1ToNMethod() throws Exception {
+ processor.visitMethod(null, Multiple.class.getMethod("setRefs3", Ref[].class), type, null);
+ JavaMappedReference prop = type.getReferences().get("refs3");
+ assertNotNull(prop);
+ assertSame(Ref.class, prop.getServiceContract().getInterfaceClass());
+ assertEquals(Multiplicity.ONE_N, prop.getMultiplicity());
+ }
+
+ public void testMultiplicity0ToNMethod() throws Exception {
+ processor.visitMethod(null, Multiple.class.getMethod("setRefs4", Collection.class), type, null);
+ JavaMappedReference prop = type.getReferences().get("refs4");
+ assertNotNull(prop);
+ assertSame(Ref.class, prop.getServiceContract().getInterfaceClass());
+ assertEquals(Multiplicity.ZERO_N, prop.getMultiplicity());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java
new file mode 100644
index 0000000000..96bf4a3ed3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java
@@ -0,0 +1,99 @@
+package org.apache.tuscany.core.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessorTestCase extends TestCase {
+
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+ ResourceProcessor processor = new ResourceProcessor();
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(null, field, type, null);
+ Resource resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(field.getType(), resource.getType());
+ }
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", Bar.class);
+ processor.visitMethod(null, method, type, null);
+ Resource resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(method.getParameterTypes()[0], resource.getType());
+ }
+
+ public void testVisitNamedMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar2", Bar.class);
+ processor.visitMethod(null, method, type, null);
+ Resource resource = type.getResources().get("someName");
+ assertFalse(resource.isOptional());
+ assertEquals("mapped", resource.getMappedName());
+ }
+
+ public void testVisitBadMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBad");
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalResourceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateResources() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(null, field, type, null);
+ try {
+ processor.visitField(null, field, type, null);
+ fail();
+ } catch (DuplicateResourceException e) {
+ //expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ }
+
+ private class Foo {
+
+ @org.apache.tuscany.api.annotation.Resource
+ protected Bar bar;
+
+ @org.apache.tuscany.api.annotation.Resource(optional = true)
+ protected Bar barNotRequired;
+
+ @org.apache.tuscany.api.annotation.Resource
+ public void setBar(Bar bar) {
+ }
+
+ @org.apache.tuscany.api.annotation.Resource(name = "someName", mappedName = "mapped")
+ public void setBar2(Bar bar) {
+ }
+
+ @org.apache.tuscany.api.annotation.Resource
+ public void setBad() {
+ }
+
+ }
+
+ private interface Bar {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java
new file mode 100644
index 0000000000..dc65dc44f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessorTestCase extends TestCase {
+
+ CompositeComponent parent;
+
+ public void testCompositeScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+
+ processor.visitClass(parent, Composite.class, type, null);
+ assertEquals(Scope.COMPOSITE, type.getImplementationScope());
+ }
+
+ public void testSessionScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, Session.class, type, null);
+ assertEquals(Scope.SESSION, type.getImplementationScope());
+ }
+
+ public void testConversationalScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, Conversation.class, type, null);
+ assertEquals(Scope.CONVERSATION, type.getImplementationScope());
+ }
+
+ public void testRequestScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, Request.class, type, null);
+ assertEquals(Scope.REQUEST, type.getImplementationScope());
+ }
+
+ public void testSystemScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, System.class, type, null);
+ assertEquals(Scope.SYSTEM, type.getImplementationScope());
+ }
+
+ public void testStatelessScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, Stateless.class, type, null);
+ assertEquals(Scope.STATELESS, type.getImplementationScope());
+ }
+
+ public void testNoScope() throws ProcessingException {
+ ScopeProcessor processor = new ScopeProcessor();
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(parent, None.class, type, null);
+ assertEquals(Scope.STATELESS, type.getImplementationScope());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ }
+
+ @org.osoa.sca.annotations.Scope("COMPOSITE")
+ private class Composite {
+ }
+
+ @org.osoa.sca.annotations.Scope("SESSION")
+ private class Session {
+ }
+
+ @org.osoa.sca.annotations.Scope("CONVERSATION")
+ private class Conversation {
+ }
+
+ @org.osoa.sca.annotations.Scope("REQUEST")
+ private class Request {
+ }
+
+ @org.osoa.sca.annotations.Scope("SYSTEM")
+ private class System {
+ }
+
+ @org.osoa.sca.annotations.Scope("STATELESS")
+ private class Stateless {
+ }
+
+ private class None {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
new file mode 100644
index 0000000000..29cae3beae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.idl.java.IllegalCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceCallbackTestCase extends TestCase {
+
+ ServiceProcessor processor =
+ new ServiceProcessor(new ImplementationProcessorServiceImpl(new JavaInterfaceProcessorRegistryImpl()));
+
+ public void testMethodCallbackInterface() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, FooImpl.class, type, null);
+ JavaMappedService service = type.getServices().get(Foo.class.getSimpleName());
+ assertNotNull(service);
+ Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
+ processor.visitMethod(null, method, type, null);
+ assertEquals(method, service.getCallbackMember());
+ }
+
+ public void testFieldCallbackInterface() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, FooImpl.class, type, null);
+ JavaMappedService service = type.getServices().get(Foo.class.getSimpleName());
+ assertNotNull(service);
+ Field field = FooImpl.class.getDeclaredField("callback");
+ processor.visitField(null, field, type, null);
+ assertEquals(field, service.getCallbackMember());
+ }
+
+ public void testMethodDoesNotMatchCallback() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, BadBarImpl.class, type, null);
+ Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoParamCallback() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, BadBarImpl.class, type, null);
+ Method method = BadBarImpl.class.getMethod("setNoParamCallback");
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testFieldDoesNotMatchCallback() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitClass(null, BadBarImpl.class, type, null);
+ Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
+ try {
+ processor.visitField(null, field, type, null);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testBadCallbackInterfaceAnnotation() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitClass(null, BadFooImpl.class, type, null);
+ fail();
+ } catch (ProcessingException e) {
+ // expected
+ assertTrue(e.getCause() instanceof IllegalCallbackException);
+ }
+ }
+
+ @Callback(FooCallback.class)
+ private interface Foo {
+
+ }
+
+ private interface FooCallback {
+
+ }
+
+ @Service(Foo.class)
+ private static class FooImpl implements Foo {
+
+ @Callback
+ protected FooCallback callback;
+
+ @Callback
+ public void setCallback(FooCallback cb) {
+
+ }
+ }
+
+ private static class BadBarImpl implements Foo {
+ @Callback
+ protected String wrongInterfaceCallback;
+
+ @Callback
+ public void setWrongInterfaceCallback(String cb) {
+
+ }
+
+ @Callback
+ public void setNoParamCallback() {
+
+ }
+
+ }
+
+ @Callback
+ private interface BadFoo {
+
+ }
+
+ @Service(BadFoo.class)
+ private static class BadFooImpl implements BadFoo {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
new file mode 100644
index 0000000000..ed7cc6b8e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.processor;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessorTestCase extends TestCase {
+ private ServiceProcessor processor;
+ private PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type;
+
+ public void testMultipleInterfaces() throws Exception {
+ processor.visitClass(null, FooMultiple.class, type, null);
+ assertEquals(2, type.getServices().size());
+ JavaMappedService service = type.getServices().get(Baz.class.getSimpleName());
+ ServiceContract contract = service.getServiceContract();
+ assertEquals(Baz.class, contract.getInterfaceClass());
+ assertEquals(Bar.class, contract.getCallbackClass());
+ assertEquals("ServiceProcessorTestCase$Bar", contract.getCallbackName());
+ assertNotNull(type.getServices().get(Bar.class.getSimpleName()));
+ }
+
+ public void testSingleInterfaces() throws Exception {
+ processor.visitClass(null, FooSingle.class, type, null);
+ assertEquals(1, type.getServices().size());
+ assertNotNull(type.getServices().get(Baz.class.getSimpleName()));
+ }
+
+ public void testMultipleNoService() throws Exception {
+ processor.visitClass(null, FooMultipleNoService.class, type, null);
+ assertEquals(0, type.getServices().size());
+ }
+
+ public void testRemotableNoService() throws Exception {
+ processor.visitClass(null, FooRemotableNoService.class, type, null);
+ assertEquals(1, type.getServices().size());
+ JavaMappedService service = type.getServices().get(BazRemotable.class.getSimpleName());
+ ServiceContract contract = service.getServiceContract();
+ assertEquals(BazRemotable.class, contract.getInterfaceClass());
+ }
+
+ public void testNonInterface() throws Exception {
+ try {
+ processor.visitClass(null, BadImpl.class, type, null);
+ fail();
+ } catch (InvalidServiceType e) {
+ //expected
+ }
+ }
+
+ public void testNoInterfaces() throws Exception {
+ try {
+ processor.visitClass(null, BadDefinition.class, type, null);
+ fail();
+ } catch (IllegalServiceDefinitionException e) {
+ //expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistryImpl registry = new JavaInterfaceProcessorRegistryImpl();
+ processor = new ServiceProcessor(new ImplementationProcessorServiceImpl(registry));
+ type = new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ }
+
+ @Callback(Bar.class)
+ private interface Baz {
+ }
+
+ private interface Bar {
+ }
+
+ @Remotable
+ private interface BazRemotable {
+ }
+
+ @Service(interfaces = {Baz.class, Bar.class})
+ private class FooMultiple implements Baz, Bar {
+
+ }
+
+ @Service(Baz.class)
+ private class FooSingle implements Baz, Bar {
+
+ }
+
+ private class FooMultipleNoService implements Baz, Bar {
+
+ }
+
+ private class FooRemotableNoService implements BazRemotable, Bar {
+
+ }
+
+ @Service(FooSingle.class)
+ private class BadImpl extends FooSingle {
+
+ }
+
+
+ @Service()
+ private class BadDefinition extends FooSingle {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java
new file mode 100644
index 0000000000..091f231f37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilderResourceTestCase.java
@@ -0,0 +1,75 @@
+package org.apache.tuscany.core.implementation.system.builder;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.Resource;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SystemComponentBuilderResourceTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testResourceInjection() throws Exception {
+ ScopeContainer container = EasyMock.createNiceMock(ScopeContainer.class);
+ DeploymentContext ctx = EasyMock.createNiceMock(DeploymentContext.class);
+ ScopeRegistry registry = EasyMock.createMock(ScopeRegistry.class);
+ EasyMock.expect(registry.getScopeContainer(Scope.STATELESS)).andReturn(container);
+ EasyMock.replay(registry);
+ SystemComponentBuilder builder = new SystemComponentBuilder();
+ builder.setScopeRegistry(registry);
+ ConstructorDefinition<Foo> ctorDef = new ConstructorDefinition<SystemComponentBuilderResourceTestCase.Foo>(
+ SystemComponentBuilderResourceTestCase.Foo.class.getConstructor());
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ Resource resource = new Resource();
+ resource.setType(String.class);
+ resource.setName("resource");
+ resource.setMember(SystemComponentBuilderResourceTestCase.Foo.class.getDeclaredField("resource"));
+ type.add(resource);
+ type.setImplementationScope(Scope.STATELESS);
+ type.setConstructorDefinition(ctorDef);
+ SystemImplementation impl = new SystemImplementation();
+ impl.setImplementationClass(SystemComponentBuilderResourceTestCase.Foo.class);
+ impl.setComponentType(type);
+ ComponentDefinition<SystemImplementation> definition =
+ new ComponentDefinition<SystemImplementation>("foo", impl);
+
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn("result");
+ EasyMock.replay(wire);
+
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(String.class)).andReturn(wire);
+ EasyMock.replay(parent);
+ AtomicComponent component = builder.build(parent, definition, ctx);
+ SystemComponentBuilderResourceTestCase.Foo foo =
+ (SystemComponentBuilderResourceTestCase.Foo) component.createInstance();
+ assertEquals("result", foo.resource);
+ EasyMock.verify(parent);
+ }
+
+ private static class Foo {
+
+ protected String resource;
+
+ public Foo() {
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java
new file mode 100644
index 0000000000..b8789cb8b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.system.component;
+
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.EventInvoker;
+import org.apache.tuscany.core.injection.MethodEventInvoker;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies a system atomic component can be started and initialized
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SystemAtomicComponentTestCase extends TestCase {
+
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+
+ public void testDefaultCreationAndInit() throws Exception {
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(Foo.class.getConstructor((Class[]) null));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ Foo foo = (Foo) component.createInstance();
+ component.init(foo);
+ assertTrue(foo.initialized);
+ }
+
+ public void testDestroy() throws Exception {
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(Foo.class.getConstructor((Class[]) null));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setDestroyInvoker(destroyInvoker);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ Foo foo = (Foo) component.createInstance();
+ component.destroy(foo);
+ assertTrue(foo.destroyed);
+ }
+
+ public void testReferenceAndPropertyConstructor() throws Exception {
+ PojoObjectFactory<Bar> factory = new PojoObjectFactory<Bar>(Bar.class.getConstructor(String.class, Foo.class));
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(factory);
+ configuration.setInitInvoker(initInvoker);
+ configuration.addConstructorParamName("foo");
+ configuration.addConstructorParamType(String.class);
+ configuration.addConstructorParamName("ref");
+ configuration.addConstructorParamType(Foo.class);
+ configuration.setName("foo");
+ SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
+ component.addPropertyFactory("foo", new SingletonObjectFactory<String>("baz"));
+ Foo target = new Foo();
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn(target);
+ EasyMock.expect(wire.getReferenceName()).andReturn("ref").anyTimes();
+ EasyMock.replay(wire);
+ component.addOutboundWire(wire);
+ Bar bar = (Bar) component.createInstance();
+ assertEquals("baz", bar.foo);
+ assertEquals(target, bar.ref);
+ EasyMock.verify(wire);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ initInvoker = new MethodEventInvoker<Object>(Foo.class.getMethod("init"));
+ destroyInvoker = new MethodEventInvoker<Object>(Foo.class.getMethod("destroy"));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public static class Foo {
+ private boolean initialized;
+ private boolean destroyed;
+
+ public void init() {
+ initialized = true;
+ }
+
+ public void destroy() {
+ destroyed = true;
+ }
+ }
+
+ public static class Bar {
+
+ private String foo;
+ private Foo ref;
+
+ public Bar(String foo, Foo ref) {
+ this.foo = foo;
+ this.ref = ref;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentWireInvocationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentWireInvocationTestCase.java
new file mode 100644
index 0000000000..c4a2664228
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentWireInvocationTestCase.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.implementation.system.component;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+import org.easymock.EasyMock;
+
+/**
+ * Tests reference wires are injected properly into system component instances
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class SystemAtomicComponentWireInvocationTestCase extends TestCase {
+
+ public void testWireResolution() throws Exception {
+ CompositeScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ Target target = new TargetImpl();
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.addReferenceSite("setTarget", SourceImpl.class.getMethod("setTarget", Target.class));
+ configuration.setInstanceFactory(new PojoObjectFactory<SourceImpl>(SourceImpl.class.getConstructor()));
+ configuration.setName("source");
+ AtomicComponent component = new SystemAtomicComponentImpl(configuration);
+ component.setScopeContainer(scope);
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(outboundWire.getReferenceName()).andReturn("setTarget").atLeastOnce();
+ EasyMock.expect(outboundWire.getTargetService()).andReturn(target);
+ EasyMock.replay(outboundWire);
+ component.addOutboundWire(outboundWire);
+ component.start();
+ assertSame(((Source) component.getTargetInstance()).getTarget(), target);
+ EasyMock.verify(outboundWire);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java
new file mode 100644
index 0000000000..bc86d82f34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemComponentTypeLoaderTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.system.loader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.implementation.java.ProcessingException;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
+import org.apache.tuscany.core.implementation.processor.ConstructorProcessor;
+import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
+import org.apache.tuscany.core.implementation.processor.HeuristicPojoProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
+import org.apache.tuscany.core.implementation.processor.InitProcessor;
+import org.apache.tuscany.core.implementation.processor.PropertyProcessor;
+import org.apache.tuscany.core.implementation.processor.ReferenceProcessor;
+import org.apache.tuscany.core.implementation.processor.ScopeProcessor;
+import org.apache.tuscany.core.implementation.processor.ServiceProcessor;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.mock.component.BasicInterface;
+import org.apache.tuscany.core.mock.component.BasicInterfaceImpl;
+import org.apache.tuscany.core.monitor.NullMonitorFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SystemComponentTypeLoaderTestCase extends TestCase {
+ private SystemComponentTypeLoader loader;
+
+ public void testIntrospectUnannotatedClass() throws ProcessingException {
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ SystemImplementation impl = new SystemImplementation(BasicInterfaceImpl.class);
+ PojoComponentType<?, ?, ?> componentType = loader.loadByIntrospection(parent, impl, null);
+ ServiceDefinition service = componentType.getServices().get(BasicInterface.class.getSimpleName());
+ assertEquals(BasicInterface.class, service.getServiceContract().getInterfaceClass());
+ Property<?> property = componentType.getProperties().get("publicProperty");
+ assertEquals(String.class, property.getJavaType());
+ AbstractReferenceDefinition referenceDefinition = componentType.getReferences().get("protectedReference");
+ assertEquals(BasicInterface.class, referenceDefinition.getServiceContract().getInterfaceClass());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
+ ImplementationProcessorService service =
+ new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
+ IntrospectionRegistryImpl registry = new IntrospectionRegistryImpl();
+ registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
+ registry.registerProcessor(new ConstructorProcessor(service));
+ registry.registerProcessor(new DestroyProcessor());
+ registry.registerProcessor(new InitProcessor());
+ registry.registerProcessor(new ScopeProcessor());
+ registry.registerProcessor(new PropertyProcessor(service));
+ registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+ registry.registerProcessor(new ServiceProcessor(service));
+ registry.registerProcessor(new HeuristicPojoProcessor(service));
+ loader = new SystemComponentTypeLoader(registry);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..6cb059d629
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/loader/SystemImplementationLoaderTestCase.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.core.implementation.system.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SystemImplementationLoaderTestCase extends TestCase {
+
+ public static final QName SYSTEM_IMPLEMENTATION =
+ new QName("http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT", "implementation.system");
+
+ public void testLoad() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ DeploymentContext context = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(context.getClassLoader()).andReturn(getClass().getClassLoader());
+ EasyMock.replay(context);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(SYSTEM_IMPLEMENTATION);
+ EasyMock.expect(reader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("class")))
+ .andReturn(getClass().getName());
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ SystemImplementationLoader loader = new SystemImplementationLoader(registry);
+ SystemImplementation impl = loader.load(null, null, reader, context);
+ assertEquals(getClass(), impl.getImplementationClass());
+ EasyMock.verify(reader);
+ EasyMock.verify(context);
+ }
+
+ public void testUnrecognizedElement() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ DeploymentContext context = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(context.getClassLoader()).andReturn(getClass().getClassLoader());
+ EasyMock.replay(context);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(SYSTEM_IMPLEMENTATION).atLeastOnce();
+ EasyMock.expect(reader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("class")))
+ .andReturn(getClass().getName());
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getLocation()).andReturn(new MockLocation());
+ EasyMock.replay(reader);
+ SystemImplementationLoader loader = new SystemImplementationLoader(registry);
+ try {
+ loader.load(null, null, reader, context);
+ fail();
+ } catch (UnrecognizedElementException e) {
+ // expected
+ }
+ }
+
+ private class MockLocation implements 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;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java
new file mode 100644
index 0000000000..0a3a052024
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.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.injection;
+
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactoryTestCase extends TestCase {
+
+ public void testCreateInstance() throws Exception {
+ WireService service = createMock(WireService.class);
+ service.createCallbackProxy(Foo.class, null);
+ expectLastCall().andReturn(null);
+ replay(service);
+ CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, null);
+ factory.getInstance();
+ verify(service);
+ }
+
+ private interface Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/FieldInjectorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/FieldInjectorTestCase.java
new file mode 100644
index 0000000000..d31347f7e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/FieldInjectorTestCase.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.core.injection;
+
+import java.lang.reflect.Field;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FieldInjectorTestCase extends TestCase {
+
+ protected Field protectedField;
+
+ public void testIllegalAccess() throws Exception {
+ FieldInjector<Foo> injector = new FieldInjector<Foo>(protectedField, new SingletonObjectFactory<String>("foo"));
+ Foo foo = new Foo();
+ injector.inject(foo);
+ assertEquals("foo", foo.hidden);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ protectedField = Foo.class.getDeclaredField("hidden");
+ }
+
+ private class Foo {
+ private String hidden;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/JNDIObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/JNDIObjectFactoryTestCase.java
new file mode 100644
index 0000000000..91214fd02d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/JNDIObjectFactoryTestCase.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.injection;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JNDIObjectFactoryTestCase extends TestCase {
+
+ public void testGetInstance() throws Exception {
+ Context ctx = EasyMock.createMock(Context.class);
+ EasyMock.expect(ctx.lookup(EasyMock.eq("foo"))).andReturn(new Foo());
+ EasyMock.replay(ctx);
+ JNDIObjectFactory<Foo> factory = new JNDIObjectFactory<Foo>(ctx, "foo");
+ assertTrue(factory.getInstance() instanceof Foo); // must do an instanceof b/c of type erasure
+ EasyMock.verify(ctx);
+ }
+
+ public void testGetInstanceError() throws Exception {
+ Context ctx = EasyMock.createMock(Context.class);
+ EasyMock.expect(ctx.lookup(EasyMock.eq("foo"))).andThrow(new NamingException());
+ EasyMock.replay(ctx);
+ JNDIObjectFactory<Foo> factory = new JNDIObjectFactory<Foo>(ctx, "foo");
+ try {
+ factory.getInstance();
+ fail();
+ } catch (ObjectCreationException e) {
+ //expected
+ }
+ EasyMock.verify(ctx);
+ }
+
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodEventInvokerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodEventInvokerTestCase.java
new file mode 100644
index 0000000000..3bb882da2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodEventInvokerTestCase.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.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MethodEventInvokerTestCase extends TestCase {
+ private Method privateMethod;
+ private Method exceptionMethod;
+
+ public void testIllegalAccess() throws Exception {
+ MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(privateMethod);
+ try {
+ injector.invokeEvent(new Foo());
+ fail();
+ } catch (AssertionError e) {
+ // expected
+ }
+ }
+
+ public void testException() throws Exception {
+ MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(exceptionMethod);
+ try {
+ injector.invokeEvent(new Foo());
+ fail();
+ } catch (RuntimeException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ privateMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("hidden");
+ exceptionMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("exception");
+
+ }
+
+ private class Foo {
+
+ public void foo() {
+ }
+
+ private void hidden() {
+ }
+
+ public void exception() {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodInjectorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodInjectorTestCase.java
new file mode 100644
index 0000000000..b21ba4ccfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/MethodInjectorTestCase.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.core.injection;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MethodInjectorTestCase extends TestCase {
+ private Method fooMethod;
+ private Method privateMethod;
+ private Method exceptionMethod;
+
+ public void testIllegalArgument() throws Exception {
+ ObjectFactory<Object> factory = new SingletonObjectFactory<Object>(new Object());
+ MethodInjector<Foo> injector = new MethodInjector<Foo>(fooMethod, factory);
+ try {
+ injector.inject(new Foo());
+ fail();
+ } catch (ObjectCreationException e) {
+ // expected
+ }
+ }
+
+ public void testException() throws Exception {
+ ObjectFactory<Object> factory = new SingletonObjectFactory<Object>("foo");
+ MethodInjector<Foo> injector = new MethodInjector<Foo>(exceptionMethod, factory);
+ try {
+ injector.inject(new Foo());
+ fail();
+ } catch (RuntimeException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ fooMethod = Foo.class.getMethod("foo", String.class);
+ privateMethod = Foo.class.getDeclaredMethod("hidden", String.class);
+ exceptionMethod = Foo.class.getDeclaredMethod("exception", String.class);
+
+ }
+
+ private class Foo {
+
+ public void foo(String bar) {
+ }
+
+ private void hidden(String bar) {
+ }
+
+ public void exception(String bar) {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/PojoObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/PojoObjectFactoryTestCase.java
new file mode 100644
index 0000000000..7aba6dbab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/PojoObjectFactoryTestCase.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.core.injection;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PojoObjectFactoryTestCase extends TestCase {
+
+ private Constructor<Foo> ctor;
+
+ public void testConstructorInjection() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(new SingletonObjectFactory<String>("foo"));
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ public void testConstructorInitializerInjection() throws Exception {
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(ctor);
+ factory.setInitializerFactory(0, new SingletonObjectFactory<String>("foo"));
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ctor = Foo.class.getConstructor(String.class);
+ }
+
+ private static class Foo {
+
+ private String foo;
+
+ public Foo(String foo) {
+ this.foo = foo;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/RequestContextObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/RequestContextObjectFactoryTestCase.java
new file mode 100644
index 0000000000..a1a41bbada
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/RequestContextObjectFactoryTestCase.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.injection;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactoryTestCase extends TestCase {
+
+ public void testInstanceCreate() {
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ RequestContextObjectFactory factory = new RequestContextObjectFactory(workContext);
+ assertNotNull(factory.getInstance());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ResourceObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ResourceObjectFactoryTestCase.java
new file mode 100644
index 0000000000..073bda1458
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/ResourceObjectFactoryTestCase.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.core.injection;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceObjectFactoryTestCase extends TestCase {
+
+ public void testResolveFromHostByType() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn("foo");
+ EasyMock.replay(host);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(host);
+ EasyMock.verify(parent);
+ }
+
+ public void testResolveFromHostByName() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class),
+ EasyMock.eq("sca://localhost/bar"))).andReturn("foo");
+ EasyMock.replay(host);
+ ResourceObjectFactory<String> factory =
+ new ResourceObjectFactory<String>(String.class, "sca://localhost/bar", false, null, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+ public void testResolveFromParentByType() throws Exception {
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn("foo");
+ EasyMock.replay(wire);
+
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(wire);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, null);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(parent);
+ }
+
+ public void testResolveFromParentByName() throws Exception {
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getTargetInstance()).andReturn("foo");
+ EasyMock.replay(component);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.getSystemChild(EasyMock.eq("bar"))).andReturn(component);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory =
+ new ResourceObjectFactory<String>(String.class, "bar", false, parent, null);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(parent);
+ EasyMock.verify(component);
+ }
+
+ /**
+ * Verifies if a resource is not found as a child of the parent, the host namespace will be searched
+ */
+ public void testResolveFromParentThenResolveFromHost() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn("foo");
+ EasyMock.replay(host);
+
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(parent);
+ EasyMock.verify(host);
+ }
+
+ public void testResolveFromParentThenResolveFromHostNotFound() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(host);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, parent, host);
+ assertNull(factory.getInstance());
+ EasyMock.verify(parent);
+ EasyMock.verify(host);
+ }
+
+ public void testResolveByTypeNotFound() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(host);
+
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn(null);
+ EasyMock.replay(wire);
+
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, parent, host);
+ try {
+ factory.getInstance();
+ fail();
+ } catch (ResourceNotFoundException e) {
+ //expected
+ }
+ EasyMock.verify(parent);
+ EasyMock.verify(host);
+ }
+
+ public void testResolveByTypeNotFoundOptional() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(host);
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.resolveSystemAutowire(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(parent);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, parent, host);
+ assertNull(factory.getInstance());
+ EasyMock.verify(parent);
+ EasyMock.verify(host);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.java
new file mode 100644
index 0000000000..876e68d5b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/SingletonObjectFactoryTestCase.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.injection;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactoryTestCase extends TestCase {
+
+ public void testSingleton() throws Exception {
+ Object o = new Object();
+ SingletonObjectFactory<Object> factory = new SingletonObjectFactory<Object>(o);
+ assertEquals(o, factory.getInstance());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.java
new file mode 100644
index 0000000000..f9135e2eb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/AbstractConversationTestCase.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.integration.conversation;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+import org.apache.tuscany.spi.wire.WirePostProcessorRegistry;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.builder.ConnectorImpl;
+import org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.scope.ConversationalScopeContainer;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.services.store.memory.MemoryStore;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Provides helper methods for setting up a partial runtime for conversational test cases.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractConversationTestCase extends TestCase {
+ protected ScopeContainer container;
+ protected MemoryStore store;
+ protected WorkContext workContext;
+ protected ConnectorImpl connector;
+ protected JavaAtomicComponent target;
+
+
+ protected void createRuntime() {
+ workContext = new WorkContextImpl();
+ WirePostProcessorRegistry processorRegistry = new WirePostProcessorRegistryImpl();
+ connector = new ConnectorImpl(null, processorRegistry, null, workContext);
+ store = new MemoryStore(EasyMock.createNiceMock(StoreMonitor.class));
+ container = new ConversationalScopeContainer(store, workContext, null);
+
+ }
+
+ protected void initializeRuntime() {
+ store.init();
+ container.start();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
new file mode 100644
index 0000000000..4aec333cad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum idle time is exceeded
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationIdleExpireTestCase extends AbstractConversationTestCase {
+ private JDKOutboundInvocationHandler handler;
+ private OutboundWire owire;
+ private Foo targetInstance;
+ private Method operation1;
+ private Method operation2;
+ private final Object mutex = new Object();
+
+ public void testConversationExpire() throws Throwable {
+ workContext.setIdentifier(org.apache.tuscany.spi.model.Scope.CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
+ synchronized (mutex) {
+ mutex.wait(100);
+ }
+ // verify the instance was expired
+ assertNull(store.readRecord(target, "12345A"));
+ // continue the conversation - should throw an error
+ try {
+ handler.invoke(operation2, null);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ store.setReaperInterval(10);
+ initializeRuntime();
+
+ targetInstance = EasyMock.createMock(Foo.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ target = createMaxIdleTimeAtomicComponent();
+ // create source component mock
+ JavaAtomicComponent source = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(source.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.replay(source);
+
+ owire = MockFactory.createOutboundWire("foo", Foo.class);
+ owire.setContainer(source);
+ owire.setTargetName(new QualifiedName("foo/bar"));
+ InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
+ iwire.setContainer(target);
+ connector.connect(owire, iwire, false);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private JavaAtomicComponent createMaxIdleTimeAtomicComponent() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName("target");
+ configuration.setMaxIdleTime(50);
+ configuration.setInstanceFactory(new MockPojoFactory(Object.class.getConstructor()));
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<Object> {
+ public MockPojoFactory(Constructor<Object> ctr) {
+ super(ctr);
+ }
+
+ public Foo getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Scope("CONVERSATION")
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
new file mode 100644
index 0000000000..1c9bc4a290
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.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.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum age is exceeded
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationMaxAgeExpireTestCase extends AbstractConversationTestCase {
+ private JDKOutboundInvocationHandler handler;
+ private OutboundWire owire;
+ private Foo targetInstance;
+ private Method operation1;
+ private Method operation2;
+ private final Object mutex = new Object();
+
+ public void testConversationExpire() throws Throwable {
+ workContext.setIdentifier(org.apache.tuscany.spi.model.Scope.CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
+ synchronized (mutex) {
+ mutex.wait(100);
+ }
+ // verify the instance was expired
+ assertNull(store.readRecord(target, "12345A"));
+ // continue the conversation - should throw an error
+ try {
+ handler.invoke(operation2, null);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ store.setReaperInterval(10);
+ initializeRuntime();
+
+ targetInstance = EasyMock.createMock(ConversationMaxAgeExpireTestCase.Foo.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ target = createMaxIdleTimeAtomicComponent();
+ // create source component mock
+ JavaAtomicComponent source = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(source.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.replay(source);
+
+ owire = MockFactory.createOutboundWire("foo", Foo.class);
+ owire.setContainer(source);
+ owire.setTargetName(new QualifiedName("foo/bar"));
+ InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
+ iwire.setContainer(target);
+ connector.connect(owire, iwire, false);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private JavaAtomicComponent createMaxIdleTimeAtomicComponent() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName("target");
+ configuration.setMaxAge(50);
+ Constructor<Object> ctor = Object.class.getConstructor();
+ configuration.setInstanceFactory(new ConversationMaxAgeExpireTestCase.MockPojoFactory(ctor));
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<Object> {
+ public MockPojoFactory(Constructor<Object> ctr) {
+ super(ctr);
+ }
+
+ public ConversationMaxAgeExpireTestCase.Foo getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Scope("CONVERSATION")
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
new file mode 100644
index 0000000000..e7a0bc3cfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.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.core.integration.conversation;
+
+import static org.apache.tuscany.spi.model.Scope.CONVERSATION;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.easymock.classextension.EasyMock;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Verifies start, continue and end conversation invocations are processed properly. Checks that a target instance is
+ * properly instantiated and persisted in the store. Additionally verifies that invocations are dispatched to a target
+ * instance, and that start, continue, and end operations are performed correctly. Finally, verfies that the target
+ * instance is removed from the store when the conversation ends.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationStartStopEndTestCase extends AbstractConversationTestCase {
+ private OutboundWire owire;
+ private Foo targetInstance;
+ private JDKOutboundInvocationHandler handler;
+ private Method operation1;
+ private Method operation2;
+ private Method endOperation;
+
+ public void testConversationStartContinueEnd() throws Throwable {
+ workContext.setIdentifier(CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
+ // continue the conversation
+ handler.invoke(operation2, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, store.readRecord(target, "12345A"));
+ // end the conversation
+ handler.invoke(endOperation, null);
+ workContext.clearIdentifier(CONVERSATION);
+ EasyMock.verify(targetInstance);
+ // verify the store has removed the instance
+ assertNull(store.readRecord(target, "12345A"));
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ initializeRuntime();
+ targetInstance = EasyMock.createMock(Foo.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ // create target component mock
+ target = createAtomicComponent();
+ // create source component mock
+ JavaAtomicComponent source = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
+ EasyMock.expect(source.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.replay(source);
+
+ owire = MockFactory.createOutboundWire("foo", Foo.class);
+ owire.setContainer(source);
+ owire.setTargetName(new QualifiedName("foo/bar"));
+ InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
+ iwire.setContainer(target);
+ connector.connect(owire, iwire, false);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ endOperation = Foo.class.getMethod("end");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private JavaAtomicComponent createAtomicComponent() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName("target");
+ configuration.setInstanceFactory(new MockPojoFactory(Object.class.getConstructor()));
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<Object> {
+ public MockPojoFactory(Constructor<Object> ctr) {
+ super(ctr);
+ }
+
+ public Foo getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Scope("CONVERSATION")
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.java
new file mode 100644
index 0000000000..f551aa3e98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/IntrospectionRegistryIntegrationTestCase.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.integration.implementation;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.apache.tuscany.api.annotation.Resource;
+
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import static org.apache.tuscany.spi.model.Scope.COMPOSITE;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
+import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
+import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
+import org.apache.tuscany.core.implementation.processor.InitProcessor;
+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.monitor.NullMonitorFactory;
+
+/**
+ * Sanity check of the <code>IntegrationRegistry</code> to verify operation with processors
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntrospectionRegistryIntegrationTestCase extends TestCase {
+
+ private IntrospectionRegistryImpl registry;
+
+ public void testSimpleComponentTypeParsing() throws Exception {
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ registry.introspect(null, Foo.class, type, null);
+ assertEquals(Foo.class.getMethod("init"), type.getInitMethod());
+ assertEquals(Foo.class.getMethod("destroy"), type.getDestroyMethod());
+ assertEquals(COMPOSITE, type.getImplementationScope());
+ assertEquals(Foo.class.getMethod("setBar", String.class), type.getProperties().get("bar").getMember());
+ assertEquals(Foo.class.getMethod("setTarget", Foo.class), type.getReferences().get("target").getMember());
+ assertEquals(Foo.class.getMethod("setResource", Foo.class), type.getResources().get("resource").getMember());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new IntrospectionRegistryImpl();
+ registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
+ registry.registerProcessor(new DestroyProcessor());
+ registry.registerProcessor(new InitProcessor());
+ registry.registerProcessor(new ScopeProcessor());
+ JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
+ ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
+ registry.registerProcessor(new PropertyProcessor(service));
+ registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+ registry.registerProcessor(new ResourceProcessor());
+ }
+
+ @Scope("COMPOSITE")
+ private static class Foo {
+ protected Foo target;
+ protected String bar;
+ protected Foo resource;
+ private boolean initialized;
+ private boolean destroyed;
+
+
+ @Init
+ public void init() {
+ if (initialized) {
+ fail();
+ }
+ initialized = true;
+ }
+
+ @Destroy
+ public void destroy() {
+ if (destroyed) {
+ fail();
+ }
+ destroyed = true;
+ }
+
+ public Foo getTarget() {
+ return target;
+ }
+
+ @Reference
+ public void setTarget(Foo target) {
+ this.target = target;
+ }
+
+ public String getBar() {
+ return bar;
+ }
+
+ @Property
+ public void setBar(String bar) {
+ this.bar = bar;
+ }
+
+ @Resource
+ public void setResource(Foo resource) {
+ this.resource = resource;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.java
new file mode 100644
index 0000000000..4a4939b495
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderPropertyTestCase.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.core.integration.implementation.system.builder;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.core.implementation.system.builder.SystemComponentBuilder;
+import org.apache.tuscany.core.implementation.system.model.SystemImplementation;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies that the system builder handles configured properties correctly
+ *
+ * @version $Rev$ $Date$
+ */
+public class SystemBuilderPropertyTestCase extends TestCase {
+
+ DeploymentContext deploymentContext;
+ CompositeComponent parent;
+
+ @SuppressWarnings("unchecked")
+ public void testPropertyHandling() throws Exception {
+ SystemComponentBuilder builder = new SystemComponentBuilder();
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, JavaMappedProperty<?>>();
+ type.setConstructorDefinition(new ConstructorDefinition<Foo>(Foo.class.getConstructor((Class[]) null)));
+ JavaMappedProperty<String> property = new JavaMappedProperty<String>();
+ property.setName("test");
+ property.setDefaultValueFactory(new SingletonObjectFactory<String>("foo"));
+ property.setMember(Foo.class.getMethod("setTest", String.class));
+ type.add(property);
+ SystemImplementation impl = new SystemImplementation();
+ impl.setComponentType(type);
+ impl.setImplementationClass(Foo.class);
+ ComponentDefinition<SystemImplementation> definition = new ComponentDefinition<SystemImplementation>(impl);
+ AtomicComponent component = builder.build(parent, definition, deploymentContext);
+ Foo foo = (Foo) component.createInstance();
+ assertEquals("foo", foo.getTest());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ parent = EasyMock.createNiceMock(CompositeComponent.class);
+ }
+
+ private static class Foo {
+ private String test;
+
+ public Foo() {
+ }
+
+ public String getTest() {
+ return test;
+ }
+
+ public void setTest(String test) {
+ this.test = test;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java
new file mode 100644
index 0000000000..0c331ae7d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/mock/MockFactory.java
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.integration.mock;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+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.WireService;
+
+import org.apache.tuscany.core.builder.ConnectorImpl;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.core.wire.jdk.JDKWireService;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public final class MockFactory {
+
+ private static final WireService WIRE_SERVICE = new JDKWireService(new WorkContextImpl(), null);
+ private static final JavaInterfaceProcessorRegistry REGISTRY = new JavaInterfaceProcessorRegistryImpl();
+ private static final ConnectorImpl CONNECTOR = new ConnectorImpl();
+
+ private MockFactory() {
+ }
+
+ /**
+ * Wires two components together where the reference interface is the same as target service
+ *
+ * @param sourceName
+ * @param sourceClass
+ * @param sourceScope
+ * @param members
+ * @param targetName
+ * @param targetService
+ * @param targetClass
+ * @param targetScope
+ * @return
+ * @throws Exception
+ */
+ public static Map<String, AtomicComponent> createWiredComponents(String sourceName,
+ Class<?> sourceClass,
+ ScopeContainer sourceScope,
+ Map<String, Member> members,
+ String targetName,
+ Class<?> targetService,
+ Class<?> targetClass,
+ ScopeContainer targetScope) throws Exception {
+ return createWiredComponents(sourceName,
+ sourceClass,
+ targetService,
+ sourceScope,
+ null,
+ members,
+ targetName,
+ targetService,
+ targetClass,
+ targetScope,
+ null);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, AtomicComponent> createWiredComponents(String sourceName, Class<?> sourceClass,
+ Class<?> sourceReferenceClass,
+ ScopeContainer sourceScope,
+ Interceptor sourceHeadInterceptor,
+ Map<String, Member> members,
+ String targetName, Class<?> targetService,
+ Class<?> targetClass,
+ ScopeContainer targetScope,
+ Interceptor targetHeadInterceptor)
+ throws Exception {
+
+ JavaAtomicComponent targetComponent =
+ createJavaComponent(targetName, targetScope, targetClass);
+ String serviceName = targetService.getName().substring(targetService.getName().lastIndexOf('.') + 1);
+ InboundWire inboundWire = createInboundWire(serviceName, targetService, targetHeadInterceptor);
+ targetComponent.addInboundWire(inboundWire);
+ inboundWire.setContainer(targetComponent);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
+ configuration.setWireService(WIRE_SERVICE);
+ for (Map.Entry<String, Member> entry : members.entrySet()) {
+ configuration.addReferenceSite(entry.getKey(), entry.getValue());
+ }
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(sourceName);
+ JavaAtomicComponent sourceComponent = new JavaAtomicComponent(configuration);
+ sourceComponent.setScopeContainer(sourceScope);
+ OutboundWire outboundWire = createOutboundWire(targetName, sourceReferenceClass, sourceHeadInterceptor);
+ sourceComponent.addOutboundWire(outboundWire);
+ outboundWire.setContainer(sourceComponent);
+ outboundWire.setTargetName(new QualifiedName(targetName + "/" + serviceName));
+ targetScope.register(targetComponent);
+ sourceScope.register(sourceComponent);
+ CONNECTOR.connect(outboundWire, inboundWire, false);
+ Map<String, AtomicComponent> contexts = new HashMap<String, AtomicComponent>();
+ contexts.put(sourceName, sourceComponent);
+ contexts.put(targetName, targetComponent);
+ return contexts;
+ }
+
+
+ /**
+ * Wires two contexts using a multiplicity reference
+ *
+ * @param sourceName
+ * @param sourceClass
+ * @param sourceReferenceClass
+ * @param sourceScope
+ * @param targetName
+ * @param targetService
+ * @param targetClass
+ * @param members
+ * @param targetScope
+ * @return
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public static Map<String, AtomicComponent> createWiredMultiplicity(String sourceName, Class<?> sourceClass,
+ Class<?> sourceReferenceClass,
+ ScopeContainer sourceScope,
+ String targetName, Class<?> targetService,
+ Class<?> targetClass,
+ Map<String, Member> members,
+ ScopeContainer targetScope) throws Exception {
+ JavaAtomicComponent targetComponent =
+ createJavaComponent(targetName, targetScope, targetClass);
+ String serviceName = targetService.getName().substring(targetService.getName().lastIndexOf('.') + 1);
+ InboundWire inboundWire = createInboundWire(serviceName, targetService, null);
+ targetComponent.addInboundWire(inboundWire);
+ inboundWire.setContainer(targetComponent);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
+ configuration.setWireService(WIRE_SERVICE);
+ for (Map.Entry<String, Member> entry : members.entrySet()) {
+ configuration.addReferenceSite(entry.getKey(), entry.getValue());
+ }
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(sourceName);
+
+ JavaAtomicComponent sourceComponent = new JavaAtomicComponent(configuration);
+ sourceComponent.setScopeContainer(sourceScope);
+ OutboundWire outboundWire = createOutboundWire(targetName, sourceReferenceClass, null);
+ outboundWire.setContainer(sourceComponent);
+ outboundWire.setTargetName(new QualifiedName(targetName + "/" + serviceName));
+ List<OutboundWire> factories = new ArrayList<OutboundWire>();
+ factories.add(outboundWire);
+ sourceComponent.addOutboundWires(factories);
+ targetScope.register(targetComponent);
+ sourceScope.register(sourceComponent);
+ CONNECTOR.connect(outboundWire, inboundWire, false);
+ Map<String, AtomicComponent> components = new HashMap<String, AtomicComponent>();
+ components.put(sourceName, sourceComponent);
+ components.put(targetName, targetComponent);
+ return components;
+ }
+
+ public static <T> InboundWire createInboundWire(String serviceName, Class<T> interfaze)
+ throws InvalidServiceContractException {
+ return createInboundWire(serviceName, interfaze, null);
+ }
+
+ public static <T> InboundWire createInboundWire(String serviceName, Class<T> interfaze, Interceptor interceptor)
+ throws InvalidServiceContractException {
+ InboundWire wire = new InboundWireImpl();
+ ServiceContract<?> contract = REGISTRY.introspect(interfaze);
+ wire.setServiceContract(contract);
+ wire.setServiceName(serviceName);
+ wire.addInvocationChains(createInboundChains(interfaze, interceptor));
+ return wire;
+ }
+
+ public static <T> OutboundWire createOutboundWire(String refName, Class<T> interfaze)
+ throws InvalidServiceContractException {
+ return createOutboundWire(refName, interfaze, null);
+ }
+
+ public static <T> OutboundWire createOutboundWire(String refName, Class<T> interfaze, Interceptor interceptor)
+ throws InvalidServiceContractException {
+
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setReferenceName(refName);
+ Map<Operation<?>, OutboundInvocationChain> outboundChains = createOutboundChains(interfaze, interceptor);
+ wire.addInvocationChains(outboundChains);
+ ServiceContract<?> contract = REGISTRY.introspect(interfaze);
+ wire.setServiceContract(contract);
+ return wire;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private static <T> JavaAtomicComponent createJavaComponent(String name, ScopeContainer scope, Class<T> clazz)
+ throws NoSuchMethodException {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(clazz.getConstructor()));
+ configuration.setWireService(WIRE_SERVICE);
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(name);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(scope);
+ return component;
+ }
+
+ private static Map<Operation<?>, OutboundInvocationChain> createOutboundChains(Class<?> interfaze,
+ Interceptor interceptor)
+ throws InvalidServiceContractException {
+ Map<Operation<?>, OutboundInvocationChain> invocations = new HashMap<Operation<?>, OutboundInvocationChain>();
+ ServiceContract<?> contract = REGISTRY.introspect(interfaze);
+ for (Operation<?> operation : contract.getOperations().values()) {
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(interceptor);
+ }
+ invocations.put(operation, chain);
+ }
+ return invocations;
+ }
+
+ private static Map<Operation<?>, InboundInvocationChain> createInboundChains(Class<?> interfaze,
+ Interceptor interceptor)
+ throws InvalidServiceContractException {
+
+ Map<Operation<?>, InboundInvocationChain> invocations = new HashMap<Operation<?>, InboundInvocationChain>();
+ ServiceContract<?> contract = REGISTRY.introspect(interfaze);
+ for (Operation<?> method : contract.getOperations().values()) {
+ InboundInvocationChain chain = new InboundInvocationChainImpl(method);
+ if (interceptor != null) {
+ chain.addInterceptor(interceptor);
+ }
+ // add tail interceptor
+ chain.addInterceptor(new InvokerInterceptor());
+ invocations.put(method, chain);
+ }
+ return invocations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/scope/ScopeReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/scope/ScopeReferenceTestCase.java
new file mode 100644
index 0000000000..4cd5ac8d9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/scope/ScopeReferenceTestCase.java
@@ -0,0 +1,781 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.integration.scope;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.component.event.CompositeStart;
+import org.apache.tuscany.core.component.event.CompositeStop;
+import org.apache.tuscany.core.component.event.HttpSessionEnd;
+import org.apache.tuscany.core.component.event.HttpSessionStart;
+import org.apache.tuscany.core.component.event.RequestEnd;
+import org.apache.tuscany.core.component.event.RequestStart;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.component.scope.HttpSessionScopeContainer;
+import org.apache.tuscany.core.component.scope.RequestScopeContainer;
+import org.apache.tuscany.core.component.scope.StatelessScopeContainer;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+
+/**
+ * Tests scoping is properly handled for service references
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeReferenceTestCase extends TestCase {
+
+ private Map<String, Member> members;
+
+ /**
+ * Tests a composite-to-composite scoped wire
+ */
+ public void testCompositeToComposite() throws Exception {
+ ScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ scope, members, "target", Target.class, TargetImpl.class, scope);
+ scope.onEvent(new CompositeStart(this, null));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+ scope.onEvent(new CompositeStop(this, null));
+ scope.stop();
+ }
+
+ /**
+ * Tests a composite-to-session scoped wire is setup properly by the runtime
+ */
+ public void testCompositeToSession() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ compositeScope.start();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ compositeScope, members, "target", Target.class, TargetImpl.class, sessionScope);
+ compositeScope.onEvent(new CompositeStart(this, null));
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+
+ //second session
+ Object session2 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session2);
+ sessionScope.onEvent(new HttpSessionStart(this, session2));
+
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+
+ assertFalse("foo".equals(source.getTarget().getString()));
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+ sessionScope.onEvent(new HttpSessionEnd(this, session2));
+
+ ctx.clearIdentifier(Scope.SESSION);
+ compositeScope.onEvent(new CompositeStop(this, null));
+ sessionScope.stop();
+ compositeScope.stop();
+ }
+
+ /**
+ * Tests a composite-to-request scoped wire
+ */
+ public void testCompositeToRequest() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ compositeScope.start();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ requestScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ compositeScope, members, "target", Target.class, TargetImpl.class, requestScope);
+ compositeScope.onEvent(new CompositeStart(this, null));
+ requestScope.onEvent(new RequestStart(this));
+
+ AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ final Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Target target2 = null;
+ try {
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertFalse("foo".equals(target2.getString()));
+ assertFalse("foo".equals(source.getTarget().getString()));
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ assertEquals("foo", source.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ compositeScope.onEvent(new CompositeStop(this, null));
+ requestScope.stop();
+ compositeScope.stop();
+ }
+
+ /**
+ * Tests a composite-to-stateless scoped wire is setup properly by the runtime
+ */
+ public void testCompositeToStateless() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ compositeScope.start();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ compositeScope, members, "target", Target.class, TargetImpl.class, statelessScope);
+ compositeScope.onEvent(new CompositeStart(this, null));
+
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertFalse("foo".equals(source.getTarget().getString()));
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+ source.getTarget().setString("bar");
+ assertFalse("bar".equals(source.getTarget().getString()));
+ compositeScope.onEvent(new CompositeStop(this, null));
+ compositeScope.stop();
+ statelessScope.stop();
+ }
+
+
+ /**
+ * Tests a session-to-session scoped wire
+ */
+ public void testSessionToSession() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ sessionScope, members, "target", Target.class, TargetImpl.class, sessionScope);
+
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ source.getTarget().setString("foo");
+ source.getTarget().setString("foo");
+ assertEquals("foo", target.getString());
+
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+
+ //second session
+ Object session2 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session2);
+ sessionScope.onEvent(new HttpSessionStart(this, session2));
+
+ Source source2 = (Source) sourceComponent.getTargetInstance();
+ assertNotNull(source2);
+ Target target2 = (Target) targetComponent.getTargetInstance();
+
+ assertNotNull(target2);
+ assertNull(target2.getString());
+ assertEquals(null, source2.getTarget().getString());
+ source2.getTarget().setString("baz");
+ assertEquals("baz", source2.getTarget().getString());
+ assertEquals("baz", target2.getString());
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session2));
+ sessionScope.stop();
+ }
+
+
+ /**
+ * Tests a session-to-composite scoped wire
+ */
+ public void testSessionToComposite() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ compositeScope.start();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ sessionScope, members, "target", Target.class, TargetImpl.class, compositeScope);
+ compositeScope.onEvent(new CompositeStart(this, null));
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+
+ //second session
+ Object session2 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session2);
+ sessionScope.onEvent(new HttpSessionStart(this, session2));
+
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ Source source2 = (Source) sourceComponent.getTargetInstance();
+ assertEquals("foo", target2.getString());
+ assertEquals("foo", source2.getTarget().getString());
+ source2.getTarget().setString("baz");
+ assertEquals("baz", source2.getTarget().getString());
+ assertEquals("baz", target2.getString());
+ assertEquals("baz", target.getString());
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session2));
+ compositeScope.stop();
+ sessionScope.stop();
+ }
+
+ /**
+ * Tests a session-to-request scoped wire is setup properly by the runtime
+ */
+ public void testSessionToRequest() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ requestScope.start();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ sessionScope, members, "target", Target.class, TargetImpl.class, requestScope);
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ requestScope.onEvent(new RequestStart(this));
+ AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ final Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Target target2 = null;
+ try {
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertFalse("foo".equals(target2.getString()));
+ assertFalse("foo".equals(source.getTarget().getString()));
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ assertEquals("foo", source.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+ requestScope.stop();
+ sessionScope.stop();
+ }
+
+
+ /**
+ * Tests a session-to-stateless scoped wire is setup properly by the runtime
+ */
+ public void testSessionToStateless() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ sessionScope, members, "target", Target.class, TargetImpl.class, statelessScope);
+
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertFalse("foo".equals(source.getTarget().getString()));
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+ source.getTarget().setString("bar");
+ assertFalse("bar".equals(source.getTarget().getString()));
+
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+ sessionScope.stop();
+ statelessScope.stop();
+ }
+
+ /**
+ * Tests a request-to-request scoped wire is setup properly by the runtime
+ */
+ public void testRequestToRequest() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ requestScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ requestScope, members, "target", Target.class, TargetImpl.class, requestScope);
+ requestScope.onEvent(new RequestStart(this));
+
+ final AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Source source2 = null;
+ Target target2 = null;
+ try {
+ source2 = (Source) sourceComponent.getTargetInstance();
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertFalse("foo".equals(target2.getString()));
+ assertFalse("foo".equals(source2.getTarget().getString()));
+ source2.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source2.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ requestScope.onEvent(new RequestEnd(this));
+ requestScope.stop();
+ }
+
+ /**
+ * Tests a request-to-composite scoped wire
+ */
+ public void testRequestToComposite() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ final ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ requestScope.start();
+ compositeScope.start();
+ compositeScope.onEvent(new CompositeStart(this, null));
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ requestScope, members, "target", Target.class, TargetImpl.class, compositeScope);
+ requestScope.onEvent(new RequestStart(this));
+
+ final AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Source source2 = null;
+ Target target2 = null;
+ try {
+ source2 = (Source) sourceComponent.getTargetInstance();
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertEquals("foo", target2.getString());
+ assertEquals("foo", source2.getTarget().getString());
+ source2.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source2.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ assertEquals("bar", target.getString());
+
+ requestScope.onEvent(new RequestEnd(this));
+ requestScope.stop();
+ compositeScope.onEvent(new CompositeStop(this, null));
+ compositeScope.stop();
+ }
+
+ /**
+ * Tests a request-to-session scoped wire is setup properly by the runtime
+ */
+ public void testRequestToSession() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ final ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ requestScope.start();
+ sessionScope.start();
+
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ requestScope, members, "target", Target.class, TargetImpl.class, sessionScope);
+
+ final AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ requestScope.onEvent(new RequestStart(this));
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Source source2 = null;
+ Target target2 = null;
+ try {
+ source2 = (Source) sourceComponent.getTargetInstance();
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertEquals("foo", target2.getString());
+ assertEquals("foo", source2.getTarget().getString());
+ source2.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source2.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ assertEquals("bar", target.getString());
+
+ requestScope.onEvent(new RequestEnd(this));
+ requestScope.stop();
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+ sessionScope.stop();
+ }
+
+
+ /**
+ * Tests a request-to-stateless scoped wire is setup properly by the runtime
+ */
+ public void testRequestToStateless() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ requestScope.start();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ requestScope, members, "target", Target.class, TargetImpl.class, statelessScope);
+
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ requestScope.onEvent(new RequestStart(this));
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertFalse("foo".equals(source.getTarget().getString()));
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+ source.getTarget().setString("bar");
+ assertFalse("bar".equals(source.getTarget().getString()));
+ requestScope.onEvent(new RequestEnd(this));
+ requestScope.stop();
+ statelessScope.stop();
+ }
+
+
+ /**
+ * Tests a stateless-to-stateless scoped wire is setup properly by the runtime
+ */
+ public void testStatelessToStateless() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ statelessScope, members, "target", Target.class, TargetImpl.class, statelessScope);
+
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertFalse("foo".equals(source.getTarget().getString()));
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+ source.getTarget().setString("bar");
+ assertFalse("bar".equals(source.getTarget().getString()));
+ statelessScope.stop();
+ }
+
+ /**
+ * Tests a stateless-to-request scoped wire is setup properly by the runtime
+ */
+ public void testStatelessToRequest() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ final ScopeContainer requestScope = new RequestScopeContainer(ctx, null);
+ requestScope.start();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ statelessScope, members, "target", Target.class, TargetImpl.class, requestScope);
+ requestScope.onEvent(new RequestStart(this));
+ AtomicComponent sourceComponent = contexts.get("source");
+ final AtomicComponent targetComponent = contexts.get("target");
+ final Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ // spin off another request
+ Executor executor = Executors.newSingleThreadExecutor();
+ FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
+ public void run() {
+ requestScope.onEvent(new RequestStart(this));
+ Target target2 = null;
+ try {
+ target2 = (Target) targetComponent.getTargetInstance();
+ } catch (TargetException e) {
+ fail(e.getMessage());
+ }
+ assertFalse("foo".equals(target2.getString()));
+ assertFalse("foo".equals(source.getTarget().getString()));
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+ requestScope.onEvent(new RequestEnd(this));
+ }
+ }, null);
+ executor.execute(future);
+ future.get();
+ requestScope.stop();
+ statelessScope.stop();
+ }
+
+ /**
+ * Tests a stateless-to-session scoped wire is setup properly by the runtime
+ */
+ public void testStatelessToSession() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+ ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx, null);
+ sessionScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ statelessScope, members, "target", Target.class, TargetImpl.class, sessionScope);
+ Object session1 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session1);
+ sessionScope.onEvent(new HttpSessionStart(this, session1));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.onEvent(new HttpSessionEnd(this, session1));
+
+ //second session
+ Object session2 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session2);
+ sessionScope.onEvent(new HttpSessionStart(this, session2));
+
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertFalse("foo".equals(target2.getString()));
+
+ assertFalse("foo".equals(source.getTarget().getString()));
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+ sessionScope.onEvent(new HttpSessionEnd(this, session2));
+
+ ctx.clearIdentifier(Scope.SESSION);
+ sessionScope.stop();
+ statelessScope.stop();
+ }
+
+
+ /**
+ * Tests a stateless-to-composite scoped wire is setup properly by the runtime
+ */
+ public void testStatelessToComposite() throws Exception {
+ WorkContext ctx = new WorkContextImpl();
+ ScopeContainer statelessScope = new StatelessScopeContainer(ctx, null);
+ statelessScope.start();
+ ScopeContainer compositeScope = new CompositeScopeContainer(null);
+ compositeScope.start();
+
+ Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
+ statelessScope, members, "target", Target.class, TargetImpl.class, compositeScope);
+ compositeScope.onEvent(new CompositeStart(this, null));
+ AtomicComponent sourceComponent = contexts.get("source");
+ AtomicComponent targetComponent = contexts.get("target");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = (Target) targetComponent.getTargetInstance();
+ assertNull(source.getTarget().getString());
+ assertNull(target.getString());
+ target.setString("foo");
+ assertTrue(Proxy.isProxyClass(source.getTarget().getClass()));
+ assertEquals("foo", source.getTarget().getString());
+
+ //second session
+ Object session2 = new Object();
+ ctx.setIdentifier(Scope.SESSION, session2);
+ compositeScope.onEvent(new HttpSessionStart(this, session2));
+
+ Target target2 = (Target) targetComponent.getTargetInstance();
+ assertEquals("foo", target2.getString());
+
+ assertEquals("foo", source.getTarget().getString());
+ source.getTarget().setString("bar");
+ assertEquals("bar", target2.getString());
+ assertEquals("bar", source.getTarget().getString());
+
+ compositeScope.onEvent(new CompositeStop(this, null));
+ compositeScope.stop();
+ statelessScope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ members = new HashMap<String, Member>();
+ Method[] methods = SourceImpl.class.getMethods();
+ for (Method method : methods) {
+ if (method.getName().startsWith("set")) {
+ members.put(JavaIntrospectionHelper.toPropertyName(method.getName()), method);
+ }
+ }
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/DifferentInterfaceWireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/DifferentInterfaceWireTestCase.java
new file mode 100644
index 0000000000..431f47b5bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/DifferentInterfaceWireTestCase.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.integration.wire;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.OtherTarget;
+import org.apache.tuscany.core.mock.component.OtherTargetImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Source;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+
+/**
+ * Tests wires that have different interfaces on the source and target side
+ *
+ * @version $Rev$ $Date$
+ */
+public class DifferentInterfaceWireTestCase extends TestCase {
+
+ public void testDifferentInterfaceInjection() throws Exception {
+ Map<String, Member> members = new HashMap<String, Member>();
+ Method m = SourceImpl.class.getMethod("setTarget", Target.class);
+ members.put("target", m);
+ ScopeContainer scope = createMock();
+ scope.start();
+ Map<String, AtomicComponent> contexts =
+ MockFactory.createWiredComponents("source",
+ SourceImpl.class,
+ Target.class,
+ scope,
+ null,
+ members,
+ "target",
+ OtherTarget.class,
+ OtherTargetImpl.class,
+ scope,
+ null);
+ AtomicComponent sourceComponent = contexts.get("source");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = source.getTarget();
+ assertTrue(Proxy.isProxyClass(target.getClass()));
+ assertNotNull(target);
+ scope.stop();
+ EasyMock.verify(scope);
+ }
+
+ public void testDifferentInterfaceMultiplicityInjection() throws Exception {
+ Map<String, Member> members = new HashMap<String, Member>();
+ Method m = SourceImpl.class.getMethod("setTargets", List.class);
+ members.put("target", m);
+ ScopeContainer scope = createMock();
+ scope.start();
+ Map<String, AtomicComponent> components = MockFactory.createWiredMultiplicity("source",
+ SourceImpl.class,
+ Target.class,
+ scope,
+ "target",
+ OtherTarget.class,
+ OtherTargetImpl.class,
+ members,
+ scope);
+ AtomicComponent sourceComponent = components.get("source");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ List<Target> targets = source.getTargets();
+ assertEquals(1, targets.size());
+ Target target = targets.get(0);
+ target.setString("foo");
+ assertEquals("foo", target.getString());
+ assertTrue(Proxy.isProxyClass(target.getClass()));
+ scope.stop();
+ EasyMock.verify(scope);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ private ScopeContainer createMock() throws TargetException {
+ ScopeContainer scope = EasyMock.createMock(ScopeContainer.class);
+ scope.start();
+ scope.stop();
+ scope.register(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().atLeastOnce();
+ EasyMock.expect(scope.getScope()).andReturn(Scope.COMPOSITE).atLeastOnce();
+ scope.getInstance(EasyMock.isA(AtomicComponent.class));
+ EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
+ private Map<AtomicComponent, Object> cache = new HashMap<AtomicComponent, Object>();
+
+ public Object answer() throws Throwable {
+ AtomicComponent component = (AtomicComponent) EasyMock.getCurrentArguments()[0];
+ Object instance = cache.get(component);
+ if (instance == null) {
+ instance = component.createInstance();
+ cache.put(component, instance);
+ }
+ return instance;
+ }
+ }).anyTimes();
+ EasyMock.replay(scope);
+ return scope;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.java
new file mode 100644
index 0000000000..603e334fe9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/ReferenceInjectionTestCase.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.integration.wire;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+import org.apache.tuscany.core.mock.component.Target;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ReferenceInjectionTestCase extends TestCase {
+
+ private Map<String, Member> members;
+
+ public void testProxiedReferenceInjection() throws Exception {
+ ScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ Map<String, AtomicComponent> components =
+ MockFactory.createWiredComponents("source", SourceImpl.class, scope,
+ members, "target", Target.class, TargetImpl.class, scope);
+ AtomicComponent sourceComponent = components.get("source");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = source.getTarget();
+ assertTrue(Proxy.isProxyClass(target.getClass()));
+
+ assertNotNull(target);
+ scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ members = new HashMap<String, Member>();
+ Method m = SourceImpl.class.getMethod("setTarget", Target.class);
+ members.put("target", m);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/oneway/OneWayWireToJavaInvocationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/oneway/OneWayWireToJavaInvocationTestCase.java
new file mode 100644
index 0000000000..78e349b788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/wire/oneway/OneWayWireToJavaInvocationTestCase.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.integration.wire.oneway;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.tuscany.spi.component.WorkContext;
+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.services.work.WorkScheduler;
+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.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.implementation.java.JavaTargetInvoker;
+import org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler;
+import org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.NonBlockingBridgingInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies non-blocking invocations are properly made through a wire to a Java component
+ *
+ * @version $Rev$ $Date$
+ */
+public class OneWayWireToJavaInvocationTestCase extends TestCase {
+ private WorkScheduler scheduler;
+ private WorkContext context;
+ private CountDownLatch latch;
+ private OutboundInvocationChain ochain;
+ private JavaTargetInvoker invoker;
+ private JavaAtomicComponent component;
+ private AsyncTarget target;
+
+ public void testOneWay() throws Exception {
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ ochain.getHeadInterceptor().invoke(msg);
+ latch.await();
+ EasyMock.verify(target);
+ EasyMock.verify(component);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ latch = new CountDownLatch(1);
+ context = new WorkContextImpl();
+ scheduler = new Jsr237WorkScheduler(new ThreadPoolWorkManager(1));
+ target = EasyMock.createMock(AsyncTarget.class);
+ target.invoke();
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(target);
+ component = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(component.getScope()).andReturn(Scope.COMPOSITE);
+ EasyMock.expect(component.getTargetInstance()).andReturn(target);
+ EasyMock.replay(component);
+ Method method = AsyncTarget.class.getMethod("invoke");
+ method.setAccessible(true);
+ InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ invoker = new JavaTargetInvoker(method, component, inboundWire, context, monitor);
+ Operation<Type> operation = new Operation<Type>("invoke", null, null, null, false, null, TargetInvoker.NONE);
+ ochain = new OutboundInvocationChainImpl(operation);
+ NonBlockingBridgingInterceptor bridgeInterceptor = new NonBlockingBridgingInterceptor(scheduler, context);
+ ochain.addInterceptor(bridgeInterceptor);
+ InboundInvocationChain ichain = new InboundInvocationChainImpl(operation);
+ WaitInterceptor waitInterceptor = new WaitInterceptor();
+ InvokerInterceptor invokerInterceptor = new InvokerInterceptor();
+ ichain.addInterceptor(waitInterceptor);
+ ichain.addInterceptor(invokerInterceptor);
+ bridgeInterceptor.setNext(waitInterceptor);
+ ochain.setTargetInvoker(invoker);
+ }
+
+ public interface AsyncTarget {
+ void invoke();
+ }
+
+
+ private class WaitInterceptor implements Interceptor {
+ private Interceptor next;
+
+ public Message invoke(Message msg) {
+ msg = next.invoke(msg);
+ latch.countDown();
+ return msg;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.java
new file mode 100644
index 0000000000..3f6df22677
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderNoBindingTestCase.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.core.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoaderNoBindingTestCase extends TestCase {
+ private static final QName COMPONENT = new QName(SCA_NS, "component");
+ private ComponentLoader loader;
+ private XMLStreamReader reader;
+ private ServiceDefinition service;
+ private ComponentTypeReferenceDefinition reference;
+
+ public void testNoServiceBinding() throws Exception {
+ loader.load(null, null, reader, null);
+ assert service.getBindings().isEmpty();
+ }
+
+ public void testNoReferenceBinding() throws Exception {
+ loader.load(null, null, reader, null);
+ assert reference.getBindings().isEmpty();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ service = new ServiceDefinition();
+ reference = new ComponentTypeReferenceDefinition();
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ type.add(service);
+ type.add(reference);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ EasyMock.expect(registry.load((CompositeComponent) EasyMock.isNull(),
+ (ModelObject) EasyMock.isNull(),
+ EasyMock.isA(XMLStreamReader.class),
+ (DeploymentContext) EasyMock.isNull())).andReturn(impl);
+ registry.loadComponentType((CompositeComponent) EasyMock.isNull(),
+ EasyMock.isA(Implementation.class),
+ (DeploymentContext) EasyMock.isNull());
+ EasyMock.replay(registry);
+ loader = new ComponentLoader(registry, null);
+ reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(COMPONENT).atLeastOnce();
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("foo");
+ EasyMock.expect(reader.getAttributeValue(null, "autowire")).andReturn("false");
+ EasyMock.expect(reader.getAttributeValue(null, "initLevel")).andReturn("0");
+ EasyMock.expect(reader.nextTag()).andReturn(1);
+ EasyMock.replay(reader);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java
new file mode 100644
index 0000000000..5034e5114a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderPropertyTestCase.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingPropertyValueException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoaderPropertyTestCase extends TestCase {
+
+ private TestLoader loader;
+
+ /**
+ * Verifies that an optional property not cofigured in an assembly will avoid having a PropertyValue created for it
+ * so that the runtime does not erroneously inject null values
+ */
+ public void testMissingPropertyValueException() throws LoaderException, XMLStreamException {
+ PojoComponentType<?, ?, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ Property property = new Property();
+ property.setName("name");
+ property.setMustSupply(true);
+ type.add(property);
+
+ JavaImplementation impl = new JavaImplementation(null, type);
+ impl.setComponentType(type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ assertTrue(defn.getPropertyValues().isEmpty());
+ try {
+ loader.populatePropertyValues(defn);
+ fail();
+ } catch (Exception e) {
+ assertTrue(e instanceof MissingPropertyValueException);
+ }
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ LoaderRegistry mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ PropertyObjectFactory mockPropertyFactory = EasyMock.createMock(PropertyObjectFactory.class);
+ loader = new TestLoader(mockRegistry, mockPropertyFactory);
+ }
+
+ private class TestLoader extends ComponentLoader {
+
+ public TestLoader(LoaderRegistry registry, PropertyObjectFactory propertyFactory) {
+ super(registry, propertyFactory);
+ }
+
+ @Override
+ public void populatePropertyValues(ComponentDefinition<Implementation<?>> componentDefinition)
+ throws MissingPropertyValueException, LoaderException {
+ super.populatePropertyValues(componentDefinition);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java
new file mode 100644
index 0000000000..3d73e53883
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderReferenceTestCase.java
@@ -0,0 +1,87 @@
+package org.apache.tuscany.core.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.UndefinedReferenceException;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.isNull;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoaderReferenceTestCase extends TestCase {
+ private static final QName COMPONENT = new QName(SCA_NS, "component");
+ private static final QName REFERENCE = new QName(SCA_NS, "reference");
+ private static final String NAME = "testComponent";
+ private ComponentLoader loader;
+ private XMLStreamReader reader;
+
+ /**
+ * Verifies an error is thrown when an attempt to configure a non-existent reference in SCDL is made
+ */
+ public void testNoReferenceOnComponentType() throws LoaderException, XMLStreamException {
+ try {
+ loader.load(null, null, reader, null);
+ fail();
+ } catch (UndefinedReferenceException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ JavaImplementation impl = new JavaImplementation(null, type);
+ reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(COMPONENT);
+ EasyMock.expect(reader.getAttributeValue((String) EasyMock.isNull(), EasyMock.isA(String.class)))
+ .andReturn(NAME);
+ EasyMock.expect(reader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("initLevel")))
+ .andReturn(null);
+ EasyMock.expect(reader.getAttributeValue((String) isNull(), EasyMock.eq("autowire")))
+ .andReturn("false");
+ EasyMock.expect(reader.getAttributeValue(EasyMock.isA(String.class), EasyMock.isA(String.class)))
+ .andReturn(null);
+ EasyMock.expect(reader.nextTag()).andReturn(0);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(REFERENCE);
+ EasyMock.expect(reader.getAttributeValue((String) isNull(), EasyMock.eq("name")))
+ .andReturn("noreference");
+ EasyMock.expect(reader.getElementText()).andReturn("text");
+
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ LoaderRegistry mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ mockRegistry.loadComponentType((CompositeComponent) isNull(),
+ EasyMock.isA(Implementation.class),
+ (DeploymentContext) isNull());
+ EasyMock.expect(mockRegistry.load((CompositeComponent) isNull(),
+ (ModelObject) isNull(),
+ EasyMock.isA(XMLStreamReader.class),
+ (DeploymentContext) isNull())).andReturn(impl);
+ EasyMock.replay(mockRegistry);
+ loader = new ComponentLoader(mockRegistry, null);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.java
new file mode 100644
index 0000000000..f4421941fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderTestCase.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.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoaderTestCase extends TestCase {
+ private static final QName COMPONENT = new QName(SCA_NS, "component");
+ private static final String NAME = "testComponent";
+ private JavaImplementation impl;
+
+ private XMLStreamReader mockReader;
+ private LoaderRegistry mockRegistry;
+ private PropertyObjectFactory mockPropertyFactory;
+ private ComponentLoader loader;
+
+ public void testEmptyComponent() throws LoaderException, XMLStreamException {
+ EasyMock.expect(mockReader.getName()).andReturn(COMPONENT).atLeastOnce();
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.isA(String.class)))
+ .andReturn(NAME);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("initLevel")))
+ .andReturn(null);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("autowire")))
+ .andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(EasyMock.isA(String.class), EasyMock.isA(String.class)))
+ .andReturn(null);
+ EasyMock.expect(mockReader.nextTag()).andReturn(0);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(mockReader);
+ mockRegistry.loadComponentType(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Implementation.class),
+ EasyMock.isA(DeploymentContext.class));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ @SuppressWarnings("unchecked")
+ public Object answer() throws Throwable {
+ Implementation impl = (Implementation) EasyMock.getCurrentArguments()[1];
+ impl.setComponentType(new PojoComponentType());
+ return impl;
+ }
+ });
+
+ EasyMock.expect(mockRegistry.load(EasyMock.isA(CompositeComponent.class),
+ (ModelObject) isNull(),
+ EasyMock.eq(mockReader),
+ EasyMock.isA(DeploymentContext.class))).andReturn(impl);
+ EasyMock.replay(mockRegistry);
+ ComponentDefinition component = loader.load(EasyMock.createNiceMock(CompositeComponent.class),
+ null, mockReader,
+ EasyMock.createNiceMock(DeploymentContext.class));
+ assertEquals(NAME, component.getName());
+ assertNull(component.getInitLevel());
+ }
+
+ public void testInitValue20() throws LoaderException, XMLStreamException {
+ EasyMock.expect(mockReader.getName()).andReturn(COMPONENT).atLeastOnce();
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.isA(String.class)))
+ .andReturn(NAME);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("initLevel")))
+ .andReturn("20");
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("autowire")))
+ .andReturn("false");
+ EasyMock.expect(mockReader.nextTag()).andReturn(0);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(mockReader);
+
+ mockRegistry.loadComponentType(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Implementation.class),
+ EasyMock.isA(DeploymentContext.class));
+
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ @SuppressWarnings("unchecked")
+ public Object answer() throws Throwable {
+ Implementation impl = (Implementation) EasyMock.getCurrentArguments()[1];
+ impl.setComponentType(new PojoComponentType());
+ return impl;
+ }
+ });
+ EasyMock.expect(mockRegistry.load(EasyMock.isA(CompositeComponent.class),
+ (ModelObject) isNull(),
+ EasyMock.eq(mockReader),
+ EasyMock.isA(DeploymentContext.class))).andReturn(impl);
+ EasyMock.replay(mockRegistry);
+ ComponentDefinition component = loader.load(EasyMock.createNiceMock(CompositeComponent.class),
+ null, mockReader,
+ EasyMock.createNiceMock(DeploymentContext.class));
+ assertEquals(NAME, component.getName());
+ assertEquals(Integer.valueOf(20), component.getInitLevel());
+ }
+
+ public void testLoadPropertyWithSource() throws LoaderException, XMLStreamException {
+ PojoComponentType<?, ?, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ Property property = new Property();
+ property.setName("name");
+ type.add(property);
+ JavaImplementation impl = new JavaImplementation();
+ impl.setComponentType(type);
+ ComponentDefinition<?> defn = new ComponentDefinition<JavaImplementation>(impl);
+ XMLStreamReader reader = createMock(XMLStreamReader.class);
+ expect(reader.getAttributeValue(null, "name")).andReturn("name");
+ expect(reader.getAttributeValue(null, "source")).andReturn("$source");
+ expect(reader.getAttributeValue(null, "type")).andReturn(null).anyTimes();
+ expect(reader.getAttributeValue(null, "element")).andReturn(null).anyTimes();
+ expect(reader.getAttributeValue(null, "file")).andReturn(null);
+ expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ replay(reader);
+ loader.loadProperty(reader, null, defn);
+ assertEquals("$source", defn.getPropertyValues().get("name").getSource());
+ EasyMock.verify(reader);
+ }
+
+ public void testUnrecognizedElement() throws LoaderException, XMLStreamException {
+ EasyMock.expect(mockReader.getName()).andReturn(COMPONENT);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.isA(String.class)))
+ .andReturn(NAME);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("initLevel")))
+ .andReturn(null);
+ EasyMock.expect(mockReader.getAttributeValue((String) EasyMock.isNull(), EasyMock.eq("autowire")))
+ .andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(EasyMock.isA(String.class), EasyMock.isA(String.class)))
+ .andReturn(null);
+ EasyMock.expect(mockReader.nextTag()).andReturn(0);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(mockReader.getName()).andReturn(new QName("foo", "bar"));
+ EasyMock.replay(mockReader);
+ mockRegistry.loadComponentType(EasyMock.isA(CompositeComponent.class),
+ EasyMock.isA(Implementation.class),
+ EasyMock.isA(DeploymentContext.class));
+
+ EasyMock.expect(mockRegistry.load(EasyMock.isA(CompositeComponent.class),
+ (ModelObject) isNull(),
+ EasyMock.eq(mockReader),
+ EasyMock.isA(DeploymentContext.class))).andReturn(impl);
+ EasyMock.replay(mockRegistry);
+ try {
+ loader.load(EasyMock.createNiceMock(CompositeComponent.class),
+ null, mockReader,
+ EasyMock.createNiceMock(DeploymentContext.class));
+ fail();
+ } catch (UnrecognizedElementException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ impl = new JavaImplementation();
+ mockReader = EasyMock.createMock(XMLStreamReader.class);
+ mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ mockPropertyFactory = EasyMock.createMock(PropertyObjectFactory.class);
+ loader = new ComponentLoader(mockRegistry, mockPropertyFactory);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java
new file mode 100644
index 0000000000..9c5ce0655c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentLoaderValidationTestCase.java
@@ -0,0 +1,170 @@
+package org.apache.tuscany.core.loader;
+
+import java.net.URI;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityViolationException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingReferenceException;
+import org.apache.tuscany.spi.loader.PropertyObjectFactory;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentLoaderValidationTestCase extends TestCase {
+
+ private ComponentLoaderValidationTestCase.TestLoader loader;
+
+ public void testValidation() throws LoaderException, XMLStreamException {
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition refDefinition = new ComponentTypeReferenceDefinition();
+ refDefinition.setName("name");
+ type.add(refDefinition);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(refDefinition);
+ compRef.addTarget(URI.create("uri"));
+ defn.add(compRef);
+ /*ReferenceTarget target = new ReferenceTarget();
+ target.setReferenceName("name");
+ defn.add(target);*/
+ loader.validate(defn);
+ }
+
+ /*public void testReferenceNotSet() throws LoaderException, XMLStreamException {
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition refDefinition = new ComponentTypeReferenceDefinition();
+ refDefinition.setName("name");
+ type.add(refDefinition);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ try {
+ loader.validate(defn);
+ fail();
+ } catch (MissingReferenceException e) {
+ // expected
+ }
+ }*/
+
+ public void testNotRequiredReference() throws LoaderException, XMLStreamException {
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition refDefinition = new ComponentTypeReferenceDefinition();
+ refDefinition.setName("name");
+ type.add(refDefinition);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ loader.validate(defn);
+ }
+
+ public void testReferenceMultiplicity() throws LoaderException, XMLStreamException {
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition refDefinition = new ComponentTypeReferenceDefinition();
+ refDefinition.setName("r1");
+ refDefinition.setMultiplicity(Multiplicity.ONE_N);
+ type.add(refDefinition);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(type.getReferences().get("r1"));
+ compRef.addTarget(URI.create("c1"));
+ compRef.addTarget(URI.create("c2"));
+ defn.add(compRef);
+ /*ReferenceTarget target = new ReferenceTarget();
+ target.setReferenceName("r1");
+ target.addTarget(URI.create("c1"));
+ target.addTarget(URI.create("c2"));
+ defn.add(target);*/
+ loader.validate(defn);
+
+ refDefinition.setMultiplicity(Multiplicity.ZERO_ONE);
+ try {
+ loader.validate(defn);
+ fail();
+ } catch (ReferenceMultiplicityViolationException e) {
+ // Expected
+ }
+
+ refDefinition.setMultiplicity(Multiplicity.ZERO_N);
+ loader.validate(defn);
+
+ refDefinition.setMultiplicity(Multiplicity.ONE_ONE);
+ try {
+ loader.validate(defn);
+ fail();
+ } catch (ReferenceMultiplicityViolationException e) {
+ // Expected
+ }
+
+ defn = new ComponentDefinition<Implementation<?>>(impl);
+ compRef = new ComponentReferenceDefinition(type.getReferences().get("r1"));
+ defn.add(compRef);
+ refDefinition.setMultiplicity(Multiplicity.ONE_ONE);
+ try {
+ loader.validate(defn);
+ fail();
+ } catch (ReferenceMultiplicityViolationException e) {
+ // Expected
+ }
+ refDefinition.setMultiplicity(Multiplicity.ONE_N);
+ try {
+ loader.validate(defn);
+ fail();
+ } catch (ReferenceMultiplicityViolationException e) {
+ // Expected
+ }
+ refDefinition.setMultiplicity(Multiplicity.ZERO_N);
+ loader.validate(defn);
+ refDefinition.setMultiplicity(Multiplicity.ZERO_ONE);
+ loader.validate(defn);
+
+ }
+ public void testAutowire() throws LoaderException, XMLStreamException {
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition refDefinition = new ComponentTypeReferenceDefinition();
+ refDefinition.setName("name");
+ refDefinition.setAutowire(true);
+ type.add(refDefinition);
+ JavaImplementation impl = new JavaImplementation(null, type);
+ ComponentDefinition<Implementation<?>> defn = new ComponentDefinition<Implementation<?>>(impl);
+ loader.validate(defn);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ LoaderRegistry mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ PropertyObjectFactory mockPropertyFactory = EasyMock.createMock(PropertyObjectFactory.class);
+ loader = new ComponentLoaderValidationTestCase.TestLoader(mockRegistry, mockPropertyFactory);
+ }
+
+ private class TestLoader extends ComponentLoader {
+
+ public TestLoader(LoaderRegistry registry, PropertyObjectFactory propertyFactory) {
+ super(registry, propertyFactory);
+ }
+
+ @Override
+ protected void validate(ComponentDefinition<Implementation<?>> definition) throws LoaderException {
+ super.validate(definition);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java
new file mode 100644
index 0000000000..ffc6ee7a03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentReferenceOverridingTestCase.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import java.io.StringReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.core.binding.local.LocalBindingDefinition;
+import org.apache.tuscany.core.implementation.java.JavaImplementation;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.ReferenceMultiplicityOverridingException;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+/**
+ * Tests to verify overriding of aspects of componenttype reference defintions
+ * by component definitions
+ */
+public class ComponentReferenceOverridingTestCase {
+ private static XMLInputFactory xmlFactory = XMLInputFactory.newInstance();;
+ private static LoaderRegistryImpl loaderRegistry;
+
+ public XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+
+ @Test
+ public void testRefDefNoOverriding() throws LoaderException,
+ XMLStreamException,
+ URISyntaxException {
+ String compDefXml =
+ "<tus:component name='TestComponent' xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'>"
+ + "<tus:implementation.java class='mockedup'/>"
+ + "</tus:component>";
+
+ TestComponentLoader compLoader = new TestComponentLoader(EasyMock.createMock(LoaderRegistry.class));
+ ComponentDefinition<?> compDef = compLoader.load(null, null, getReader(compDefXml), null);
+
+ //verify if component inherits referece definitions from componentType
+ Assert.assertNotNull(compDef.getReferences().get("CTRefDef1"));
+ Assert.assertEquals(Multiplicity.ZERO_N.name(), compDef.getReferences().get("CTRefDef1").getMultiplicity().name());
+ Assert.assertEquals("TestComponent1/testService1",
+ compDef.getReferences().get("CTRefDef1").getTargets().get(1).toString());
+ Assert.assertTrue(
+ TestIfc1.class.isAssignableFrom(compDef.getReferences().get("CTRefDef1").getServiceContract().getInterfaceClass()));
+ Assert.assertTrue(compDef.getReferences().get("CTRefDef1").getBindings().get(0) instanceof LocalBindingDefinition);
+ }
+
+ @Test
+ public void testRefDefValidOverriding() throws LoaderException,
+ XMLStreamException,
+ URISyntaxException {
+ String overridenRef =
+ "<tus:component name='TestComponent' xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'>"
+ + "<tus:implementation.java class='mockedup'/>"
+ + "<tus:reference name='CTRefDef1' target='OverridingTarget' multiplicity='0..1'>"
+ + "</tus:reference>"
+ + "</tus:component>";
+
+ TestComponentLoader compLoader = new TestComponentLoader(EasyMock.createMock(LoaderRegistry.class));
+
+ ComponentDefinition<?> compDef = compLoader.load(null, null, getReader(overridenRef), null);
+
+ //verify if component inherits referece definitions from componentType
+ Assert.assertNotNull(compDef.getReferences().get("CTRefDef1"));
+ Assert.assertEquals(Multiplicity.ZERO_ONE.name(),
+ compDef.getReferences().get("CTRefDef1").getMultiplicity().name());
+ Assert.assertEquals("OverridingTarget",
+ compDef.getReferences().get("CTRefDef1").getTargets().get(0).toString());
+ Assert.assertTrue(
+ TestIfc1.class.isAssignableFrom(compDef.getReferences().get("CTRefDef1").getServiceContract().getInterfaceClass()));
+ Assert.assertTrue(compDef.getReferences().get("CTRefDef1").getBindings().get(0) instanceof LocalBindingDefinition);
+ }
+
+ @Test
+ public void testRefDefInValidOverriding() throws LoaderException,
+ XMLStreamException,
+ URISyntaxException {
+ String overridenRef =
+ "<tus:component name='TestComponent' xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'>"
+ + "<tus:implementation.java class='mockedup'/>"
+ + "<tus:reference name='CTRefDef1' target='OverridingTarget' multiplicity='1..1'/>"
+ + "</tus:component>";
+
+ TestComponentLoader compLoader = new TestComponentLoader(EasyMock.createMock(LoaderRegistry.class));
+
+ try {
+ ComponentDefinition<?> compDef = compLoader.load(null, null, getReader(overridenRef), null);
+ Assert.fail();
+ } catch ( ReferenceMultiplicityOverridingException e) {
+ //expected behaviour
+ }
+ }
+
+
+ public static interface TestIfc1 {
+ public String testMethod1();
+ }
+
+ public class TestComponentLoader extends ComponentLoader {
+
+ public TestComponentLoader(LoaderRegistry registry) {
+ super(registry, null);
+ }
+
+ @Override
+ protected Implementation<?> loadImplementation(CompositeComponent parent,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException,
+ LoaderException {
+ ComponentTypeReferenceDefinition ctRefDef = new ComponentTypeReferenceDefinition();
+
+ ctRefDef.setName("CTRefDef1");
+ try {
+ ctRefDef.addTarget(new URI("TestComponent1"));
+ ctRefDef.addTarget(new URI("TestComponent1/testService1"));
+
+ ctRefDef.setMultiplicity(Multiplicity.ZERO_N);
+
+ JavaServiceContract svcContract = new JavaServiceContract(TestIfc1.class);
+ ctRefDef.setServiceContract(svcContract);
+
+ BindingDefinition binding1 = new LocalBindingDefinition(new URI("localBindingUri"));
+ ctRefDef.addBinding(binding1);
+ } catch (URISyntaxException e) {
+ //do nothing... unlikely to happen
+ }
+
+ PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> ct =
+ new PojoComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ct.add(ctRefDef);
+
+ JavaImplementation javaImpl = new JavaImplementation();
+ javaImpl.setComponentType(ct);
+ reader.next();
+ reader.next();
+ return javaImpl;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java
new file mode 100644
index 0000000000..08272d98bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ComponentTypeElementLoaderTestCase.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeElementLoaderTestCase extends TestCase {
+
+ public void testSpecializedComponentTypePassedIn() throws Exception {
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeElementLoader loader = new ComponentTypeElementLoader(null);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(ComponentTypeElementLoader.COMPONENT_TYPE);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ // verify that the exact component type instance is returned. Some StAXElementLoader implementations may chose
+ // to copy the original instance but ComponentTypeElementLoader does not since it has no knowledge of the
+ // specialized instance
+ ModelObject object = loader.load(null, type, reader, null);
+ assertEquals(object, type);
+ }
+
+ public void testComponentTypePassedAsContext() throws Exception {
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ EasyMock.expect(registry.load((CompositeComponent) EasyMock.isNull(),
+ EasyMock.isA(ComponentType.class),
+ EasyMock.isA(XMLStreamReader.class),
+ (DeploymentContext) EasyMock.isNull())).andReturn(type);
+ EasyMock.replay(registry);
+ ComponentTypeElementLoader loader = new ComponentTypeElementLoader(registry);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(ComponentTypeElementLoader.COMPONENT_TYPE);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(new QName("foo", "foo"));
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+
+ loader.load(null, type, reader, null);
+ EasyMock.verify(registry);
+ }
+
+ public void testNonSpecializedComponentTypePassedIn() throws Exception {
+ ComponentTypeElementLoader loader = new ComponentTypeElementLoader(null);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(ComponentTypeElementLoader.COMPONENT_TYPE);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ ModelObject object = loader.load(null, null, reader, null);
+ assertEquals(ComponentType.class, object.getClass());
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/DependencyLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/DependencyLoaderTestCase.java
new file mode 100644
index 0000000000..753289f4a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/DependencyLoaderTestCase.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.apache.tuscany.core.implementation.composite.Dependency;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DependencyLoaderTestCase extends TestCase {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final QName DEPENDENCY = new QName(NS, "dependency");
+ private static final QName GROUP = new QName(NS, "group");
+ private static final QName NAME = new QName(NS, "name");
+ private static final QName VERSION = new QName(NS, "version");
+ private static final QName CLASSIFIER = new QName(NS, "classifier");
+ private static final QName TYPE = new QName(NS, "type");
+
+ public void testLoad() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(GROUP);
+ EasyMock.expect(reader.getElementText()).andReturn("group");
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(NAME);
+ EasyMock.expect(reader.getElementText()).andReturn("name");
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(VERSION);
+ EasyMock.expect(reader.getElementText()).andReturn("1");
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(CLASSIFIER);
+ EasyMock.expect(reader.getElementText()).andReturn("classifier");
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(TYPE);
+ EasyMock.expect(reader.getElementText()).andReturn("type");
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+ DependencyLoader loader = new DependencyLoader(registry);
+ Dependency dependency = loader.load(null, null, reader, null);
+ assertEquals("group", dependency.getArtifact().getGroup());
+ assertEquals("name", dependency.getArtifact().getName());
+ assertEquals("1", dependency.getArtifact().getVersion());
+ assertEquals("classifier", dependency.getArtifact().getClassifier());
+ assertEquals("type", dependency.getArtifact().getType());
+ }
+
+ public void testLoaderRegister() {
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ registry.registerLoader(EasyMock.eq(DEPENDENCY), EasyMock.isA(DependencyLoader.class));
+ EasyMock.replay(registry);
+ DependencyLoader loader = new DependencyLoader(registry);
+ loader.start();
+ EasyMock.verify(registry);
+ }
+
+ public void testUnrecognizedElement() throws Exception {
+ LoaderRegistry registry = EasyMock.createNiceMock(LoaderRegistry.class);
+ EasyMock.replay(registry);
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.nextTag()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(reader.getName()).andReturn(new QName("foo", "bar"));
+ EasyMock.expect(reader.getElementText()).andReturn("foo");
+ EasyMock.expect(reader.getLocation()).andReturn(new MockLocation());
+ EasyMock.replay(reader);
+ DependencyLoader loader = new DependencyLoader(registry);
+ try {
+ loader.load(null, null, reader, null);
+ fail();
+ } catch (UnrecognizedElementException e) {
+ // expected
+ }
+ }
+
+ private class MockLocation implements 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;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/IncludeLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/IncludeLoaderTestCase.java
new file mode 100644
index 0000000000..ed2fde80d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/IncludeLoaderTestCase.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.Constants;
+
+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.MissingIncludeException;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.Include;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IncludeLoaderTestCase extends TestCase {
+ private static final QName INCLUDE = new QName(Constants.SCA_NS, "include");
+
+ private LoaderRegistry registry;
+ private IncludeLoader loader;
+ private XMLStreamReader reader;
+ private DeploymentContext context;
+ private URL base;
+ private URL includeURL;
+ private ClassLoader cl;
+
+ public void testNoLocation() throws LoaderException, XMLStreamException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(INCLUDE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn(null);
+ expect(reader.getAttributeValue(null, "scdlResource")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+
+ expect(context.getClassLoader()).andReturn(cl);
+ replay(registry, reader, context);
+
+ try {
+ loader.load(null, null, reader, context);
+ fail();
+ } catch (MissingIncludeException e) {
+ // OK expected
+ }
+ verify(registry, reader, context);
+ }
+
+ public void testWithAbsoluteScdlLocation() throws LoaderException, XMLStreamException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(INCLUDE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn("http://example.com/include.scdl");
+ expect(reader.getAttributeValue(null, "scdlResource")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+
+ expect(context.getScdlLocation()).andReturn(base);
+ expect(context.getClassLoader()).andReturn(cl);
+
+ expect(registry.load((CompositeComponent) isNull(),
+ (ModelObject) isNull(),
+ eq(includeURL),
+ eq(CompositeComponentType.class),
+ isA(DeploymentContext.class)))
+ .andReturn(null);
+ replay(registry, reader, context);
+
+ Include include = loader.load(null, null, reader, context);
+ assertEquals(name, include.getName());
+ assertEquals(includeURL, include.getScdlLocation());
+ verify(registry, reader, context);
+ }
+
+ public void testWithRelativeScdlLocation() throws LoaderException, XMLStreamException {
+ String name = "foo";
+ expect(reader.getName()).andReturn(INCLUDE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn("include.scdl");
+ expect(reader.getAttributeValue(null, "scdlResource")).andReturn(null);
+ expect(reader.next()).andReturn(END_ELEMENT);
+
+ expect(context.getScdlLocation()).andReturn(base);
+ expect(context.getClassLoader()).andReturn(cl);
+
+ expect(registry.load((CompositeComponent) isNull(),
+ (ModelObject) isNull(),
+ eq(includeURL),
+ eq(CompositeComponentType.class),
+ isA(DeploymentContext.class)))
+ .andReturn(null);
+ replay(registry, reader, context);
+
+ Include include = loader.load(null, null, reader, context);
+ assertEquals(name, include.getName());
+ assertEquals(includeURL, include.getScdlLocation());
+ verify(registry, reader, context);
+ }
+
+ public void testWithScdlResource() throws LoaderException, XMLStreamException {
+ String name = "foo";
+ String resource = "org/apache/tuscany/core/loader/test-include.scdl";
+ includeURL = cl.getResource(resource);
+ assertNotNull(includeURL);
+
+ expect(reader.getName()).andReturn(INCLUDE);
+ expect(reader.getAttributeValue(null, "name")).andReturn(name);
+ expect(reader.getAttributeValue(null, "scdlLocation")).andReturn(null);
+ expect(reader.getAttributeValue(null, "scdlResource")).andReturn(resource);
+ expect(reader.next()).andReturn(END_ELEMENT);
+
+ expect(context.getClassLoader()).andReturn(cl);
+
+ expect(registry.load((CompositeComponent) isNull(),
+ (ModelObject) isNull(),
+ eq(includeURL),
+ eq(CompositeComponentType.class),
+ isA(DeploymentContext.class)))
+ .andReturn(null);
+ replay(registry, reader, context);
+
+ Include include = loader.load(null, null, reader, context);
+ assertEquals(name, include.getName());
+ assertEquals(includeURL, include.getScdlLocation());
+ verify(registry, reader, context);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ reader = createMock(XMLStreamReader.class);
+ context = createMock(DeploymentContext.class);
+ cl = getClass().getClassLoader();
+ base = new URL("http://example.com/test.scdl");
+ includeURL = new URL("http://example.com/include.scdl");
+ loader = new IncludeLoader(registry);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java
new file mode 100644
index 0000000000..1c65ed42cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java
@@ -0,0 +1,66 @@
+package org.apache.tuscany.core.loader;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.injection.JNDIObjectFactory;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JNDIPropertyFactoryTestCase extends TestCase {
+
+ public void testCreate() throws Exception {
+ String old = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ try {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName());
+ JNDIPropertyFactory factory = new JNDIPropertyFactory();
+ Element element = EasyMock.createMock(Element.class);
+ EasyMock.expect(element.getTextContent()).andReturn("foo");
+ EasyMock.replay(element);
+ //Document doc = EasyMock.createMock(Document.class);
+ //EasyMock.expect(doc.getDocumentElement()).andReturn(element);
+ //EasyMock.replay(doc);
+ PropertyValue<?> value = new MockPropertyValue<Type>();
+ List<Element> docList = new ArrayList<Element>();
+ docList.add(element);
+ value.setValue(docList);
+ JNDIObjectFactory<?> jndiFactory = (JNDIObjectFactory<?>) factory.createObjectFactory(null, value);
+ assertEquals("bar", jndiFactory.getInstance());
+ } finally {
+ System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);
+ if (old != null) {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, old);
+ }
+ }
+
+ }
+
+ private class MockPropertyValue<T> extends PropertyValue<T> {
+
+ }
+
+ public static class MockInitialContextFactory implements InitialContextFactory {
+ public MockInitialContextFactory() {
+ }
+
+ public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
+ Context context = EasyMock.createMock(Context.class);
+ EasyMock.expect(context.lookup("foo")).andReturn("bar");
+ EasyMock.replay(context);
+ return context;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/LoaderExceptionFormatterTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/LoaderExceptionFormatterTestCase.java
new file mode 100644
index 0000000000..49c53935dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/LoaderExceptionFormatterTestCase.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.loader;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LoaderExceptionFormatterTestCase extends TestCase {
+
+ public void testLog() {
+ FormatterRegistry registry = EasyMock.createNiceMock(FormatterRegistry.class);
+ LoaderExceptionFormatter formatter = new LoaderExceptionFormatter(registry);
+ LoaderException e = new LoaderException("test");
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ pw.close();
+ assertTrue(!"message".equals(writer.toString()));
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/MultivaluePropertyLoadingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/MultivaluePropertyLoadingTestCase.java
new file mode 100644
index 0000000000..a39ca52fd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/MultivaluePropertyLoadingTestCase.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Property;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * @version $Rev: 502055 $ $Date: 2007-02-01 05:37:32 +0530 (Thu, 01 Feb 2007) $
+ */
+public class MultivaluePropertyLoadingTestCase extends TestCase {
+ private PropertyLoader propertyLoader;
+ private XMLInputFactory xmlFactory;
+
+
+ public void testPropertyLoading_SimpleType() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0' "
+ + "xmlns:xs='http://www.w3.org/2001/XMLSchema' "
+ + " name='TestProperty' type='xs:string' many='true'>"
+ + "<value>"
+ + "TestPropertyValue1"
+ + "</value>"
+ + "<value>"
+ + "TestPropertyValue2"
+ + "</value>"
+ + "</tus:property>";
+
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+
+ assertEquals("TestProperty", aProperty.getName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string", "xs"), aProperty.getXmlType());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(true, aProperty.isMany());
+
+ Element secondValue = aProperty.getDefaultValues().get(1);
+
+ NodeList childNodes = secondValue.getChildNodes();
+ assertEquals(1, childNodes.getLength());
+
+ Text t = (Text) childNodes.item(0);
+ assertEquals("TestPropertyValue2", t.getTextContent());
+ }
+
+ public void testPropertyLoading_Type() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0' "
+ + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
+ + " name='complexFoo' many='true' type='foo:MyComplexType'>"
+ + "<MyComplexPropertyValue1 xsi:type='foo:MyComplexType' attr='bar'>"
+ + "<foo:a>AValue</foo:a>"
+ + "<foo:b>InterestingURI</foo:b>"
+ + "</MyComplexPropertyValue1>"
+ + "<MyComplexPropertyValue2 xsi:type='foo:MyComplexType' attr='zing'>"
+ + "<foo:a>BValue</foo:a>"
+ + "<foo:b>BoringURI</foo:b>"
+ + "</MyComplexPropertyValue2>"
+ + "</tus:property>";
+
+
+
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+
+ assertEquals("complexFoo", aProperty.getName());
+ assertEquals(new QName("http://foo.com", "MyComplexType", "foo"), aProperty.getXmlType());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(true, aProperty.isMany());
+
+ Element secondValue = aProperty.getDefaultValues().get(1);
+
+ NodeList childNodes = secondValue.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+
+ Element e = (Element) childNodes.item(0);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("a", e.getLocalName());
+ assertEquals("BValue", e.getTextContent());
+ e = (Element) childNodes.item(1);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("b", e.getLocalName());
+ assertEquals("BoringURI", e.getTextContent());
+ }
+
+ public void testPropertyLoading_Element() throws Exception {
+ String xml =
+ "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'"
+ + " name='TestProperty' many='true' element='foo:TestElement'>\n"
+ + "<foo:TestElement>"
+ + "<foo:a>aValue1</foo:a>"
+ + "<foo:b>InterestingURI1</foo:b>"
+ + "</foo:TestElement>"
+ + "<foo:TestElement>"
+ + "<foo:a>aValue2</foo:a>"
+ + "<foo:b>InterestingURI2</foo:b>"
+ + "</foo:TestElement>"
+ + "</tus:property>";
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+
+ Element secondElement = aProperty.getDefaultValues().get(1);
+
+ assertEquals(2, aProperty.getDefaultValues().size());
+ assertEquals("TestProperty", aProperty.getName());
+ assertEquals(new QName("http://foo.com", "TestElement", "foo"), aProperty.getXmlElement());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(true, aProperty.isMany());
+
+ NodeList childNodes = secondElement.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+
+ Element e = (Element) childNodes.item(0);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("a", e.getLocalName());
+ assertEquals("aValue2", e.getTextContent());
+ e = (Element) childNodes.item(1);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("b", e.getLocalName());
+ assertEquals("InterestingURI2", e.getTextContent());
+ }
+
+ public void testManyValueException() throws Exception {
+ String xml =
+ "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'"
+ + " name='TestProperty' element='foo:TestElement'>\n"
+ + "<foo:TestElement>"
+ + "<foo:a>aValue1</foo:a>"
+ + "<foo:b>InterestingURI1</foo:b>"
+ + "</foo:TestElement>"
+ + "<foo:TestElement>"
+ + "<foo:a>aValue2</foo:a>"
+ + "<foo:b>InterestingURI2</foo:b>"
+ + "</foo:TestElement>"
+ + "</tus:property>";
+
+ XMLStreamReader reader = getReader(xml);
+
+ try {
+ propertyLoader.load(null, null, reader, null);
+ } catch (Exception e) {
+ assertTrue(e instanceof ManyPropertyValueLoaderException);
+ }
+ }
+
+ public XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+ propertyLoader = new PropertyLoader(EasyMock.createMock(LoaderRegistry.class));
+ }
+
+ private void printNode(Node node) throws Exception {
+ javax.xml.transform.Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ JavaBean2DOMNodeTransformer java2DomTransformer = new JavaBean2DOMNodeTransformer();
+ StringWriter sw = new StringWriter();
+ transformer.transform(new DOMSource(node), new StreamResult(sw));
+
+ System.out.println(sw.toString());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PolicySetLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PolicySetLoaderTestCase.java
new file mode 100644
index 0000000000..8e18c2ff0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PolicySetLoaderTestCase.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.core.loader;
+
+import java.util.Collection;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.model.IntentMap;
+import org.apache.tuscany.spi.model.PolicySet;
+import org.apache.tuscany.spi.model.Qualifier;
+
+import junit.framework.TestCase;
+
+public class PolicySetLoaderTestCase extends TestCase {
+ private static final QName POLICYSET = new QName(SCA_NS, "policySet");
+
+ public void testLoader() throws Exception {
+ PolicySetLoader loader = new PolicySetLoader(null);
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLStreamReader reader = factory.createXMLStreamReader(this.getClass().getResourceAsStream("TestPolicy.scdl"));
+ while (true) {
+ int state = reader.next();
+ if (START_ELEMENT == state && reader.getName().equals(POLICYSET)) {
+ break;
+ }
+ }
+ PolicySet policySet = loader.load(null, null, reader, null);
+ assertNotNull(policySet);
+ assertEquals(2, policySet.getAppliedArtifacts().size());
+ assertTrue(policySet.getAppliedArtifacts().contains(new QName(SCA_NS, "binding.ws")));
+ assertTrue(policySet.getAppliedArtifacts().contains(new QName(SCA_NS, "binding.jms")));
+ Collection<IntentMap> intentMaps = policySet.getIntentMaps();
+ assertEquals(1, intentMaps.size());
+ IntentMap intentMap = intentMaps.iterator().next();
+ assertEquals("transport", intentMap.getDefaultProvideIntent());
+ assertTrue(intentMap.getProvideIntents().contains("sec.confidentiality"));
+ Collection<Qualifier> qualifiers = intentMap.getQualifiers();
+ assertEquals(2, qualifiers.size());
+ Iterator qit = qualifiers.iterator();
+ Qualifier qualifier1 = (Qualifier) qit.next();
+ assertEquals(2, qualifier1.getWsPolicyAttachments().size());
+ assertEquals("transport", qualifier1.getName());
+ Qualifier qualifier2 = (Qualifier) qit.next();
+ assertEquals("message", qualifier2.getName());
+ IntentMap messageMap = qualifier2.getIntentMap();
+ assertEquals(2, messageMap.getQualifiers().size());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyLoaderTestCase.java
new file mode 100644
index 0000000000..c357d9bc0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyLoaderTestCase.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Property;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * @version $Rev: 502055 $ $Date: 2007-02-01 05:37:32 +0530 (Thu, 01 Feb 2007) $
+ */
+public class PropertyLoaderTestCase extends TestCase {
+ private PropertyLoader propertyLoader;
+ private XMLInputFactory xmlFactory;
+
+
+ public void testPropertyLoading_SimpleType() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0' "
+ + "xmlns:xs='http://www.w3.org/2001/XMLSchema' "
+ + " name='TestProperty' type='xs:string'>"
+ + "TestPropertyValue"
+ + "</tus:property>";
+
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+
+ assertEquals("TestProperty", aProperty.getName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string", "xs"), aProperty.getXmlType());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(false, aProperty.isMany());
+
+ Element root = aProperty.getDefaultValues().get(0);
+
+ NodeList childNodes = root.getChildNodes();
+ assertEquals(1, childNodes.getLength());
+
+ Text t = (Text) childNodes.item(0);
+ assertEquals("TestPropertyValue", t.getTextContent());
+ }
+
+
+ public void testPropertyLoading_Type() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0' "
+ + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
+ + " name='complexFoo' type='foo:MyComplexType'>"
+ + "<MyComplexPropertyValue1 xsi:type='foo:MyComplexType' attr='bar'>"
+ + "<foo:a>AValue</foo:a>"
+ + "<foo:b>InterestingURI</foo:b>"
+ + "</MyComplexPropertyValue1>"
+ + "</tus:property>";
+
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+ assertEquals("complexFoo", aProperty.getName());
+ assertEquals(new QName("http://foo.com", "MyComplexType", "foo"), aProperty.getXmlType());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(false, aProperty.isMany());
+
+ Element root = aProperty.getDefaultValues().get(0);
+
+ NodeList childNodes = root.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+
+ Element e = (Element) childNodes.item(0);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("a", e.getLocalName());
+ assertEquals("AValue", e.getTextContent());
+ e = (Element) childNodes.item(1);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("b", e.getLocalName());
+ assertEquals("InterestingURI", e.getTextContent());
+ }
+
+ public void testPropertyLoading_Element() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'"
+ + " name='TestProperty' element='foo:TestElement'>\n"
+ + "<foo:TestElement>"
+ + "<foo:a>aValue</foo:a>"
+ + "<foo:b>InterestingURI</foo:b>"
+ + "</foo:TestElement>"
+ + "</tus:property>";
+ XMLStreamReader reader = getReader(xml);
+ Property<?> aProperty = propertyLoader.load(null, null, reader, null);
+
+ Element root = aProperty.getDefaultValues().get(0);
+
+ assertEquals("TestProperty", aProperty.getName());
+ assertEquals(new QName("http://foo.com", "TestElement", "foo"), aProperty.getXmlElement());
+ assertEquals(false, aProperty.isMustSupply());
+ assertEquals(false, aProperty.isMany());
+
+ NodeList childNodes = root.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+
+ Element e = (Element) childNodes.item(0);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("a", e.getLocalName());
+ assertEquals("aValue", e.getTextContent());
+ e = (Element) childNodes.item(1);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("b", e.getLocalName());
+ assertEquals("InterestingURI", e.getTextContent());
+ }
+
+ public void testPropertyLoadingNoDefault() throws Exception {
+ String xml = "<tus:property xmlns:foo='http://foo.com' "
+ + "xmlns:tus='http://www.osoa.org/xmlns/sca/1.0'"
+ + " name='TestProperty' type='foo:TestType' mustSupply='true'>"
+ + "<foo:a>aValue</foo:a>"
+ + "<foo:b>InterestingURI</foo:b>"
+ + "</tus:property>";
+
+ XMLStreamReader reader = getReader(xml);
+
+ try {
+ propertyLoader.load(null, null, reader, null);
+ } catch (Exception e) {
+ assertTrue(e instanceof DefaultPropertyValueLoaderException);
+ }
+ }
+
+ public XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+ propertyLoader = new PropertyLoader(EasyMock.createMock(LoaderRegistry.class));
+ }
+
+ private void printNode(Node node) throws Exception {
+ javax.xml.transform.Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ JavaBean2DOMNodeTransformer java2DomTransformer = new JavaBean2DOMNodeTransformer();
+ StringWriter sw = new StringWriter();
+ transformer.transform(new DOMSource(node), new StreamResult(sw));
+
+ System.out.println(sw.toString());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.java
new file mode 100644
index 0000000000..a82e5f6b72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/PropertyParsingTestCase.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.loader;
+
+import java.io.StringReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.util.stax.StaxUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PropertyParsingTestCase extends TestCase {
+ private XMLInputFactory xmlFactory;
+ private DocumentBuilder docBuilder;
+ private Element root;
+
+ public void testComplexProperty() throws XMLStreamException {
+ String xml = "<property xmlns:foo='http://foo.com'>"
+ + "<foo:a>aValue</foo:a>"
+ + "<foo:b>InterestingURI</foo:b>"
+ + "</property>";
+
+ XMLStreamReader reader = getReader(xml);
+ StaxUtil.loadPropertyValue(reader, root, root.getOwnerDocument());
+ NodeList childNodes = root.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+
+ Element e = (Element) childNodes.item(0);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("a", e.getLocalName());
+ assertEquals("aValue", e.getTextContent());
+ e = (Element) childNodes.item(1);
+ assertEquals("http://foo.com", e.getNamespaceURI());
+ assertEquals("b", e.getLocalName());
+ assertEquals("InterestingURI", e.getTextContent());
+ }
+
+ public XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docBuilder = docFactory.newDocumentBuilder();
+ Document doc = docBuilder.newDocument();
+ root = doc.createElement("value");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.java
new file mode 100644
index 0000000000..6254835f13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ReferenceLoaderTestCase.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.core.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+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.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.easymock.EasyMock;
+import org.osoa.sca.Constants;
+
+/**
+ * Verifies loading of a reference definition from an XML-based assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceLoaderTestCase extends TestCase {
+ private static final QName REFERENCE = new QName(Constants.SCA_NS, "reference");
+
+ private ReferenceLoader loader;
+ private DeploymentContext deploymentContext;
+ private XMLStreamReader mockReader;
+ private LoaderRegistry mockRegistry;
+
+ public void testWithNoInterface() throws LoaderException, XMLStreamException {
+ String name = "referenceDefinition";
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ EasyMock.expect(mockReader.getAttributeValue(null, "multiplicity")).andReturn("0..1");
+ EasyMock.expect(mockReader.getAttributeValue(null, "wiredByImpl")).andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(null, "target")).andReturn(null);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.replay(mockReader);
+ ComponentTypeReferenceDefinition referenceDefinition =
+ loader.load(null, new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>(), mockReader, null);
+ assertNotNull(referenceDefinition);
+ assertEquals(name, referenceDefinition.getName());
+ }
+
+ public void testComponentTypeService() throws LoaderException, XMLStreamException {
+ String name = "reference";
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ EasyMock.expect(mockReader.getAttributeValue(null, "multiplicity")).andReturn("0..1");
+ EasyMock.expect(mockReader.getAttributeValue(null, "wiredByImpl")).andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(null, "target")).andReturn(null);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.replay(mockReader);
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition referenceDefinition = loader.load(null, type, mockReader, null);
+ assertTrue(ComponentTypeReferenceDefinition.class.equals(referenceDefinition.getClass()));
+ }
+
+ public void testMultipleBindings() throws LoaderException, XMLStreamException {
+ String name = "referenceDefinition";
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ EasyMock.expect(mockReader.getAttributeValue(null, "multiplicity")).andReturn("0..1");
+ EasyMock.expect(mockReader.getAttributeValue(null, "wiredByImpl")).andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(null, "target")).andReturn(null);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.START_ELEMENT).times(2);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.replay(mockReader);
+
+ BindingDefinition binding = new BindingDefinition() {
+ public Object clone() {
+ return null;
+ }
+ };
+ EasyMock.expect(mockRegistry.load(null, null, mockReader, null)).andReturn(binding).times(2);
+ EasyMock.replay(mockRegistry);
+
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition referenceDefinition = loader.load(null, type, mockReader, null);
+ assertEquals(2, referenceDefinition.getBindings().size());
+ }
+
+ public void testWithInterface() throws LoaderException, XMLStreamException {
+ String name = "referenceDefinition";
+ ServiceContract sc = new ServiceContract() {
+ };
+ EasyMock.expect(mockReader.getName()).andReturn(REFERENCE).anyTimes();
+ EasyMock.expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ EasyMock.expect(mockReader.getAttributeValue(null, "multiplicity")).andReturn("0..1");
+ EasyMock.expect(mockReader.getAttributeValue(null, "wiredByImpl")).andReturn("false");
+ EasyMock.expect(mockReader.getAttributeValue(null, "target")).andReturn(null);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.START_ELEMENT);
+ EasyMock.expect(mockRegistry.load(null, null, mockReader, deploymentContext)).andReturn(sc);
+ EasyMock.expect(mockReader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+
+ EasyMock.replay(mockReader);
+ EasyMock.replay(mockRegistry);
+
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition referenceDefinition = loader.load(null, type, mockReader, deploymentContext);
+ assertNotNull(referenceDefinition);
+ assertEquals(name, referenceDefinition.getName());
+ assertSame(sc, referenceDefinition.getServiceContract());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ mockReader = EasyMock.createStrictMock(XMLStreamReader.class);
+ mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ loader = new ReferenceLoader(mockRegistry);
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java
new file mode 100644
index 0000000000..6e13256440
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/ServiceLoaderTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.loader;
+
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+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.BindingDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+/**
+ * Verifies loading of a service definition from an XML-based assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceLoaderTestCase extends TestCase {
+ private static final QName SERVICE = new QName(SCA_NS, "service");
+ private static final QName BINDING = new QName(SCA_NS, "binding.foo");
+ private static final QName REFERENCE = new QName(SCA_NS, "reference");
+ private static final QName INTERFACE_JAVA = new QName(SCA_NS, "interface.java");
+
+ private ServiceLoader loader;
+ private DeploymentContext deploymentContext;
+ private XMLStreamReader mockReader;
+ private LoaderRegistry mockRegistry;
+
+ public void testWithNoInterface() throws LoaderException, XMLStreamException {
+ String name = "serviceDefinition";
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ replay(mockReader);
+ ServiceDefinition serviceDefinition = loader.load(null, null, mockReader, null);
+ assertNotNull(serviceDefinition);
+ assertEquals(name, serviceDefinition.getName());
+ }
+
+ public void testComponentTypeService() throws LoaderException, XMLStreamException {
+ String name = "service";
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ replay(mockReader);
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ServiceDefinition serviceDefinition = loader.load(null, type, mockReader, null);
+ assertTrue(ServiceDefinition.class.equals(serviceDefinition.getClass()));
+ }
+
+ public void testMultipleBindings() throws LoaderException, XMLStreamException {
+ String name = "serviceDefinition";
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ expect(mockReader.next()).andReturn(START_ELEMENT);
+ expect(mockReader.getName()).andReturn(BINDING);
+ expect(mockReader.next()).andReturn(START_ELEMENT);
+ expect(mockReader.getName()).andReturn(BINDING);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ replay(mockReader);
+
+ BindingDefinition binding = new BindingDefinition() {
+ public Object clone() {
+ return null;
+ }
+ };
+ expect(mockRegistry.load(null, null, mockReader, null)).andReturn(binding).times(2);
+ replay(mockRegistry);
+
+ ServiceDefinition serviceDefinition = loader.load(null, null, mockReader, null);
+ assertEquals(2, serviceDefinition.getBindings().size());
+ }
+
+ public void testWithInterface() throws LoaderException, XMLStreamException {
+ String name = "serviceDefinition";
+ String target = "target";
+ ServiceContract sc = new ServiceContract() {
+ };
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ expect(mockReader.next()).andReturn(START_ELEMENT);
+ expect(mockReader.getName()).andReturn(INTERFACE_JAVA);
+ expect(mockRegistry.load(null, null, mockReader, deploymentContext)).andReturn(sc);
+ expect(mockReader.next()).andReturn(START_ELEMENT);
+ expect(mockReader.getName()).andReturn(REFERENCE);
+ expect(mockReader.getElementText()).andReturn(target);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(REFERENCE);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(SERVICE);
+
+ replay(mockReader);
+ replay(mockRegistry);
+
+ ServiceDefinition serviceDefinition = loader.load(null, null, mockReader, deploymentContext);
+ assertNotNull(serviceDefinition);
+ assertEquals(name, serviceDefinition.getName());
+ assertSame(sc, serviceDefinition.getServiceContract());
+ }
+
+ public void testWithNoReference() throws LoaderException, XMLStreamException {
+ String name = "serviceDefinition";
+ ServiceContract sc = new ServiceContract() {
+ };
+ expect(mockReader.getName()).andReturn(SERVICE).anyTimes();
+ expect(mockReader.getAttributeValue(null, "name")).andReturn(name);
+ expect(mockReader.next()).andReturn(START_ELEMENT);
+ expect(mockReader.getName()).andReturn(INTERFACE_JAVA);
+ expect(mockRegistry.load(null, null, mockReader, deploymentContext)).andReturn(sc);
+ expect(mockReader.next()).andReturn(END_ELEMENT);
+ expect(mockReader.getName()).andReturn(SERVICE);
+
+ replay(mockReader);
+ replay(mockRegistry);
+
+ ServiceDefinition serviceDefinition = loader.load(null, null, mockReader, deploymentContext);
+ assertNotNull(serviceDefinition);
+ assertEquals(name, serviceDefinition.getName());
+ assertSame(sc, serviceDefinition.getServiceContract());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ mockReader = EasyMock.createStrictMock(XMLStreamReader.class);
+ mockRegistry = EasyMock.createMock(LoaderRegistry.class);
+ loader = new ServiceLoader(mockRegistry);
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryImplTestCase.java
new file mode 100644
index 0000000000..74a40c80a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryImplTestCase.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.loader;
+
+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.StAXElementLoader;
+import org.apache.tuscany.spi.loader.UnrecognizedElementException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import static org.easymock.EasyMock.isNull;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies the default loader registry
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAXLoaderRegistryImplTestCase extends TestCase {
+ private LoaderRegistryImpl registry;
+ private QName name;
+ private LoaderRegistryImpl.Monitor mockMonitor;
+ private StAXElementLoader<ModelObject> mockLoader;
+ private XMLStreamReader mockReader;
+ private DeploymentContext deploymentContext;
+ private ModelObject modelObject;
+
+ public void testLoaderRegistration() {
+ mockMonitor.registeringLoader(EasyMock.eq(name));
+ EasyMock.replay(mockMonitor);
+ registry.registerLoader(name, mockLoader);
+ EasyMock.verify(mockMonitor);
+ }
+
+ public void testLoaderUnregistration() {
+ mockMonitor.unregisteringLoader(EasyMock.eq(name));
+ EasyMock.replay(mockMonitor);
+ registry.unregisterLoader(name, (StAXElementLoader<ModelObject>) mockLoader);
+ EasyMock.verify(mockMonitor);
+ }
+
+ public void testSuccessfulDispatch() throws LoaderException, XMLStreamException {
+ EasyMock.expect(mockReader.getName()).andReturn(name);
+ EasyMock.replay(mockReader);
+ mockMonitor.registeringLoader(EasyMock.eq(name));
+ mockMonitor.elementLoad(EasyMock.eq(name));
+ EasyMock.replay(mockMonitor);
+ EasyMock.expect(mockLoader.load(EasyMock.isA(CompositeComponent.class),
+ (ModelObject) isNull(),
+ EasyMock.eq(mockReader),
+ EasyMock.eq(deploymentContext))).andReturn(modelObject);
+ EasyMock.replay(mockLoader);
+ registry.registerLoader(name, (StAXElementLoader<ModelObject>) mockLoader);
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ assertSame(modelObject, registry.load(parent, null, mockReader, deploymentContext));
+ EasyMock.verify(mockLoader);
+ EasyMock.verify(mockMonitor);
+ EasyMock.verify(mockReader);
+
+ }
+
+ public void testUnsuccessfulDispatch() throws LoaderException, XMLStreamException {
+ EasyMock.expect(mockReader.getName()).andReturn(name);
+ EasyMock.replay(mockReader);
+ mockMonitor.elementLoad(EasyMock.eq(name));
+ EasyMock.replay(mockMonitor);
+ try {
+ registry.load(null, null, mockReader, deploymentContext);
+ fail();
+ } catch (UnrecognizedElementException e) {
+ assertSame(name, e.getElement());
+ }
+ EasyMock.verify(mockReader);
+ EasyMock.verify(mockMonitor);
+ }
+
+ public void testPregivenModelObject() throws Exception {
+ EasyMock.expect(mockReader.getName()).andReturn(name);
+ EasyMock.replay(mockReader);
+ mockMonitor.registeringLoader(EasyMock.eq(name));
+ mockMonitor.elementLoad(EasyMock.eq(name));
+ EasyMock.replay(mockMonitor);
+ EasyMock.expect(mockLoader.load(EasyMock.isA(CompositeComponent.class),
+ EasyMock.eq(modelObject),
+ EasyMock.eq(mockReader),
+ EasyMock.eq(deploymentContext))).andReturn(modelObject);
+ EasyMock.replay(mockLoader);
+ registry.registerLoader(name, (StAXElementLoader<ModelObject>) mockLoader);
+ CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
+ assertSame(modelObject, registry.load(parent, modelObject, mockReader, deploymentContext));
+ EasyMock.verify(mockLoader);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ name = new QName("http://mock", "test");
+ deploymentContext = new RootDeploymentContext(null, null, null, null);
+ mockMonitor = EasyMock.createMock(LoaderRegistryImpl.Monitor.class);
+ registry = new LoaderRegistryImpl(mockMonitor);
+
+ mockLoader = EasyMock.createMock(StAXElementLoader.class);
+ mockReader = EasyMock.createMock(XMLStreamReader.class);
+ modelObject = new ModelObject() {
+ };
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java
new file mode 100644
index 0000000000..002eb6646e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.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.core.loader;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.easymock.EasyMock;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StringParserPropertyFactoryTestCase extends TestCase {
+
+ private <T> PropertyValue<T> mock(String value) {
+ Document document = EasyMock.createMock(Document.class);
+ Element element = EasyMock.createMock(Element.class);
+ //EasyMock.expect(document.getDocumentElement()).andReturn(element);
+ EasyMock.expect(element.getTextContent()).andReturn(value);
+ EasyMock.replay(document, element);
+
+ List<Element> valueList = new ArrayList<Element>();
+ valueList.add(element);
+ return new PropertyValue<T>(null, valueList);
+ }
+
+ public void testInteger() throws Exception {
+
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<Integer> property = new Property<Integer>();
+ property.setJavaType(Integer.class);
+ PropertyValue<Integer> propertyValue = mock("1");
+ ObjectFactory<Integer> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals(1, oFactory.getInstance().intValue());
+ }
+
+ public void testPrimitiveInt() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<Integer> property = new Property<Integer>();
+ property.setJavaType(Integer.TYPE);
+ PropertyValue<Integer> propertyValue = mock("1");
+ ObjectFactory<Integer> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals(1, oFactory.getInstance().intValue());
+ }
+
+ public void testString() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<String> property = new Property<String>();
+ property.setJavaType(String.class);
+ PropertyValue<String> propertyValue = mock("1");
+ ObjectFactory<String> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals("1", oFactory.getInstance());
+ }
+
+ public void testByteArray() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<byte[]> property = new Property<byte[]>();
+ property.setJavaType(byte[].class);
+ PropertyValue<byte[]> propertyValue = mock("1");
+ ObjectFactory<byte[]> oFactory = factory.createObjectFactory(property, propertyValue);
+ byte[] result = oFactory.getInstance();
+ byte[] expected = "1".getBytes();
+ for (int i = 0; i < result.length; i++) {
+ byte b = result[i];
+ if (b != expected[i]) {
+ fail();
+ }
+ }
+ }
+
+ public void testBoolean() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<Boolean> property = new Property<Boolean>();
+ property.setJavaType(Boolean.class);
+ PropertyValue<Boolean> propertyValue = mock("true");
+ ObjectFactory<Boolean> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertTrue(oFactory.getInstance());
+ }
+
+ public void testPrimitiveBoolean() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<Boolean> property = new Property<Boolean>();
+ property.setJavaType(Boolean.TYPE);
+ PropertyValue<Boolean> propertyValue = mock("true");
+ ObjectFactory<Boolean> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertTrue(oFactory.getInstance());
+ }
+
+ public void testStringConstructor() throws Exception {
+ StringParserPropertyFactory factory = new StringParserPropertyFactory();
+ Property<Foo> property = new Property<Foo>();
+ property.setJavaType(Foo.class);
+ PropertyValue<Foo> propertyValue = mock("test");
+ ObjectFactory<Foo> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals("test", oFactory.getInstance().getFoo());
+ }
+
+ private static class Foo {
+ private String foo;
+
+ public Foo(String foo) {
+ this.foo = foo;
+ }
+
+ public String getFoo() {
+ return foo;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/WireLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/WireLoaderTestCase.java
new file mode 100644
index 0000000000..2e42c0e70d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/loader/WireLoaderTestCase.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import org.easymock.EasyMock;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.Location;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.InvalidWireException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.WireDefinition;
+
+/**
+ * @version $Rev: 471504 $ $Date: 2006-11-06 01:10:40 +0530 (Mon, 06 Nov 2006) $
+ */
+public class WireLoaderTestCase extends TestCase {
+ private static final QName WIRE = new QName(SCA_NS, "wire");
+ private static final QName SOURCE_URI = new QName(SCA_NS, "source.uri");
+ private static final QName TARGET_URI = new QName(SCA_NS, "target.uri");
+
+ private LoaderRegistry registry;
+ private WireLoader loader;
+ private XMLStreamReader reader;
+ private DeploymentContext context;
+ private CompositeComponent composite;
+
+ public void testValidWire() throws LoaderException, XMLStreamException {
+ expect(reader.getName()).andReturn(WIRE);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(SOURCE_URI).times(1);
+ expect(reader.getElementText()).andReturn("source").times(1);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(TARGET_URI).times(2);
+ expect(reader.getElementText()).andReturn("target").times(1);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.getName()).andReturn(WIRE).anyTimes();
+ replay(registry, reader, context);
+ WireDefinition wireDef = loader.load(composite, null, reader, context);
+ assertNotNull(wireDef);
+ verify(registry, reader, context);
+ }
+
+ public void testInValidWireNoSourceElement() throws LoaderException, XMLStreamException {
+ expect(reader.getName()).andReturn(WIRE).times(1);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(TARGET_URI).times(2);
+ expect(reader.getElementText()).andReturn("target").times(1);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.getName()).andReturn(WIRE).anyTimes();
+ replay(registry, reader, context);
+ try {
+ loader.load(composite, null, reader, context);
+ fail();
+ } catch (InvalidWireException e) {
+ //expected behaviour
+ }
+ verify(registry, reader, context);
+ }
+
+ public void testInValidWireNoTargetElement() throws LoaderException, XMLStreamException {
+ expect(reader.getName()).andReturn(WIRE).times(1);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(SOURCE_URI).times(1);
+ expect(reader.getElementText()).andReturn("source").times(1);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.getName()).andReturn(WIRE).anyTimes();
+ replay(registry, reader, context);
+ try {
+ loader.load(composite, null, reader, context);
+ fail();
+ } catch (InvalidWireException e) {
+ //expected behaviour
+ }
+ verify(registry, reader, context);
+ }
+
+ public void testInValidWireNoSourceSpecified() throws LoaderException, XMLStreamException {
+ expect(reader.getName()).andReturn(WIRE).times(1);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(SOURCE_URI).times(1);
+ expect(reader.getElementText()).andReturn("").times(1);
+ replay(registry, reader, context);
+ try {
+ loader.load(composite, null, reader, context);
+ fail();
+ } catch (InvalidWireException e) {
+ //expected behaviour
+ }
+ verify(registry, reader, context);
+ }
+
+ public void testInValidWireNoTargetSpecified() throws LoaderException, XMLStreamException {
+ expect(reader.getName()).andReturn(WIRE).times(1);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(SOURCE_URI).times(1);
+ expect(reader.getElementText()).andReturn("source").times(1);
+ expect(reader.next()).andReturn(END_ELEMENT);
+ expect(reader.next()).andReturn(START_ELEMENT);
+ expect(reader.getName()).andReturn(TARGET_URI).times(2);
+ expect(reader.getElementText()).andReturn("").times(1);
+ expect(reader.getName()).andReturn(WIRE).anyTimes();
+ replay(registry, reader, context);
+ try {
+ loader.load(composite, null, reader, context);
+ fail();
+ } catch (InvalidWireException e) {
+ //expected behaviour
+ }
+ verify(registry, reader, context);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = createMock(LoaderRegistry.class);
+ reader = createMock(XMLStreamReader.class);
+ Location location = EasyMock.createNiceMock(Location.class);
+ EasyMock.replay(location);
+ EasyMock.expect(reader.getLocation()).andReturn(location).anyTimes();
+ context = createMock(DeploymentContext.class);
+ composite = createMock(CompositeComponent.class);
+ loader = new WireLoader(registry);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java
new file mode 100644
index 0000000000..8a38665584
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/binding/MockServiceBinding.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.mock.binding;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+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.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockServiceBinding extends AbstractSCAObject implements ServiceBinding {
+ private InboundWire inboundWire;
+ private OutboundWire outboundWire;
+ private ServiceContract<?> bindingServiceContract;
+
+
+ public MockServiceBinding() {
+ super("foo", null);
+ }
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public void setService(Service service) {
+ }
+
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public void setInboundWire(InboundWire inboundWire) {
+ this.inboundWire = inboundWire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ public Scope getScope() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.java
new file mode 100644
index 0000000000..653d5d7335
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/AsyncTarget.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.mock.component;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AsyncTarget {
+ @OneWay
+ void invoke();
+
+ int getCount();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.java
new file mode 100644
index 0000000000..066acc346d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadContextPojo.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.mock.component;
+
+import org.osoa.sca.annotations.Context;
+
+public class BadContextPojo {
+
+ @Context
+ String context;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.java
new file mode 100644
index 0000000000..77ec37f9e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BadNamePojo.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.core.mock.component;
+
+import org.osoa.sca.annotations.ComponentName;
+
+public class BadNamePojo {
+ @ComponentName
+ private int name;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.java
new file mode 100644
index 0000000000..b7921c248f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterface.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.core.mock.component;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface BasicInterface {
+ String returnsProperty();
+
+ BasicInterface returnsReference();
+
+ int returnsInt();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.java
new file mode 100644
index 0000000000..f7d7bb38cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/BasicInterfaceImpl.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.mock.component;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicInterfaceImpl implements BasicInterface {
+
+ @Property
+ public String publicProperty;
+
+ @Reference (required = false)
+ public BasicInterface publicReference;
+
+ @Property
+ protected String protectedProperty;
+
+ @Reference (required = false)
+ protected BasicInterface protectedReference;
+
+ private String privateProperty;
+
+ private BasicInterface privateReference;
+
+ @Property
+ public void setPrivateProperty(String privateProperty) {
+ this.privateProperty = privateProperty;
+ }
+
+ @Reference (required = false)
+ public void setPrivateReference(BasicInterface privateReference) {
+ this.privateReference = privateReference;
+ }
+
+ public String returnsProperty() {
+ return privateProperty;
+ }
+
+ public BasicInterface returnsReference() {
+ return privateReference;
+ }
+
+ public int returnsInt() {
+ return 0;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.java
new file mode 100644
index 0000000000..88b97216cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public interface CompositeScopeComponent {
+
+ //public boolean isInit();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.java
new file mode 100644
index 0000000000..93ee1f707a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeComponentImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class CompositeScopeComponentImpl implements
+ CompositeScopeComponent {
+
+ private String foo;
+
+ public void setFoo(String foo) {
+ this.foo = foo;
+ }
+
+ public String getFoo() {
+ return foo;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..16ce3b5569
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeDestroyOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeDestroyOnlyComponent extends CompositeScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..05b938a87c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitDestroyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeInitDestroyComponent extends CompositeScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ if (destroyed) {
+ throw new AssertionError("Destroy called more than once");
+ }
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..f9f80ca15c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/CompositeScopeInitOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Init;
+
+public class CompositeScopeInitOnlyComponent extends CompositeScopeComponentImpl {
+
+ private boolean initialized;
+ // this value tests to ensure introspection can find the init() method even
+ // if a field is named the same. Ultimately, this should be in the introspection tests
+ private boolean init;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ if (initialized) {
+ throw new AssertionError("Init called more than once");
+ }
+ initialized = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.java
new file mode 100644
index 0000000000..c71ac0586f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponent.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 org.apache.tuscany.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public interface ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.java
new file mode 100644
index 0000000000..5ea7278e1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeComponentImpl.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 org.apache.tuscany.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public class ConversationalScopeComponentImpl implements ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..8cea9efa49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeDestroyOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeDestroyOnlyComponent extends ConversationalScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..40dbfedf2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitDestroyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitDestroyComponent
+ extends ConversationalScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..caaa0c39e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/ConversationalScopeInitOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitOnlyComponent
+ extends ConversationalScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderException.java
new file mode 100644
index 0000000000..af257c226d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderException.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.core.mock.component;
+
+public class OrderException extends Exception {
+
+ public OrderException() {
+ super();
+ }
+
+ public OrderException(String message) {
+ super(message);
+ }
+
+ public OrderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OrderException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.java
new file mode 100644
index 0000000000..2033f0eca5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojo.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 org.apache.tuscany.core.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedDependentPojo extends OrderedInitPojo {
+
+ OrderedInitPojo getPojo();
+
+ void setPojo(OrderedInitPojo pojo);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.java
new file mode 100644
index 0000000000..439c3d143c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedDependentPojoImpl.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.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class OrderedDependentPojoImpl extends OrderedInitPojoImpl implements OrderedDependentPojo {
+
+ private OrderedInitPojo pojo;
+
+ public OrderedInitPojo getPojo() {
+ return pojo;
+ }
+
+ public void setPojo(OrderedInitPojo pojo) {
+ this.pojo = pojo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.java
new file mode 100644
index 0000000000..1986952747
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedEagerInitPojo.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.EagerInit;
+
+@Scope("COMPOSITE")
+@EagerInit
+public class OrderedEagerInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.java
new file mode 100644
index 0000000000..0b891cfa42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojo.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.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedInitPojo {
+ int getNumberInstantiated();
+
+ int getInitOrder();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.java
new file mode 100644
index 0000000000..a7063f6353
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OrderedInitPojoImpl.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class OrderedInitPojoImpl implements OrderedInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ public OrderedInitPojoImpl() {
+ }
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.java
new file mode 100644
index 0000000000..0b897daa40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTarget.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.mock.component;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface OtherTarget {
+
+ String getString();
+
+ void setString(String val);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.java
new file mode 100644
index 0000000000..a3b2bbf098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/OtherTargetImpl.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.mock.component;
+
+/**
+ * A target used for testing wires with a different source and target interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class OtherTargetImpl implements OtherTarget {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.java
new file mode 100644
index 0000000000..8c7dc107ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("REQUEST")
+public interface RequestScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..5224ceda5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeDestroyOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..38b188a4b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitDestroyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..707f8ab50f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/RequestScopeInitOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.java
new file mode 100644
index 0000000000..827ba804f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public interface SessionScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.java
new file mode 100644
index 0000000000..e547bf6113
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeComponentImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public class SessionScopeComponentImpl implements
+ SessionScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..c11bd1bd49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitDestroyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..095cc916ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SessionScopeInitOnlyComponent.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.mock.component;
+
+import org.osoa.sca.annotations.Init;
+
+public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.java
new file mode 100644
index 0000000000..c78ba00a7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTarget.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.core.mock.component;
+
+public interface SimpleTarget {
+
+ String hello(String message) throws Exception;
+
+ String goodbye(String message) throws Exception;
+
+ String echo(String message) throws Exception;
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.java
new file mode 100644
index 0000000000..634a07a401
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SimpleTargetImpl.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.mock.component;
+
+public class SimpleTargetImpl implements SimpleTarget {
+
+ public SimpleTargetImpl() {
+ super();
+ }
+
+ public String hello(String message) throws Exception {
+ return message;
+ }
+
+ public String goodbye(String message) throws Exception {
+ return message;
+ }
+
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java
new file mode 100644
index 0000000000..f7969f748b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Source.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.mock.component;
+
+import java.util.List;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Source {
+
+ Target getTarget();
+
+ List<Target> getTargets();
+
+ List<Target> getTargetsThroughField();
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java
new file mode 100644
index 0000000000..187e33b2bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.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.mock.component;
+
+import java.util.List;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class SourceImpl implements Source {
+
+ private Target target;
+ private List<Target> targets;
+ private List<Target> targetsThroughField;
+ private Target[] targetsArray;
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public List<Target> getTargets() {
+ return targets;
+ }
+
+ public void setTargets(List<Target> targets) {
+ this.targets = targets;
+ }
+
+ public List<Target> getTargetsThroughField() {
+ return targetsThroughField;
+ }
+
+ public Target[] getArrayOfTargets() {
+ return targetsArray;
+ }
+
+ public void setArrayOfTargets(Target[] targets) {
+ targetsArray = targets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.java
new file mode 100644
index 0000000000..c16ac942a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("STATELESS")
+public interface StatelessComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.java
new file mode 100644
index 0000000000..64a23c12c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/StatelessComponentImpl.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.core.mock.component;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessComponentImpl implements
+ StatelessComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java
new file mode 100644
index 0000000000..778c14665d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/Target.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.core.mock.component;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Target {
+
+ String getString();
+
+ void setString(String val);
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java
new file mode 100644
index 0000000000..037dd3a37c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.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.mock.component;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetImpl implements Target {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.java
new file mode 100644
index 0000000000..cdd0de7a6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockStaticInvoker.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.mock.wire;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+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.TargetInvoker;
+
+/**
+ * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from a lesser
+ * scope intended for a target with a wider scope
+ *
+ * @version $Rev$ $Date$
+ */
+public class MockStaticInvoker implements TargetInvoker {
+
+ private Object instance;
+ private Method operation;
+ private boolean cacheable;
+
+
+ public MockStaticInvoker(Method operation, Object instance) {
+ this.operation = operation;
+ this.instance = instance;
+ }
+
+ 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 {
+ try {
+ if (payload != null && !payload.getClass().isArray()) {
+ return operation.invoke(instance, payload);
+ } else {
+ return operation.invoke(instance, (Object[]) payload);
+ }
+ } catch (IllegalAccessException e) {
+ throw new InvocationRuntimeException(e);
+ }
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object resp = invokeTarget(msg.getBody(), TargetInvoker.NONE);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ } catch (Throwable e) {
+ msg.setBodyWithFault(e);
+ }
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+ throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain");
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ try {
+ MockStaticInvoker invoker = (MockStaticInvoker) super.clone();
+ invoker.instance = this.instance;
+ invoker.operation = this.operation;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.java
new file mode 100644
index 0000000000..1fe2c027ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockSyncInterceptor.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.mock.wire;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+
+public class MockSyncInterceptor implements Interceptor {
+
+ private int count;
+
+ private Interceptor next;
+
+ public MockSyncInterceptor() {
+ }
+
+ public Message invoke(Message msg) {
+ ++count;
+ return next.invoke(msg);
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.java
new file mode 100644
index 0000000000..3fcc75bdb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/mock/wire/MockTargetInvoker.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.mock.wire;
+
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+
+import org.apache.tuscany.core.binding.local.AbstractLocalTargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MockTargetInvoker extends AbstractLocalTargetInvoker {
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.java
new file mode 100644
index 0000000000..2d3f01422d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/DefaultExceptionFormatterTestCase.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.monitor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultExceptionFormatterTestCase extends TestCase {
+ private DefaultExceptionFormatter formatter = new DefaultExceptionFormatter();
+
+ public void testTuscanyExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ TuscanyException e = new TuscanyException("somemessage") {
+ };
+ e.addContextName("somecontext");
+ formatter.write(pw, e);
+ assertTrue(writer.toString().indexOf("somemessage") >= 0);
+ assertTrue(writer.toString().indexOf("somecontext") >= 0);
+ }
+
+ public void testTuscanyRuntimeExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ TuscanyRuntimeException e = new TuscanyRuntimeException("somemessage") {
+ };
+ e.addContextName("somecontext");
+ formatter.write(pw, e);
+ assertTrue(writer.toString().indexOf("somemessage") >= 0);
+ assertTrue(writer.toString().indexOf("somecontext") >= 0);
+ }
+
+ public void testNormalExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ Exception e = new Exception();
+ formatter.write(pw, e); // just verify there are no errors since no formatting needs to be doen
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.java
new file mode 100644
index 0000000000..5fdf035c7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/monitor/JavaLoggingTestCase.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.core.monitor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+import org.apache.tuscany.host.MonitorFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for the JavaLoggingMonitorFactory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaLoggingTestCase extends TestCase {
+ private static final Logger LOGGER = Logger.getLogger(Monitor.class.getName());
+ private static final MockHandler HANDLER = new MockHandler();
+
+ private MonitorFactory factory;
+
+ /**
+ * Smoke test to ensure the LOGGER is working.
+ */
+ public void testLogger() {
+ LOGGER.info("test");
+ assertEquals(1, HANDLER.logs.size());
+ }
+
+ /**
+ * Test that no record is logged.
+ */
+ public void testUnloggedEvent() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventNotToLog();
+ assertEquals(0, HANDLER.logs.size());
+ }
+
+ /**
+ * Test the correct record is written for an event with no arguments.
+ */
+ public void testEventWithNoArgs() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithNoArgs();
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Level.INFO, record.getLevel());
+ assertEquals(LOGGER.getName(), record.getLoggerName());
+ assertEquals(Monitor.class.getName() + "#eventWithNoArgs", record.getMessage());
+ }
+
+ /**
+ * Test the correct record is written for an event defined by annotation.
+ */
+ public void testEventWithAnnotation() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithAnnotation();
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Level.INFO, record.getLevel());
+ assertEquals(LOGGER.getName(), record.getLoggerName());
+ assertEquals(Monitor.class.getName() + "#eventWithAnnotation", record.getMessage());
+ }
+
+ /**
+ * Test the argument is logged.
+ */
+ public void testEventWithOneArg() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithOneArg("ARG");
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Monitor.class.getName() + "#eventWithOneArg", record.getMessage());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ LOGGER.setUseParentHandlers(false);
+ LOGGER.addHandler(HANDLER);
+ HANDLER.flush();
+
+ String sourceClass = Monitor.class.getName();
+ Properties levels = new Properties();
+ levels.setProperty(sourceClass + "#eventWithNoArgs", "INFO");
+ levels.setProperty(sourceClass + "#eventWithOneArg", "INFO");
+ levels.setProperty(sourceClass + "#eventWithThrowable", "WARNING");
+ factory = new JavaLoggingMonitorFactory(levels, Level.FINE, "TestMessages");
+ }
+
+ protected void tearDown() throws Exception {
+ LOGGER.removeHandler(HANDLER);
+ HANDLER.flush();
+ super.tearDown();
+ }
+
+ /**
+ * Mock log HANDLER to capture records.
+ */
+ public static class MockHandler extends Handler {
+ List<LogRecord> logs = new ArrayList<LogRecord>();
+
+ public void publish(LogRecord record) {
+ logs.add(record);
+ }
+
+ public void flush() {
+ logs.clear();
+ }
+
+ public void close() throws SecurityException {
+ }
+ }
+
+ @SuppressWarnings({"JavaDoc"})
+ public static interface Monitor {
+ void eventNotToLog();
+
+ @LogLevel("INFO")
+ void eventWithNoArgs();
+
+ @LogLevel("INFO")
+ void eventWithOneArg(String msg);
+
+ @LogLevel("WARNING")
+ void eventWithThrowable(Exception e);
+
+ @LogLevel("INFO")
+ void eventWithAnnotation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java
new file mode 100644
index 0000000000..de1c91b741
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.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.core.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IntentRegistryImplTestCase extends TestCase {
+ private static final QName WS_BINDING = new QName(SCA_NS, "binding.ws");
+ private static final QName JMS_BINDING = new QName(SCA_NS, "binding.jms");
+ private IntentRegistry intentReg;
+
+ @Override
+ protected void setUp() throws Exception {
+ intentReg = new IntentRegistryImpl();
+
+ Intent bodyintent = new Intent(new IntentName("sec.confidentiality/message/body"), "test");
+ bodyintent.addAppliedArtifacts(WS_BINDING);
+ bodyintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(bodyintent);
+
+ Intent headintent = new Intent(new IntentName("sec.confidentiality/message/head"), "test");
+ headintent.addAppliedArtifacts(WS_BINDING);
+ headintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(headintent);
+
+ Intent confidentialityintent = new Intent(new IntentName("sec.confidentiality"), "test");
+ confidentialityintent.addAppliedArtifacts(WS_BINDING);
+ confidentialityintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(confidentialityintent);
+
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/message"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ messageintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(messageintent);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ intentReg = null;
+ }
+
+// public void testGetQualifiedIntent() {
+// List<IntentName> intentNameList = new ArrayList<IntentName>();
+// intentReg.get
+// //intentReg.getConcretIntents(intentNameList, artifact)
+// }
+
+ public void testGetConcretIntents() {
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/transport"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ messageintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(messageintent);
+
+ Intent allintent = new Intent(new IntentName("sec.confidentiality/all"), null);
+ allintent.addAppliedArtifacts(WS_BINDING);
+ allintent.addRequriedIntents(new IntentName("sec.confidentiality/message"));
+ allintent.addRequriedIntents(new IntentName("sec.confidentiality/transport"));
+
+
+ intentReg.register(allintent);
+ List<IntentName> intents = new ArrayList<IntentName>();
+ intents.add(new IntentName("sec.confidentiality/all"));
+ Collection<IntentName> concreteIntents = intentReg.inlineProfileIntent(intents, WS_BINDING);
+ assertEquals(2, concreteIntents.size());
+ assertTrue(concreteIntents.contains(new IntentName("sec.confidentiality/message")));
+ assertTrue(concreteIntents.contains(new IntentName("sec.confidentiality/transport")));
+ //fail("Not yet implemented");
+ }
+
+ public void testGetQualifiedIntents() {
+ IntentName message = new IntentName("sec.confidentiality/message");
+ Collection<IntentName> qualifiedIntents = intentReg.getQualifiedIntents(message, JMS_BINDING);
+ assertEquals(2, qualifiedIntents.size());
+ assertTrue(qualifiedIntents.contains(new IntentName("sec.confidentiality/message/body")));
+ assertTrue(qualifiedIntents.contains(new IntentName("sec.confidentiality/message/head")));
+ assertFalse(qualifiedIntents.contains(new IntentName("sec.confidentiality/message")));
+ assertFalse(qualifiedIntents.contains(new IntentName("sec.confidentiality")));
+ }
+
+ public void testIsApplicable() {
+ assertTrue(intentReg.isApplicable(new IntentName("sec.confidentiality/message"), WS_BINDING));
+ assertFalse(intentReg.isApplicable(new IntentName("sec.confidentiality/transport"), WS_BINDING));
+ assertFalse(intentReg.isApplicable(new IntentName("test.confidentiality/transport"), WS_BINDING));
+ }
+
+ public void testRegister() {
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/transport"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ messageintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(messageintent);
+ assertTrue(intentReg.isApplicable(new IntentName("sec.confidentiality/transport"), WS_BINDING));
+ assertTrue(intentReg.isApplicable(new IntentName("sec.confidentiality/transport"), JMS_BINDING));
+
+ }
+
+ public void testIsQualifiedIntent() {
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/transport"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ messageintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(messageintent);
+ Intent allintent = new Intent(new IntentName("sec.confidentiality/all"), null);
+ allintent.addAppliedArtifacts(WS_BINDING);
+
+ assertTrue(intentReg.isQualifiedIntent(new IntentName("sec.confidentiality/transport")));
+ assertTrue(intentReg.isQualifiedIntent(new IntentName("sec.confidentiality/message/body")));
+ assertTrue(intentReg.isQualifiedIntent(new IntentName("sec.confidentiality/message/body")));
+ assertFalse(intentReg.isQualifiedIntent(new IntentName("sec.confidentiality/message")));
+ assertFalse(intentReg.isQualifiedIntent(new IntentName("sec.confidentiality")));
+ }
+
+ public void testUnRegister() {
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/transport"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ messageintent.addAppliedArtifacts(JMS_BINDING);
+ intentReg.register(messageintent);
+ intentReg.unRegister(messageintent);
+ assertFalse(intentReg.isApplicable(new IntentName("sec.confidentiality/transport"), WS_BINDING));
+ assertFalse(intentReg.isApplicable(new IntentName("sec.confidentiality/transport"), JMS_BINDING));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/PolicyEngineImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/PolicyEngineImplTestCase.java
new file mode 100644
index 0000000000..afb8981951
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/policy/PolicyEngineImplTestCase.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.model.PolicyModel;
+import org.apache.tuscany.spi.model.PolicySet;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+import org.apache.tuscany.spi.policy.PolicyEngine;
+import org.apache.tuscany.spi.policy.PolicySetContainer;
+import org.apache.tuscany.spi.policy.SCATypeManager;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.loader.PolicySetLoader;
+
+public class PolicyEngineImplTestCase extends TestCase {
+ private static final QName POLICYSET = new QName(SCA_NS, "policySet");
+ private static final QName WS_BINDING = new QName(SCA_NS, "binding.ws");
+ private IntentRegistry intentReg;
+ private PolicyEngine policyEngine;
+
+
+ public void testgetPolicy() throws Exception {
+ Collection<PolicyModel> policies =
+ policyEngine.getPolicy(new IntentName[]{new IntentName("sec.authentication/cert")}, null, WS_BINDING);
+ assertEquals(2, policies.size());
+ policies =
+ policyEngine.getPolicy(new IntentName[]{new IntentName("sec.authentication/basic")}, null, WS_BINDING);
+ assertEquals(1, policies.size());
+
+ //test for unqualified intent with default value on intentMap
+ policies = policyEngine.getPolicy(new IntentName[]{new IntentName("sec.authentication")}, null, WS_BINDING);
+ assertEquals(2, policies.size());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ PolicySetLoader loader = new PolicySetLoader(null);
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ InputStream resourceAsStream = this.getClass().getResourceAsStream("PolicySet.scdl");
+ XMLStreamReader reader = factory.createXMLStreamReader(resourceAsStream);
+ PolicySetContainerImpl psc = new PolicySetContainerImpl();
+ while (true) {
+ int state = reader.next();
+ if (state == XMLStreamConstants.END_DOCUMENT) {
+ break;
+ }
+ if (XMLStreamConstants.START_ELEMENT == state && reader.getName().equals(POLICYSET)) {
+ psc.addPolicySet(loader.load(null, null, reader, null));
+ }
+
+ }
+ resourceAsStream.close();
+ intentReg = new IntentRegistryImpl();
+ policyEngine = new PolicyEngineImpl(intentReg, psc, new SCATypeManagerImpl());
+
+ Intent bodyintent = new Intent(new IntentName("sec.confidentiality/message/body"), "test");
+ bodyintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(bodyintent);
+
+ Intent allintent = new Intent(new IntentName("sec.confidentiality/message/all"), "test");
+ allintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(allintent);
+
+ Intent confidentialityintent = new Intent(new IntentName("sec.confidentiality"), "test");
+ confidentialityintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(confidentialityintent);
+
+ Intent messageintent = new Intent(new IntentName("sec.confidentiality/message"), null);
+ messageintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(messageintent);
+
+ Intent authintent = new Intent(new IntentName("sec.authentication"), null);
+ authintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(authintent);
+
+ Intent certintent = new Intent(new IntentName("sec.authentication/cert"), null);
+ certintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(certintent);
+
+ Intent basicintent = new Intent(new IntentName("sec.authentication/basic"), null);
+ basicintent.addAppliedArtifacts(WS_BINDING);
+ intentReg.register(basicintent);
+
+ }
+
+ private class PolicySetContainerImpl implements PolicySetContainer {
+
+ private Map<QName, PolicySet> sets = new HashMap<QName, PolicySet>();
+
+ public Collection<PolicySet> getAllPolicySet() {
+ return sets.values();
+ }
+
+ public PolicySet getPolicySet(QName name) {
+ return sets.get(name);
+ }
+
+ public void addPolicySet(PolicySet pset) {
+ sets.put(pset.getName(), pset);
+ }
+
+ }
+
+ private class SCATypeManagerImpl implements SCATypeManager {
+
+ public boolean isTypeOf(QName subType, QName type) {
+ return subType.equals(type);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java
new file mode 100644
index 0000000000..5ddd0b32ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.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.property;
+
+import java.net.URL;
+import javax.xml.namespace.NamespaceContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.databinding.xml.String2Node;
+import org.easymock.EasyMock;
+
+/**
+ *
+ */
+public class PropertyHelperTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testXPath() throws Exception {
+ String2Node t = new String2Node();
+ Node node = t.transform(IPO_XML, null);
+
+ Document doc = PropertyHelper.evaluate(null, node, "/ipo:purchaseOrder/billTo");
+ assertNotNull(doc);
+
+ NamespaceContext context = EasyMock.createMock(NamespaceContext.class);
+ EasyMock.expect(context.getNamespaceURI("ipo")).andReturn("http://www.example.com/IPO").anyTimes();
+ EasyMock.replay(context);
+ doc = PropertyHelper.evaluate(context, node, "/ipo:purchaseOrder/items");
+ assertNotNull(doc);
+ doc = PropertyHelper.evaluate(context, node, "/ipo:purchaseOrder/billTo");
+ assertNotNull(doc);
+ doc = PropertyHelper.evaluate(context, node, "/");
+ assertNotNull(doc);
+ doc = PropertyHelper.evaluate(context, node, "/ipo:purchaseOrder/billTo1");
+ assertNull(doc);
+ }
+
+ public void testFile() throws Exception {
+ URL url = getClass().getResource("ipo.xml");
+ Document doc = PropertyHelper.loadFromFile(url.toExternalForm(), null);
+ assertNotNull(doc);
+
+ DeploymentContext context = EasyMock.createMock(DeploymentContext.class);
+ EasyMock.expect(context.getClassLoader()).andReturn(getClass().getClassLoader());
+ EasyMock.replay(context);
+ doc = PropertyHelper.loadFromFile("org/apache/tuscany/core/property/ipo.xml", context);
+ assertNotNull(doc);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/SimplePropertyObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/SimplePropertyObjectFactoryTestCase.java
new file mode 100644
index 0000000000..ef67533a0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/SimplePropertyObjectFactoryTestCase.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.core.property;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimplePropertyObjectFactoryTestCase extends TestCase {
+
+ private <T> PropertyValue<T> mock(String value) {
+ Document document = EasyMock.createMock(Document.class);
+ Element element = EasyMock.createMock(Element.class);
+ //EasyMock.expect(document.getDocumentElement()).andReturn(element);
+ EasyMock.expect(element.getTextContent()).andReturn(value);
+ EasyMock.replay(document, element);
+
+ List<Element> valueList = new ArrayList<Element>();
+ valueList.add(element);
+ return new PropertyValue<T>(null, valueList);
+ }
+
+ public void testInteger() throws Exception {
+
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<Integer> property = new Property<Integer>();
+ property.setJavaType(Integer.class);
+ PropertyValue<Integer> propertyValue = mock("1");
+ ObjectFactory<Integer> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals(1, oFactory.getInstance().intValue());
+ }
+
+ public void testPrimitiveInt() throws Exception {
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<Integer> property = new Property<Integer>();
+ property.setJavaType(Integer.TYPE);
+ PropertyValue<Integer> propertyValue = mock("1");
+ ObjectFactory<Integer> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals(1, oFactory.getInstance().intValue());
+ }
+
+ public void testString() throws Exception {
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<String> property = new Property<String>();
+ property.setJavaType(String.class);
+ PropertyValue<String> propertyValue = mock("1");
+ ObjectFactory<String> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertEquals("1", oFactory.getInstance());
+ }
+
+ public void testByteArray() throws Exception {
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<byte[]> property = new Property<byte[]>();
+ property.setJavaType(byte[].class);
+ PropertyValue<byte[]> propertyValue = mock("TWFu"); // BASE64 for "Man"
+ ObjectFactory<byte[]> oFactory = factory.createObjectFactory(property, propertyValue);
+ byte[] result = oFactory.getInstance();
+ byte[] expected = "Man".getBytes();
+ for (int i = 0; i < result.length; i++) {
+ byte b = result[i];
+ if (b != expected[i]) {
+ fail();
+ }
+ }
+ }
+
+ public void testBoolean() throws Exception {
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<Boolean> property = new Property<Boolean>();
+ property.setJavaType(Boolean.class);
+ PropertyValue<Boolean> propertyValue = mock("true");
+ ObjectFactory<Boolean> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertTrue(oFactory.getInstance());
+ }
+
+ public void testPrimitiveBoolean() throws Exception {
+ PropertyObjectFactoryImpl factory = new PropertyObjectFactoryImpl();
+ Property<Boolean> property = new Property<Boolean>();
+ property.setJavaType(Boolean.TYPE);
+ PropertyValue<Boolean> propertyValue = mock("true");
+ ObjectFactory<Boolean> oFactory = factory.createObjectFactory(property, propertyValue);
+ assertTrue(oFactory.getInstance());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/artifact/LocalMavenRepositoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/artifact/LocalMavenRepositoryTestCase.java
new file mode 100644
index 0000000000..0efecb9302
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/artifact/LocalMavenRepositoryTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.services.artifact;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.services.artifact.Artifact;
+
+/**
+ * This testcase assumes that there is a maven repo in the default location.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LocalMavenRepositoryTestCase extends TestCase {
+ private static final String VERSION = "3.8.1";
+ private LocalMavenRepository repo;
+ private Artifact artifact;
+ private String path;
+
+ public void testPathWithNoClassifier() {
+ assertEquals(path, repo.getPath(artifact));
+ }
+
+ public void testPathWithClassifier() {
+ artifact.setClassifier("x86");
+ path = "junit/junit/" + VERSION + "/junit-" + VERSION + "-x86.jar";
+ assertEquals(path, repo.getPath(artifact));
+ }
+
+ public void testArtifactFoundInRepo() throws MalformedURLException, UnsupportedEncodingException {
+ String home = System.getProperty("user.home");
+ File file = new File(home + "/.m2/repository", path);
+ repo.resolve(artifact);
+ assertEquals(file.toURI().toURL(), artifact.getUrl());
+ }
+
+ public void testArtifactNotFoundInRepo() throws MalformedURLException {
+ artifact.setClassifier("x86");
+ repo.resolve(artifact);
+ assertNull(artifact.getUrl());
+ }
+
+ public void testNonNullURLIsUnmodified() throws MalformedURLException {
+ URL url = new URL("http://www.apache.org");
+ artifact.setUrl(url);
+ repo.resolve(artifact);
+ assertSame(url, artifact.getUrl());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ repo = new LocalMavenRepository(".m2/repository");
+
+ artifact = new Artifact();
+ artifact.setGroup("junit");
+ artifact.setName("junit");
+ artifact.setVersion(VERSION);
+ artifact.setType("jar");
+ path = "junit/junit/" + VERSION + "/junit-" + VERSION + ".jar";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.java
new file mode 100644
index 0000000000..fb1daf7e5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/AssemblyServiceImplTestCase.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.services.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+import org.apache.tuscany.host.deployment.UnsupportedContentTypeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AssemblyServiceImplTestCase extends TestCase {
+ private AssemblyServiceImpl service;
+
+ public void testApplyChangesWithNullURL() {
+ try {
+ service.applyChanges(null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ //ok
+ } catch (Throwable t) {
+ fail();
+ }
+ }
+
+ public void testApplyChangesWhenURLContentTypeIsNull() throws Exception {
+ final URLConnection urlConnection = EasyMock.createMock(URLConnection.class);
+ EasyMock.expect(urlConnection.getContentType()).andReturn(null);
+ EasyMock.replay(urlConnection);
+ URLStreamHandler handler = new MockURLStreamHandler(urlConnection);
+
+ URL url = new URL(null, "file:/tmp/foo.xml", handler);
+ try {
+ service.applyChanges(url);
+ } catch (UnsupportedContentTypeException e) {
+ assertNull(e.getMessage());
+ assertEquals(url.toString(), e.getIdentifier());
+ EasyMock.verify(urlConnection);
+ } catch (Throwable t) {
+ fail();
+ }
+ }
+
+ public void testApplyChangesWithNullStream() {
+ try {
+ service.applyChanges(null, "xxx/xxx");
+ fail();
+ } catch (IllegalArgumentException e) {
+ //ok
+ } catch (Throwable t) {
+ fail();
+ }
+ }
+
+ public void testApplyChangesWithNullContentType() {
+ InputStream is = EasyMock.createMock(InputStream.class);
+ EasyMock.replay(is);
+ try {
+ service.applyChanges(is, null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ EasyMock.verify(is);
+ } catch (Throwable t) {
+ fail();
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ service = new AssemblyServiceImpl(null, null);
+ }
+
+ private static class MockURLStreamHandler extends URLStreamHandler {
+ private final URLConnection urlConnection;
+
+ public MockURLStreamHandler(URLConnection urlConnection) {
+ this.urlConnection = urlConnection;
+ }
+
+ protected URLConnection openConnection(URL url) throws IOException {
+ return urlConnection;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImplTestCase.java
new file mode 100644
index 0000000000..8bb800962f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImplTestCase.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.services.deployment;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.ContentType;
+
+public class ContentTypeDescriberImplTestCase extends TestCase {
+ private ContentTypeDescriberImpl contentTypeBuilder;
+
+ public void testResolveContentType() throws Exception {
+ URL artifactURL = getClass().getResource("test.scdl");
+ assertEquals(ContentType.COMPOSITE, contentTypeBuilder.getContentType(artifactURL, null));
+ }
+
+
+ public void testUnknownResolveContentType() throws Exception {
+ URL artifactURL = getClass().getResource("test.ext");
+ assertNull(contentTypeBuilder.getContentType(artifactURL, null));
+ }
+
+ public void testDefaultContentType() throws Exception {
+ URL artifactURL = getClass().getResource("test.ext");
+ assertEquals("application/vnd.tuscany.ext",
+ contentTypeBuilder.getContentType(artifactURL, "application/vnd.tuscany.ext"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ contentTypeBuilder = new ContentTypeDescriberImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionLoaderTestCase.java
new file mode 100644
index 0000000000..85e959cb87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionLoaderTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.core.services.deployment;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.loader.InvalidValueException;
+import org.apache.tuscany.spi.model.Contribution;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContributionLoaderTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns:Composite2\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns3:Composite1\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory factory;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = XMLInputFactory.newInstance();
+ }
+
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(VALID_XML));
+ ContributionLoader loader = new ContributionLoader(null);
+ Contribution contribution = loader.load(null, null, reader, null);
+ assertNotNull(contribution);
+ assertEquals(1, contribution.getImports().size());
+ assertEquals(1, contribution.getExports().size());
+ assertEquals(2, contribution.getDeployables().size());
+ }
+
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(INVALID_XML));
+ ContributionLoader loader = new ContributionLoader(null);
+ try {
+ loader.load(null, null, reader, null);
+ fail("InvalidException should have been thrown");
+ } catch (InvalidValueException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryTestCase.java
new file mode 100644
index 0000000000..0641520b3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionRepositoryTestCase.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.services.deployment;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.core.util.FileHelper;
+
+import junit.framework.TestCase;
+
+public class ContributionRepositoryTestCase extends TestCase {
+ private ContributionRepositoryImpl repository;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ // create repository (this should re-create the root directory)
+ this.repository = new ContributionRepositoryImpl("target/repository/");
+ repository.init();
+ }
+
+ public void testStore() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ URI contribution = URI.create("sample-calculator.jar");
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionStream);
+
+ URL contributionURL = repository.find(contribution);
+ assertNotNull(contributionURL);
+ }
+
+ public void testRemove() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ URI contribution = URI.create("sample-calculator.jar");
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionStream);
+
+ repository.remove(contribution);
+ URL contributionURL = repository.find(contribution);
+ assertNull(contributionURL);
+ }
+
+ public void testList() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ URI contribution = URI.create("sample-calculator.jar");
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionStream);
+
+ assertEquals(1, repository.list().size());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ FileHelper.deleteDirectory(new File("target/repository"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.java
new file mode 100644
index 0000000000..12c629f8a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/ContributionServiceImplTestCase.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.services.deployment;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.services.deployment.contribution.JarContributionProcessor;
+import org.apache.tuscany.core.services.deployment.contribution.JavaContributionProcessor;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.deployer.ContributionRepository;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceImplTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+ private ContributionRepository repository;
+ private ContentTypeDescriber contentTypeDescriber;
+ private ContributionProcessorRegistry registry;
+ private ContributionService contributionService;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+// this.repository = new ContributionRepositoryImpl("target/repository");
+//
+// this.contentTypeDescriber = new ContentTypeDescriberImpl();
+//
+// this.registry = new ContributionProcessorRegistryImpl(contentTypeDescriber);
+//
+// JarContributionProcessor jarProcessor = new JarContributionProcessor();
+// jarProcessor.setContributionProcessorRegistry(this.registry);
+// this.registry.register(JarContributionProcessor.CONTENT_TYPE, jarProcessor);
+//
+// JavaContributionProcessor javaProcessor = new JavaContributionProcessor(null);
+// javaProcessor.setContributionProcessorRegistry(this.registry);
+// this.registry.register(JavaContributionProcessor.CONTENT_TYPE, javaProcessor);
+//
+//
+// contributionService = new ContributionServiceImpl(repository, registry);
+ }
+
+ public void testContributeURL() throws Exception {
+// URL contribution = getClass().getResource(JAR_CONTRIBUTION);
+//
+// URI contributionURI = contributionService.contribute(contribution);
+// assertNotNull(contributionURI);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessorTestCase.java
new file mode 100644
index 0000000000..5d0b3227e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/CompositeContributionProcessorTestCase.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 org.apache.tuscany.core.services.deployment.contribution;
+
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
+import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
+import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
+import org.apache.tuscany.core.implementation.processor.InitProcessor;
+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.monitor.NullMonitorFactory;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+
+public class CompositeContributionProcessorTestCase extends TestCase {
+ private static final String CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String ARTIFACT_URL = "/META-INF/sca/default.scdl";
+ private IntrospectionRegistryImpl registry;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new IntrospectionRegistryImpl();
+ registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
+ registry.registerProcessor(new DestroyProcessor());
+ registry.registerProcessor(new InitProcessor());
+ registry.registerProcessor(new ScopeProcessor());
+ JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
+ ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
+ registry.registerProcessor(new PropertyProcessor(service));
+ registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+ registry.registerProcessor(new ResourceProcessor());
+ }
+
+ protected URL getArtifactURL() throws Exception {
+ URL jarURL = getClass().getResource(CONTRIBUTION);
+ JarInputStream jar = new JarInputStream(getClass().getResourceAsStream(CONTRIBUTION));
+ URL rootURL = new URL("jar:" + jarURL.toString() + "!/");
+ URL classURL = null;
+
+ try {
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry.getName().endsWith(".class")) {
+ classURL = new URL(rootURL, entry.getName());
+ break;
+ }
+ }
+ } finally {
+ jar.close();
+ }
+ return classURL;
+ }
+
+ public final void testProcessScdl() throws Exception {
+ //ContributionProcessor scdlContributionProcessor = new scdlContributionProcessor(registry);
+ //URL jarURL = this.getClassURL();
+ //javaContributionProcessor.processContent(null, jarURL, jarURL.openStream());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessorTestCase.java
new file mode 100644
index 0000000000..f6db2e8b7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/FolderContributionProcessorTestCase.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.services.deployment.contribution;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.model.Contribution;
+import org.easymock.EasyMock;
+
+public class FolderContributionProcessorTestCase extends TestCase {
+ private static final String DIRECTORY_CONTRIBUTION = "//D:/DEV/Projects/Tuscany/source/java-sca-integration/samples/sca/calculator";
+
+ private File contributionRoot;
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.contributionRoot = new File(DIRECTORY_CONTRIBUTION);
+ }
+
+ public final void testProcessJarArtifacts() throws Exception {
+// FolderContributionProcessor folderContribution = new FolderContributionProcessor();
+// ContributionProcessorRegistry mockRegistry = EasyMock.createMock(ContributionProcessorRegistry.class);
+// mockRegistry.register(FolderContributionProcessor.CONTENT_TYPE, folderContribution);
+// EasyMock.expectLastCall().anyTimes();
+// EasyMock.replay(mockRegistry);
+// folderContribution.setContributionProcessorRegistry(mockRegistry);
+// folderContribution.start();
+// EasyMock.verify(mockRegistry);
+//
+// Contribution contribution = new Contribution(URI.create("sca://contributions/001"));
+// contribution.setLocation(this.contributionRoot.toURL());
+// folderContribution.processContent(contribution, contribution.getUri(), null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.java
new file mode 100644
index 0000000000..06ccd6c3da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JarContributionProcessorTestCase.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.core.services.deployment.contribution;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.model.Contribution;
+import org.easymock.EasyMock;
+
+public class JarContributionProcessorTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public final void testProcessJarArtifacts() throws Exception {
+ /*
+ JarContributionProcessor jarContribution = new JarContributionProcessor();
+ ContributionProcessorRegistry mockRegistry = EasyMock.createMock(ContributionProcessorRegistry.class);
+ mockRegistry.register(JarContributionProcessor.CONTENT_TYPE, jarContribution);
+ EasyMock.expectLastCall().once();
+ EasyMock.replay(mockRegistry);
+ jarContribution.setContributionProcessorRegistry(mockRegistry);
+ jarContribution.start();
+ EasyMock.verify(mockRegistry);
+ URL jarURL = getClass().getResource(JarContributionProcessorTestCase.JAR_CONTRIBUTION);
+ Contribution contribution = new Contribution(URI.create("sca://contributions/001"));
+ contribution.setLocation(jarURL);
+ jarContribution.processContent(contribution, contribution.getUri(), jarURL.openStream());
+ */
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.java
new file mode 100644
index 0000000000..269e2e6feb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/deployment/contribution/JavaContributionProcessorTestCase.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.core.services.deployment.contribution;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.implementation.IntrospectionRegistryImpl;
+import org.apache.tuscany.core.implementation.processor.DestroyProcessor;
+import org.apache.tuscany.core.implementation.processor.ImplementationProcessorServiceImpl;
+import org.apache.tuscany.core.implementation.processor.InitProcessor;
+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.monitor.NullMonitorFactory;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.implementation.java.ImplementationProcessorService;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+public class JavaContributionProcessorTestCase extends TestCase {
+ private static final String CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String JAVA_ARTIFACT = "calculator/AddService.class";
+ private IntrospectionRegistryImpl registry;
+ private URI contributionId;
+ private Contribution contribution;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new IntrospectionRegistryImpl();
+ registry.setMonitor(new NullMonitorFactory().getMonitor(IntrospectionRegistryImpl.Monitor.class));
+ registry.registerProcessor(new DestroyProcessor());
+ registry.registerProcessor(new InitProcessor());
+ registry.registerProcessor(new ScopeProcessor());
+ JavaInterfaceProcessorRegistryImpl interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
+ ImplementationProcessorService service = new ImplementationProcessorServiceImpl(interfaceProcessorRegistry);
+ registry.registerProcessor(new PropertyProcessor(service));
+ registry.registerProcessor(new ReferenceProcessor(interfaceProcessorRegistry));
+ registry.registerProcessor(new ResourceProcessor());
+
+ contributionId = new URI("sca://contribution/001");
+ contribution = new Contribution(contributionId);
+ contribution.setLocation(getClass().getResource(CONTRIBUTION));
+
+ DeployedArtifact classArtifact = new DeployedArtifact(contributionId);
+ classArtifact.setLocation(this.getArtifactURL());
+ }
+
+ protected URL getArtifactURL() throws Exception {
+ URL jarURL = getClass().getResource(CONTRIBUTION);
+ return new URL("jar:" + jarURL.toString() + "!/" + JAVA_ARTIFACT);
+ }
+
+ public final void testProcessJavaArtifact() throws Exception {
+ //ContributionProcessor javaContributionProcessor = new JavaContributionProcessor(registry);
+ //URL artifactURL = this.getArtifactURL();
+ //javaContributionProcessor.processContent(contribution, artifactURL.toURI(), artifactURL.openStream());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistryTestCase.java
new file mode 100644
index 0000000000..c3eb2fa1bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/host/DelegatingResourceHostRegistryTestCase.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.host;
+
+import org.apache.tuscany.spi.host.ResourceHost;
+import org.apache.tuscany.spi.host.ResourceResolutionException;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DelegatingResourceHostRegistryTestCase extends TestCase {
+
+ public void testResolveByType() throws Exception {
+ Object ret = new Object();
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResource(Object.class, ret);
+ assertEquals(ret, registry.resolveResource(Object.class));
+ }
+
+ public void testResolveByUri() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(String.class, "Foo://foo")).andReturn("result");
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ assertEquals("result", registry.resolveResource(String.class, "Foo://foo"));
+ EasyMock.verify(host);
+ }
+
+ public void testResolveBySCAUri() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ Object ret = new Object();
+ registry.registerResource(Object.class, "foo", ret);
+ assertEquals(ret, registry.resolveResource(Object.class, "SCA://foo"));
+ EasyMock.verify(host);
+ }
+
+ public void testResolveByUriNotFound() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ try {
+ assertEquals("result", registry.resolveResource(String.class, "Bar://bar"));
+ fail();
+ } catch (ResourceResolutionException e) {
+ //expected
+ }
+ EasyMock.verify(host);
+ }
+
+ public void testUnregisterHost() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ registry.unregisterResourceHost("Foo://");
+ try {
+ registry.resolveResource(String.class, "Foo://foo");
+ fail();
+ } catch (ResourceResolutionException e) {
+ //expected
+ }
+ EasyMock.verify(host);
+ }
+
+ public void testUnregisterResource() throws Exception {
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResource(Object.class, new Object());
+ registry.unregisterResource(Object.class);
+ assertNull(registry.resolveResource(Object.class));
+ }
+
+ public void testUnregisterMappedResource() throws Exception {
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResource(Object.class, "foo", new Object());
+ registry.registerResource(Object.class, new Object());
+ registry.unregisterResource(Object.class);
+ assertNull(registry.resolveResource(Object.class));
+ assertNotNull(registry.resolveResource(Object.class, "foo"));
+ registry.unregisterResource(Object.class, "foo");
+ assertNull(registry.resolveResource(Object.class));
+ }
+
+ public void testReolvedByTypeToMappedResource() throws Exception {
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResource(Object.class, "foo", new Object());
+ assertNull(registry.resolveResource(Object.class));
+ }
+
+ public void testDelegatingResolveResource() throws Exception {
+ Object ret = new Object();
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(Object.class)).andReturn(ret);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ assertEquals(ret, registry.resolveResource(Object.class));
+ EasyMock.verify(host);
+ }
+
+ public void testDelegatingResolveResourceByTypeandName() throws Exception {
+ Object ret = new Object();
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(Object.class), EasyMock.eq("Foo://bar"))).andReturn(ret);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ assertEquals(ret, registry.resolveResource(Object.class, "Foo://bar"));
+ EasyMock.verify(host);
+ }
+
+ public void testResolveLocalResourceFirst() throws Exception {
+ Object local = new Object();
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.replay(host);
+ DelegatingResourceHostRegistry registry = new DelegatingResourceHostRegistry();
+ registry.registerResourceHost("Foo://", host);
+ registry.registerResource(Object.class, local);
+ assertEquals(local, registry.resolveResource(Object.class));
+ EasyMock.verify(host);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.java
new file mode 100644
index 0000000000..5ec1643b47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/store/memory/MemoryStoreTestCase.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.core.services.store.memory;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.services.store.DuplicateRecordException;
+import org.apache.tuscany.spi.services.store.Store;
+import org.apache.tuscany.spi.services.store.StoreExpirationEvent;
+import org.apache.tuscany.spi.services.store.StoreMonitor;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MemoryStoreTestCase extends TestCase {
+ private StoreMonitor monitor;
+
+ public void testEviction() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, 1);
+ Thread.sleep(100);
+ assertNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testNotifyOnEviction() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.isA(StoreExpirationEvent.class));
+ org.easymock.classextension.EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ return null;
+ }
+ });
+ EasyMock.replay(listener);
+ MemoryStore store = new MemoryStore(monitor);
+ store.addListener(listener);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, 1);
+ if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
+ // failed to notify listener
+ fail();
+ }
+ EasyMock.verify(listener);
+ }
+
+ public void testNoEviction() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ Thread.sleep(100);
+ assertNotNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testInsertRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.destroy();
+ }
+
+ public void testInsertAlreadyExists() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ try {
+ store.insertRecord(component, id, value, Store.NEVER);
+ fail();
+ } catch (DuplicateRecordException e) {
+ //expected
+ }
+ store.destroy();
+ }
+
+ public void testUpdateRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ Object newValue = new Object();
+
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.updateRecord(component, id, newValue, 1L);
+ assertEquals(newValue, store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testDeleteRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.removeRecord(component, id);
+ assertNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ monitor = EasyMock.createNiceMock(StoreMonitor.class);
+ EasyMock.replay(monitor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTest.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTest.java
new file mode 100644
index 0000000000..1a5cb4ebe1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTest.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.core.services.work.jsr237;
+
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+
+import commonj.work.WorkManager;
+import junit.framework.TestCase;
+import org.apache.tuscany.core.services.work.jsr237.workmanager.ThreadPoolWorkManager;
+
+public class Jsr237WorkSchedulerTest extends TestCase {
+
+ /*
+ * Test method for 'org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler.scheduleWork(T) <T>'
+ */
+ public void testScheduleWorkT() {
+
+
+ WorkManager workManager = new ThreadPoolWorkManager(1);
+ WorkScheduler workScheduler = new Jsr237WorkScheduler(workManager);
+
+ workScheduler.scheduleWork(new MyRunnable(), new MyNotificationListener());
+
+ }
+
+ /*
+ * Test method for 'org.apache.tuscany.core.services.work.jsr237.Jsr237WorkScheduler.scheduleWork(T,
+ * NotificationListener<T>) <T>'
+ */
+ public void testScheduleWorkTNotificationListenerOfT() {
+
+ }
+
+ private class MyRunnable implements Runnable {
+ public void run() {
+ System.err.println("Test executed");
+ }
+ }
+
+ private class MyNotificationListener implements NotificationListener<MyRunnable> {
+
+ public void workAccepted(MyRunnable work) {
+ System.err.println("Work accepted");
+ }
+
+ public void workCompleted(MyRunnable work) {
+ System.err.println("Work completed");
+ }
+
+ public void workStarted(MyRunnable work) {
+ System.err.println("Work started");
+ }
+
+ public void workRejected(MyRunnable work) {
+ System.err.println("Work rejected");
+ }
+
+ public void workFailed(MyRunnable work, Throwable error) {
+ System.err.println("Work failed");
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTestCase.java
new file mode 100644
index 0000000000..3966f65683
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/Jsr237WorkSchedulerTestCase.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.core.services.work.jsr237;
+
+import org.apache.tuscany.spi.services.work.NotificationListener;
+import org.apache.tuscany.spi.services.work.WorkSchedulerException;
+
+import commonj.work.Work;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Jsr237WorkSchedulerTestCase extends TestCase {
+
+ public void testSchedule() throws Exception {
+ WorkItem item = createMock(WorkItem.class);
+ WorkManager mgr = createMock(WorkManager.class);
+ mgr.schedule(isA(Work.class));
+ expectLastCall().andReturn(item);
+ replay(mgr);
+ Jsr237WorkScheduler scheduler = new Jsr237WorkScheduler(mgr);
+ Work work = createMock(Work.class);
+ scheduler.scheduleWork(work);
+ verify(mgr);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testListener() throws Exception {
+ WorkItem item = createMock(WorkItem.class);
+ WorkManager mgr = createMock(WorkManager.class);
+ mgr.schedule(isA(Work.class), isA(WorkListener.class));
+ expectLastCall().andReturn(item);
+ replay(mgr);
+ Jsr237WorkScheduler scheduler = new Jsr237WorkScheduler(mgr);
+ Work work = createMock(Work.class);
+ NotificationListener<Runnable> listener = createMock(NotificationListener.class);
+ scheduler.scheduleWork(work, listener);
+ verify(mgr);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWorkRejectedListener() throws Exception {
+ WorkManager mgr = createMock(WorkManager.class);
+ mgr.schedule(isA(Work.class), isA(WorkListener.class));
+ expectLastCall().andThrow(new WorkRejectedException());
+ replay(mgr);
+ Jsr237WorkScheduler scheduler = new Jsr237WorkScheduler(mgr);
+ Work work = createMock(Work.class);
+ NotificationListener<Runnable> listener = createMock(NotificationListener.class);
+ listener.workRejected(isA(Runnable.class));
+ expectLastCall();
+ replay(listener);
+ scheduler.scheduleWork(work, listener);
+ verify(mgr);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWorkRejectedNoListener() throws Exception {
+ WorkManager mgr = createMock(WorkManager.class);
+ mgr.schedule(isA(Work.class));
+ expectLastCall().andThrow(new WorkRejectedException());
+ replay(mgr);
+ Jsr237WorkScheduler scheduler = new Jsr237WorkScheduler(mgr);
+ Work work = createMock(Work.class);
+ try {
+ scheduler.scheduleWork(work);
+ fail();
+ } catch (WorkSchedulerException e) {
+ // expected
+ }
+ verify(mgr);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManagerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManagerTestCase.java
new file mode 100644
index 0000000000..33ecd66fdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/services/work/jsr237/workmanager/ThreadPoolWorkManagerTestCase.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.services.work.jsr237.workmanager;
+
+import java.util.concurrent.CountDownLatch;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkListener;
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ThreadPoolWorkManagerTestCase extends TestCase {
+
+ public void testSchedule() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ Work work = createMock(Work.class);
+ work.run();
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ return null;
+ }
+ });
+ replay(work);
+ ThreadPoolWorkManager mgr = new ThreadPoolWorkManager(1);
+ mgr.schedule(work);
+ latch.await();
+ verify(work);
+ }
+
+ public void testListener() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ WorkListener listener = createStrictMock(WorkListener.class);
+ listener.workAccepted(isA(WorkEvent.class));
+ listener.workStarted(isA(WorkEvent.class));
+ listener.workCompleted(isA(WorkEvent.class));
+ expectLastCall();
+ replay(listener);
+ Work work = createMock(Work.class);
+ work.run();
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ return null;
+ }
+ });
+ replay(work);
+ ThreadPoolWorkManager mgr = new ThreadPoolWorkManager(1);
+ mgr.schedule(work, listener);
+ latch.await();
+ verify(work);
+ }
+
+ public void testDelayListener() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ final CountDownLatch latch2 = new CountDownLatch(1);
+ WorkListener listener = createStrictMock(WorkListener.class);
+ listener.workAccepted(isA(WorkEvent.class));
+ listener.workStarted(isA(WorkEvent.class));
+ listener.workCompleted(isA(WorkEvent.class));
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch2.countDown();
+ return null;
+ }
+ });
+ replay(listener);
+ Work work = createMock(Work.class);
+ work.run();
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.await();
+ return null;
+ }
+ });
+ replay(work);
+ ThreadPoolWorkManager mgr = new ThreadPoolWorkManager(1);
+ mgr.schedule(work, listener);
+ latch.countDown();
+ verify(work);
+ }
+
+ public void testErrorListener() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ WorkListener listener = createStrictMock(WorkListener.class);
+ listener.workAccepted(isA(WorkEvent.class));
+ listener.workStarted(isA(WorkEvent.class));
+ listener.workCompleted(isA(WorkEvent.class));
+ replay(listener);
+ Work work = createMock(Work.class);
+ work.run();
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ throw new RuntimeException();
+ }
+ });
+ replay(work);
+ ThreadPoolWorkManager mgr = new ThreadPoolWorkManager(1);
+ mgr.schedule(work, listener);
+ latch.await();
+ verify(work);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean1.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean1.java
new file mode 100644
index 0000000000..79fad549aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean1.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.util;
+
+
+public class Bean1 extends SuperBean {
+
+ public static final int ALL_BEAN1_FIELDS = 6 + ALL_SUPER_FIELDS;
+ public static final int ALL_BEAN1_PUBLIC_PROTECTED_FIELDS = 5 + ALL_SUPER_PUBLIC_PROTECTED_FIELDS;
+ public static final int ALL_BEAN1_METHODS = 4 + ALL_SUPER_METHODS - 1;
+ public String field3;
+ protected String field2;
+ private String field1;
+
+ public void setMethod1(String param) {
+ }
+
+ public void setMethod1(int param) {
+ }
+
+ public void override(String param) throws Exception {
+ }
+
+
+ public void noOverride(String param) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean2.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean2.java
new file mode 100644
index 0000000000..7f7f03da9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/Bean2.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.util;
+
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+public class Bean2 {
+
+ private List methodList;
+ private List fieldList;
+
+ public List getMethodList() {
+ return methodList;
+ }
+
+ public void setMethodList(List list) {
+ methodList = list;
+ }
+
+ public List getfieldList() {
+ return fieldList;
+ }
+
+ public void setfieldList(List list) {
+ throw new AssertionFailedError("setter inadvertantly called");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java
new file mode 100644
index 0000000000..797b147b54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/JavaIntrospectionHelperTestCase.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.mock.component.Target;
+
+public class JavaIntrospectionHelperTestCase extends TestCase {
+
+ private List testNoGenericsList;
+ private List<String> testList;
+ private Map<String, Bean1> testMap;
+ private Target[] testArray;
+ private String[] testStringArray;
+
+ public JavaIntrospectionHelperTestCase() {
+ super();
+ }
+
+ public JavaIntrospectionHelperTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void testBean1AllPublicProtectedFields() throws Exception {
+ Set<Field> beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class);
+ assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS
+ }
+
+ public void testGetSuperAllMethods() throws Exception {
+ Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class);
+ assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size());
+ }
+
+ public void testGetBean1AllMethods() throws Exception {
+ Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size());
+ }
+
+ public void testOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ boolean invoked = false;
+ for (Method method : beanFields) {
+ if (method.getName().equals("override")) {
+ method.invoke(new Bean1(), "foo");
+ invoked = true;
+ }
+ }
+ if (!invoked) {
+ throw new Exception("Override never invoked");
+ }
+ }
+
+ public void testNoOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ boolean found = false;
+ for (Method method : beanFields) {
+ if (method.getName().equals("noOverride") && method.getParameterTypes().length == 0) {
+ found = true;
+ }
+ }
+ if (!found) {
+ throw new Exception("No override not found");
+ }
+ }
+
+ public void testDefaultConstructor() throws Exception {
+ Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class);
+ assertEquals(ctr, Bean2.class.getConstructor());
+ assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass());
+ }
+
+
+ public void testGetAllInterfaces() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Z.class);
+ assertEquals(2, interfaces.size());
+ assertTrue(interfaces.contains(W.class));
+ assertTrue(interfaces.contains(W2.class));
+ }
+
+
+ public void testGetAllInterfacesObject() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Object.class);
+ assertEquals(0, interfaces.size());
+ }
+
+ public void testGetAllInterfacesNoInterfaces() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(NoInterface.class);
+ assertEquals(0, interfaces.size());
+ }
+
+ /**
+ * Tests generics introspection capabilities
+ */
+ public void testGenerics() throws Exception {
+
+ List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType());
+ assertEquals(1, classes.size());
+ assertEquals(String.class, classes.get(0));
+
+ classes =
+ JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType());
+ assertEquals(0, classes.size());
+
+ classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType());
+ assertEquals(2, classes.size());
+ assertEquals(String.class, classes.get(0));
+ assertEquals(Bean1.class, classes.get(1));
+
+ classes = JavaIntrospectionHelper
+ .getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]);
+ assertEquals(2, classes.size());
+ assertEquals(String.class, classes.get(0));
+ assertEquals(Bean1.class, classes.get(1));
+
+ classes = JavaIntrospectionHelper
+ .getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]);
+ assertEquals(1, classes.size());
+ assertEquals(String.class, classes.get(0));
+
+ }
+
+ private void fooMethod(List<String> foo) {
+
+ }
+
+ private void fooMethod(Map<String, Bean1> foo) {
+
+ }
+
+ public void setTestArray(Target[] array) {
+ }
+
+ private interface W {
+
+ }
+
+ private interface W2 {
+
+ }
+
+ private class X implements W {
+
+ }
+
+ private class Y extends X implements W, W2 {
+
+ }
+
+ private class Z extends Y {
+
+ }
+
+ private class NoInterface {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/SuperBean.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/SuperBean.java
new file mode 100644
index 0000000000..83aef7fb5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/util/SuperBean.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.core.util;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SuperBean {
+
+ public static final int ALL_SUPER_FIELDS = 6;
+ public static final int ALL_SUPER_PUBLIC_PROTECTED_FIELDS = 5;
+ public static final int ALL_SUPER_METHODS = 4;
+ public String superField2;
+
+ protected String superField3;
+
+ private String superField1;
+
+ public void setSuperMethod1(String param) {
+ }
+
+ public void setSuperMethod1(int param) {
+ }
+
+ public void override(String param) throws Exception {
+ throw new Exception("Override not handled");
+ }
+
+ public void noOverride() throws Exception {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..b62741a7e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.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.wire;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class BasicReferenceInvocationHandlerTestCase extends TestCase {
+
+ private Method echo;
+
+ public void testInterceptorInvoke() throws Throwable {
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract = registry.introspect(SimpleTarget.class);
+ Operation<?> operation = contract.getOperations().get("echo");
+ MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ chain.addInterceptor(interceptor);
+ chain.setTargetInterceptor(new InvokerInterceptor());
+ chain.setTargetInvoker(invoker);
+ chain.prepare();
+ //chains.put(echo, chain);
+ OutboundWire wire = new OutboundWireImpl();
+ wire.addInvocationChain(operation, chain);
+ wire.setServiceContract(contract);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
+ assertEquals("foo", handler.invoke(null, echo, new String[]{"foo"}));
+ assertEquals(1, interceptor.getCount());
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ echo = SimpleTarget.class.getMethod("echo", String.class);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.java
new file mode 100644
index 0000000000..6c50cb406f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptorTestCase.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.wire;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackInterfaceInterceptorTestCase extends TestCase {
+
+ public void testOptimize() throws Exception {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true);
+ assertFalse(interceptor.isOptimizable());
+ }
+
+ public void testImplements() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true);
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
+ EasyMock.replay(next);
+ interceptor.setNext(next);
+ interceptor.invoke(new MessageImpl());
+ EasyMock.verify(next);
+ }
+
+ public void testDoesNotImplement() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(false);
+ try {
+ interceptor.invoke(new MessageImpl());
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java
new file mode 100644
index 0000000000..d200b983b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java
@@ -0,0 +1,401 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+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.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+
+/**
+ * TODO some tests commented out due to DataType.equals() needing to be strict
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContractCompatibilityTestCase extends TestCase {
+
+ private WireService wireService = new MockWireService();
+
+ public void testNoOperation() throws Exception {
+ ServiceContract source = new MockContract<Type>("FooContract");
+ ServiceContract target = new MockContract<Type>("FooContract");
+ wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testBasic() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ Operation<Type> opSource1 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ Operation<Type> opSource2 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opSource2);
+ target.setOperations(targetOperations);
+ wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testBasicIncompatibleOperationNames() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ Operation<Type> opSource1 = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ Operation<Type> opSource2 = new Operation<Type>("op2", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op2", opSource2);
+ target.setOperations(targetOperations);
+ try {
+ wireService.checkCompatibility(source, target, false);
+ fail();
+ } catch (IncompatibleServiceContractException e) {
+ //expected
+ }
+ }
+
+ public void testInputTypes() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>();
+ sourceInputTypes.add(new DataType<Type>(Object.class, Object.class));
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes);
+ Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>();
+ targetInputTypes.add(new DataType<Type>(Object.class, Object.class));
+ DataType<List<DataType<Type>>> targetInputType =
+ new DataType<List<DataType<Type>>>(String.class, targetInputTypes);
+
+ Operation<Type> opTarget =
+ new Operation<Type>("op1", targetInputType, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ wireService.checkCompatibility(source, target, false);
+ }
+
+
+ public void testIncompatibleInputTypes() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>();
+ sourceInputTypes.add(new DataType<Type>(Integer.class, Integer.class));
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes);
+ Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>();
+ targetInputTypes.add(new DataType<Type>(String.class, String.class));
+ DataType<List<DataType<Type>>> targetInputType =
+ new DataType<List<DataType<Type>>>(String.class, targetInputTypes);
+
+ Operation<Type> opTarget =
+ new Operation<Type>("op1", targetInputType, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ try {
+ wireService.checkCompatibility(source, target, false);
+ fail();
+ } catch (IncompatibleServiceContractException e) {
+ //expected
+ }
+ }
+
+ /**
+ * Verfies source input types can be super types of the target
+ */
+ public void testSourceSuperTypeInputCompatibility() throws Exception {
+// ServiceContract<Type> source = new MockContract<Type>("FooContract");
+// List<DataType<Type>> sourceInputTypes = new ArrayList<DataType<Type>>();
+// sourceInputTypes.add(new DataType<Type>(Object.class, Object.class));
+// DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(String.class, sourceInputTypes);
+// Operation<Type> opSource1 = new Operation<Type>("op1", inputType, null, null, false, null);
+// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+// sourceOperations.put("op1", opSource1);
+// source.setOperations(sourceOperations);
+//
+// ServiceContract<Type> target = new MockContract<Type>("FooContract");
+// List<DataType<Type>> targetInputTypes = new ArrayList<DataType<Type>>();
+// targetInputTypes.add(new DataType<Type>(String.class, String.class));
+// DataType<List<DataType<Type>>> targetInputType =
+// new DataType<List<DataType<Type>>>(String.class, targetInputTypes);
+//
+// Operation<Type> opTarget = new Operation<Type>("op1", targetInputType, null, null, false, null);
+// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+// targetOperations.put("op1", opTarget);
+// target.setOperations(targetOperations);
+// wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testOutputTypes() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ DataType<Type> sourceOutputType = new DataType<Type>(String.class, String.class);
+ Operation<Type> opSource1 =
+ new Operation<Type>("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ DataType<Type> targetOutputType = new DataType<Type>(String.class, String.class);
+ Operation<Type> opTarget =
+ new Operation<Type>("op1", null, targetOutputType, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ wireService.checkCompatibility(source, target, false);
+ }
+
+ /**
+ * Verfies a return type that is a supertype of of the target is compatible
+ */
+ public void testSupertypeOutputTypes() throws Exception {
+// ServiceContract<Type> source = new MockContract<Type>("FooContract");
+// DataType<Type> sourceOutputType = new DataType<Type>(Object.class, Object.class);
+// Operation<Type> opSource1 = new Operation<Type>("op1", null, sourceOutputType, null, false, null);
+// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+// sourceOperations.put("op1", opSource1);
+// source.setOperations(sourceOperations);
+//
+// ServiceContract<Type> target = new MockContract<Type>("FooContract");
+// DataType<Type> targetOutputType = new DataType<Type>(String.class, String.class);
+// Operation<Type> opTarget = new Operation<Type>("op1", null, targetOutputType, null, false, null);
+// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+// targetOperations.put("op1", opTarget);
+// target.setOperations(targetOperations);
+// wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testIncompatibleOutputTypes() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ DataType<Type> sourceOutputType = new DataType<Type>(String.class, String.class);
+ Operation<Type> opSource1 =
+ new Operation<Type>("op1", null, sourceOutputType, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ DataType<Type> targetOutputType = new DataType<Type>(Integer.class, Integer.class);
+ Operation<Type> opTarget =
+ new Operation<Type>("op1", null, targetOutputType, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ try {
+ wireService.checkCompatibility(source, target, false);
+ fail();
+ } catch (IncompatibleServiceContractException e) {
+ //expected
+ }
+ }
+
+ public void testFaultTypes() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ DataType<Type> sourceFaultType = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation<Type> opSource1 =
+ new Operation<Type>("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ DataType<Type> targetFaultType = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>();
+ targetFaultTypes.add(0, targetFaultType);
+
+ Operation<Type> opTarget =
+ new Operation<Type>("op1", null, null, targetFaultTypes, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
+ ServiceContract<Type> source = new MockContract<Type>("FooContract");
+ DataType<Type> sourceFaultType = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation<Type> opSource1 =
+ new Operation<Type>("op1", null, null, sourceFaultTypes, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+ sourceOperations.put("op1", opSource1);
+ source.setOperations(sourceOperations);
+
+ ServiceContract<Type> target = new MockContract<Type>("FooContract");
+ Operation<Type> opTarget = new Operation<Type>("op1", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+ targetOperations.put("op1", opTarget);
+ target.setOperations(targetOperations);
+ wireService.checkCompatibility(source, target, false);
+ }
+
+ /**
+ * Verifies a source's fault which is a supertype of the target's fault are compatibile
+ *
+ * @throws Exception
+ */
+ public void testFaultSuperTypes() throws Exception {
+// ServiceContract<Type> source = new MockContract<Type>("FooContract");
+// DataType<Type> sourceFaultType = new DataType<Type>(Exception.class, Exception.class);
+// List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>();
+// sourceFaultTypes.add(0, sourceFaultType);
+// Operation<Type> opSource1 = new Operation<Type>("op1", null, null, sourceFaultTypes, false, null);
+// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+// sourceOperations.put("op1", opSource1);
+// source.setOperations(sourceOperations);
+//
+// ServiceContract<Type> target = new MockContract<Type>("FooContract");
+// DataType<Type> targetFaultType = new DataType<Type>(TuscanyException.class, TuscanyException.class);
+// List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>();
+// targetFaultTypes.add(0, targetFaultType);
+//
+// Operation<Type> opTarget = new Operation<Type>("op1", null, null, targetFaultTypes, false, null);
+// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+// targetOperations.put("op1", opTarget);
+// target.setOperations(targetOperations);
+// wireService.checkCompatibility(source, target, false);
+ }
+
+ /**
+ * Verifies a source's faults which are supertypes and a superset of the target's faults are compatibile
+ */
+ public void testFaultSuperTypesAndSuperset() throws Exception {
+// ServiceContract<Type> source = new MockContract<Type>("FooContract");
+// DataType<Type> sourceFaultType = new DataType<Type>(Exception.class, Exception.class);
+// DataType<Type> sourceFaultType2 = new DataType<Type>(RuntimeException.class, RuntimeException.class);
+// List<DataType<Type>> sourceFaultTypes = new ArrayList<DataType<Type>>();
+// sourceFaultTypes.add(0, sourceFaultType);
+// sourceFaultTypes.add(1, sourceFaultType2);
+// Operation<Type> opSource1 = new Operation<Type>("op1", null, null, sourceFaultTypes, false, null);
+// Map<String, Operation<Type>> sourceOperations = new HashMap<String, Operation<Type>>();
+// sourceOperations.put("op1", opSource1);
+// source.setOperations(sourceOperations);
+//
+// ServiceContract<Type> target = new MockContract<Type>("FooContract");
+// DataType<Type> targetFaultType = new DataType<Type>(TuscanyException.class, TuscanyException.class);
+// List<DataType<Type>> targetFaultTypes = new ArrayList<DataType<Type>>();
+// targetFaultTypes.add(0, targetFaultType);
+//
+// Operation<Type> opTarget = new Operation<Type>("op1", null, null, targetFaultTypes, false, null);
+// Map<String, Operation<Type>> targetOperations = new HashMap<String, Operation<Type>>();
+// targetOperations.put("op1", opTarget);
+// target.setOperations(targetOperations);
+// wireService.checkCompatibility(source, target, false);
+ }
+
+ private class MockContract<T> extends ServiceContract<T> {
+ public MockContract() {
+ }
+
+ public MockContract(Class interfaceClass) {
+ super(interfaceClass);
+ }
+
+ public MockContract(String interfaceName) {
+ super(interfaceName);
+ }
+ }
+
+ private class MockWireService extends WireServiceExtension {
+ public MockWireService() {
+ super(null, null);
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, OutboundChainHolder> mapping)
+ throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+
+ public WireInvocationHandler createHandler(Class<?> interfaze, Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public OutboundInvocationChain createOutboundChain(Operation<?> operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public InboundInvocationChain createInboundChain(Operation<?> operation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public InboundWire createWire(ServiceDefinition service) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void createWires(AtomicComponent component, ComponentDefinition<?> definition) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract,
+ QualifiedName targetName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void createWires(ServiceBinding serviceBinding, ServiceContract<?> contract, String targetName) {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java
new file mode 100644
index 0000000000..39e1bf0b46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InboundInvocationErrorTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.jdk.JDKInboundInvocationHandler;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Tests handling of exceptions thrown during an inbound wire invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InboundInvocationErrorTestCase extends TestCase {
+ private Method checkedMethod;
+ private Method runtimeMethod;
+ private Operation checkedOperation;
+ private Operation runtimeOperation;
+
+ public InboundInvocationErrorTestCase() {
+ super();
+ }
+
+ public InboundInvocationErrorTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ checkedMethod =
+ TestBean.class.getDeclaredMethod("checkedException", (Class[]) null);
+ runtimeMethod =
+ TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null);
+ assertNotNull(checkedMethod);
+ assertNotNull(runtimeMethod);
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(TestBean.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+
+ checkedOperation = contract.getOperations().get("checkedException");
+ runtimeOperation = contract.getOperations().get("runtimeException");
+ }
+
+ public void testCheckedException() throws Exception {
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+
+ Operation<Type> operation =
+ new Operation<Type>("checkedException", null, null, null, false, null, NO_CONVERSATION);
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(operation, createChain(checkedMethod, checkedOperation));
+ InboundWire wire = new InboundWireImpl();
+ wire.addInvocationChains(chains);
+ wire.setServiceContract(new ServiceContract<TestBean>(TestBean.class) {
+ });
+
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(TestBean.class, wire, workContext);
+ try {
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ TestBean proxy = (TestBean) Proxy.newProxyInstance(ccl, new Class[]{TestBean.class}, handler);
+ proxy.checkedException();
+ } catch (InboundInvocationErrorTestCase.TestException e) {
+ return;
+ }
+ fail(InboundInvocationErrorTestCase.TestException.class.getName() + " should have been thrown");
+ }
+
+ public void testRuntimeException() throws Exception {
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+
+ Operation<Type> operation =
+ new Operation<Type>("runtimeException", null, null, null, false, null, NO_CONVERSATION);
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(operation, createChain(runtimeMethod, runtimeOperation));
+ InboundWire wire = new InboundWireImpl();
+ wire.addInvocationChains(chains);
+ wire.setServiceContract(new ServiceContract<TestBean>(TestBean.class) {
+ });
+
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(TestBean.class, wire, workContext);
+ try {
+ InboundInvocationErrorTestCase.TestBean proxy = (InboundInvocationErrorTestCase.TestBean) Proxy
+ .newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[]{InboundInvocationErrorTestCase.TestBean.class}, handler);
+ proxy.runtimeException();
+ } catch (InboundInvocationErrorTestCase.TestRuntimeException e) {
+ return;
+ }
+ fail(InboundInvocationErrorTestCase.TestException.class.getName() + " should have been thrown");
+ }
+
+ private InboundInvocationChain createChain(Method m, Operation operation) {
+ MockStaticInvoker invoker = new MockStaticInvoker(m, new TestBeanImpl());
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new MockSyncInterceptor());
+ chain.setTargetInvoker(invoker);
+ chain.addInterceptor(new InvokerInterceptor());
+ chain.prepare();
+ return chain;
+ }
+
+ public interface TestBean {
+
+ void checkedException() throws TestException;
+
+ void runtimeException() throws TestRuntimeException;
+
+ }
+
+ public class TestBeanImpl implements TestBean {
+
+ public void checkedException() throws InboundInvocationErrorTestCase.TestException {
+ throw new TestException();
+ }
+
+ public void runtimeException() throws TestRuntimeException {
+ throw new TestRuntimeException();
+ }
+ }
+
+ public class TestException extends Exception {
+ }
+
+ public class TestRuntimeException extends RuntimeException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java
new file mode 100644
index 0000000000..a9f455bc62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/IncompatibleServiceContractExceptionFormatterTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.host.monitor.FormatterRegistry;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleServiceContractExceptionFormatterTestCase extends TestCase {
+ FormatterRegistry registry = EasyMock.createNiceMock(FormatterRegistry.class);
+ IncompatibleServiceContractExceptionFormatter formatter =
+ new IncompatibleServiceContractExceptionFormatter(registry);
+
+ public void testFormat() throws Exception {
+ ServiceContract<Object> source = new ServiceContract<Object>() {
+ };
+ source.setInterfaceName("sourceInterface");
+ ServiceContract<Object> target = new ServiceContract<Object>() {
+ };
+ target.setInterfaceName("targetInterface");
+ Operation<Object> sourceOp = new Operation<Object>("sourceOp", null, null, null);
+ Operation<Object> targetOp = new Operation<Object>("targetOp", null, null, null);
+
+ IncompatibleServiceContractException e =
+ new IncompatibleServiceContractException("message", source, target, sourceOp, targetOp);
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ String buffer = writer.toString();
+ assertTrue(buffer.indexOf("message") >= 0);
+ assertTrue(buffer.indexOf("sourceInterface") >= 0);
+ assertTrue(buffer.indexOf("targetInterface") >= 0);
+ assertTrue(buffer.indexOf("sourceOp") >= 0);
+ assertTrue(buffer.indexOf("targetOp") >= 0);
+ }
+
+
+ public void testFormatNulls() throws Exception {
+ ServiceContract<Object> source = new ServiceContract<Object>() {
+ };
+ source.setInterfaceName("sourceInterface");
+ ServiceContract<Object> target = new ServiceContract<Object>() {
+ };
+ target.setInterfaceName("targetInterface");
+
+ IncompatibleServiceContractException e =
+ new IncompatibleServiceContractException("message", source, target);
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ String buffer = writer.toString();
+ assertTrue(buffer.indexOf("message") >= 0);
+ assertTrue(buffer.indexOf("sourceInterface") >= 0);
+ assertTrue(buffer.indexOf("targetInterface") >= 0);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.java
new file mode 100644
index 0000000000..294e98997f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationChainImplTestCase.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.core.wire;
+
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImplTestCase extends TestCase {
+
+ public void testInsertAtPos() throws Exception {
+ MockChain chain = new MockChain(new Operation<Type>("foo", null, null, null));
+ Interceptor inter3 = new MockInterceptor();
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter1 = new MockInterceptor();
+ chain.addInterceptor(inter3);
+ chain.addInterceptor(0, inter1);
+ chain.addInterceptor(1, inter2);
+ Interceptor head = chain.getHeadInterceptor();
+ assertEquals(inter1, head);
+ assertEquals(inter2, head.getNext());
+ assertEquals(inter3, head.getNext().getNext());
+ }
+
+ public void testInsertAtEnd() throws Exception {
+ MockChain chain = new MockChain(new Operation<Type>("foo", null, null, null));
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter1 = new MockInterceptor();
+ chain.addInterceptor(0, inter1);
+ chain.addInterceptor(1, inter2);
+ Interceptor head = chain.getHeadInterceptor();
+ assertEquals(inter1, head);
+ assertEquals(inter2, head.getNext());
+ assertEquals(inter2, chain.getTailInterceptor());
+
+ }
+
+ private class MockChain extends InvocationChainImpl {
+
+ public MockChain(Operation operation) {
+ super(operation);
+ }
+
+ public void prepare() {
+
+ }
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ private Interceptor next;
+
+ public Message invoke(Message msg) {
+ return null;
+ }
+
+ public void setNext(Interceptor next) {
+ this.next = next;
+ }
+
+ public Interceptor getNext() {
+ return next;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java
new file mode 100644
index 0000000000..aca68a0f25
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+
+/**
+ * Tests error propagation through an innvocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationConfigurationErrorTestCase extends TestCase {
+
+ private ServiceContract<?> contract;
+ private Method hello;
+
+ public InvocationConfigurationErrorTestCase() {
+ super();
+ }
+
+ public InvocationConfigurationErrorTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ contract = registry.introspect(SimpleTarget.class);
+ hello = SimpleTarget.class.getMethod("hello", String.class);
+ }
+
+ /**
+ * Tests basic wiring of a source to a target, including handlers and interceptors
+ */
+ public void testInvokeWithInterceptors() throws Exception {
+ Operation operation = contract.getOperations().get("hello");
+ OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addInterceptor(sourceInterceptor);
+
+ InboundInvocationChain target = new InboundInvocationChainImpl(operation);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addInterceptor(targetInterceptor);
+ target.addInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.setTargetInterceptor(target.getHeadInterceptor());
+ source.prepare();
+ target.prepare();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ Message response = source.getHeadInterceptor().invoke(msg);
+ assertTrue(response.isFault());
+ assertTrue(response.getBody() instanceof IllegalArgumentException);
+ assertEquals(1, sourceInterceptor.getCount());
+ assertEquals(1, targetInterceptor.getCount());
+
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java
new file mode 100644
index 0000000000..62df732a9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+
+public class InvocationConfigurationTestCase extends TestCase {
+
+ private Method hello;
+ private Operation operation;
+
+
+ public InvocationConfigurationTestCase() {
+ super();
+ }
+
+ public InvocationConfigurationTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(SimpleTarget.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+
+ operation = contract.getOperations().get("echo");
+ hello = SimpleTarget.class.getMethod("hello", String.class);
+ }
+
+ /**
+ * Tests basic wiring of a source to a target, including handlers and interceptors
+ */
+ public void testInvokeWithInterceptors() throws Exception {
+ OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addInterceptor(sourceInterceptor);
+
+ InboundInvocationChain target = new InboundInvocationChainImpl(operation);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addInterceptor(targetInterceptor);
+ target.addInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.setTargetInterceptor(target.getHeadInterceptor());
+ source.prepare();
+ target.prepare();
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ Message msg = new MessageImpl();
+ msg.setBody("foo");
+ msg.setTargetInvoker(invoker);
+ Message response = source.getHeadInterceptor().invoke(msg);
+ assertEquals("foo", response.getBody());
+ assertEquals(1, sourceInterceptor.getCount());
+ assertEquals(1, targetInterceptor.getCount());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptorTestCase.java
new file mode 100644
index 0000000000..1755fe9d15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/NonBlockingBridgingInterceptorTestCase.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.wire;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NonBlockingBridgingInterceptorTestCase extends TestCase {
+
+ public void testInvoke() throws Exception {
+ WorkScheduler scheduler = createMock(WorkScheduler.class);
+ scheduler.scheduleWork(isA(Runnable.class));
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ Runnable runnable = (Runnable) getCurrentArguments()[0];
+ runnable.run();
+ return null;
+ }
+ });
+ replay(scheduler);
+ WorkContext context = createMock(WorkContext.class);
+ String convID = "convID";
+ EasyMock.expect(context.getIdentifier(Scope.CONVERSATION)).andReturn(convID);
+ context.setCurrentCorrelationId(null);
+ context.setIdentifier(Scope.CONVERSATION, convID);
+ EasyMock.replay(context);
+ Message msg = new MessageImpl();
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(next);
+ Interceptor interceptor = new NonBlockingBridgingInterceptor(scheduler, context, next);
+ interceptor.invoke(msg);
+ verify(context);
+ verify(next);
+ }
+
+ public void testOptimizable() {
+ NonBlockingBridgingInterceptor interceptor = new NonBlockingBridgingInterceptor(null, null);
+ assertFalse(interceptor.isOptimizable());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.java
new file mode 100644
index 0000000000..e0f094a83e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OptimizedWireObjectFactoryTestCase.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.core.wire;
+
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OptimizedWireObjectFactoryTestCase extends TestCase {
+
+ public void testGetInstance() throws Exception {
+ Foo foo = new Foo();
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.getTargetService()).andReturn(foo);
+ EasyMock.replay(wire);
+ OptimizedWireObjectFactory factory = new OptimizedWireObjectFactory(wire);
+ assertEquals(foo, factory.getInstance());
+ EasyMock.verify(wire);
+ }
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java
new file mode 100644
index 0000000000..42caa6eed7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.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.core.wire;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+
+/**
+ * Tests handling of exceptions thrown during an outbound wire invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class OutboundInvocationErrorTestCase extends TestCase {
+
+ private Method checkedMethod;
+ private Method runtimeMethod;
+ private JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+
+ public OutboundInvocationErrorTestCase() {
+ super();
+ }
+
+ public OutboundInvocationErrorTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null);
+ runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null);
+ assertNotNull(checkedMethod);
+ assertNotNull(runtimeMethod);
+ }
+
+ public void testCheckedException() throws Exception {
+ OutboundWire wire = new OutboundWireImpl();
+ ServiceContract<?> contract = registry.introspect(TestBean.class);
+ wire.setServiceContract(contract);
+ Operation operation = contract.getOperations().get("checkedException");
+ wire.addInvocationChain(operation, createChain(checkedMethod, operation));
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(TestBean.class, wire, null);
+ try {
+ TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[]{TestBean.class}, handler);
+ proxy.checkedException();
+ } catch (TestException e) {
+ return;
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ public void testRuntimeException() throws Exception {
+ OutboundWire wire = new OutboundWireImpl();
+ ServiceContract<?> contract = registry.introspect(TestBean.class);
+ wire.setServiceContract(contract);
+ Operation operation = contract.getOperations().get("runtimeException");
+ OutboundInvocationChain chain = createChain(runtimeMethod, operation);
+ wire.addInvocationChain(operation, chain);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(TestBean.class, wire, null);
+ try {
+ TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[]{TestBean.class}, handler);
+ proxy.runtimeException();
+ } catch (TestRuntimeException e) {
+ return;
+ }
+ fail(TestException.class.getName() + " should have been thrown");
+ }
+
+ private OutboundInvocationChain createChain(Method m, Operation operation) {
+ MockStaticInvoker invoker = new MockStaticInvoker(m, new TestBeanImpl());
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ chain.addInterceptor(new MockSyncInterceptor());
+ chain.setTargetInvoker(invoker);
+ chain.setTargetInterceptor(new InvokerInterceptor());
+ chain.prepare();
+ return chain;
+ }
+
+ public interface TestBean {
+
+ void checkedException() throws TestException;
+
+ void runtimeException() throws TestRuntimeException;
+
+ }
+
+ public class TestBeanImpl implements TestBean {
+
+ public void checkedException() throws TestException {
+ throw new TestException();
+ }
+
+ public void runtimeException() throws TestRuntimeException {
+ throw new TestRuntimeException();
+ }
+ }
+
+ public class TestException extends Exception {
+ }
+
+ public class TestRuntimeException extends RuntimeException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..70d85445ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.java.JavaIDLUtils;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.jdk.JDKOutboundInvocationHandler;
+
+public class OutboundInvocationHandlerTestCase extends TestCase {
+
+ private Method hello;
+ private ServiceContract<?> contract;
+
+ public OutboundInvocationHandlerTestCase() {
+ super();
+ }
+
+ public OutboundInvocationHandlerTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ contract = registry.introspect(SimpleTarget.class);
+ hello = SimpleTarget.class.getMethod("hello", String.class);
+ }
+
+ public void testBasicInvoke() throws Throwable {
+ OutboundWire wire = new OutboundWireImpl();
+ Operation operation = contract.getOperations().get("hello");
+ wire.addInvocationChain(operation, createChain(operation));
+ wire.setServiceContract(contract);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
+ assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
+ }
+
+ public void testErrorInvoke() throws Throwable {
+ OutboundWire wire = new OutboundWireImpl();
+ Operation operation = contract.getOperations().get("hello");
+ wire.addInvocationChain(operation, createChain(operation));
+ wire.setServiceContract(contract);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
+ try {
+ handler.invoke(hello, new Object[]{});
+ fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ // should throw
+ }
+ }
+
+ public void testDirectErrorInvoke() throws Throwable {
+ Operation operation = contract.getOperations().get("hello");
+ OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setServiceContract(contract);
+ wire.addInvocationChain(operation, source);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
+ try {
+ assertEquals("foo", handler.invoke(hello, new Object[]{}));
+ fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ // should throw
+ }
+ }
+
+ public void testDirectInvoke() throws Throwable {
+ Operation operation = contract.getOperations().get("hello");
+ OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setServiceContract(contract);
+ wire.addInvocationChain(operation, source);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
+ assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
+ }
+
+ private OutboundInvocationChain createChain(Operation operation) {
+ OutboundInvocationChain source = new OutboundInvocationChainImpl(operation);
+ MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
+ source.addInterceptor(sourceInterceptor);
+
+ InboundInvocationChain target = new InboundInvocationChainImpl(operation);
+ MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
+ target.addInterceptor(targetInterceptor);
+ target.addInterceptor(new InvokerInterceptor());
+
+ // connect the source to the target
+ source.setTargetInterceptor(targetInterceptor);
+ source.prepare();
+ target.prepare();
+ Method method = JavaIDLUtils.findMethod(operation, SimpleTarget.class.getMethods());
+ MockStaticInvoker invoker = new MockStaticInvoker(method, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+ return source;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundWireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundWireTestCase.java
new file mode 100644
index 0000000000..9d0de99ed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundWireTestCase.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.wire;
+
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OutboundWireTestCase extends TestCase {
+
+ /**
+ * Tests that the target wire returns null if there is no connected wire. This behavior is needed for optional
+ * autowires.
+ */
+ public void testGetNonExistentTargetService() throws Exception {
+ OutboundWire wire = new OutboundWireImpl();
+ assertNull(wire.getTargetService());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptorTestCase.java
new file mode 100644
index 0000000000..f1631fc555
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/SynchronousBridgingInterceptorTestCase.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.core.wire;
+
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.verify;
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SynchronousBridgingInterceptorTestCase extends TestCase {
+
+ public void testInvoke() throws Exception {
+ Message msg = new MessageImpl();
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(next);
+ Interceptor interceptor = new SynchronousBridgingInterceptor(next);
+ interceptor.invoke(msg);
+ verify(next);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java
new file mode 100644
index 0000000000..537ca21656
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+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.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.WireService;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactoryTestCase extends TestCase {
+
+ @SuppressWarnings({"unchecked"})
+ public void testCreateInstance() throws Exception {
+ Operation<Type> op = new Operation<Type>("hello", null, null, null);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(op);
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
+ chains.put(op, chain);
+ EasyMock.expect(wire.getInvocationChains()).andReturn(chains);
+ EasyMock.expect(wire.isOptimizable()).andReturn(false);
+ EasyMock.replay(wire);
+ WireService service = EasyMock.createMock(WireService.class);
+ service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class));
+ EasyMock.expectLastCall().andReturn(new Foo() {
+ public void hello() {
+
+ }
+ });
+ EasyMock.replay(service);
+
+ WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service);
+ factory.getInstance();
+ EasyMock.verify(service);
+ EasyMock.verify(wire);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testOptimizedCreateInstance() throws Exception {
+ ServiceContract<?> contract = new JavaServiceContract(Foo.class);
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.isOptimizable()).andReturn(true);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap());
+ EasyMock.expect(wire.getTargetService()).andReturn(new Foo() {
+ public void hello() {
+ }
+ });
+ EasyMock.replay(wire);
+ WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, null);
+ factory.getInstance();
+ EasyMock.verify(wire);
+
+ }
+
+ /**
+ * Verifies that a proxy is created when the required client contract is different than the wire contract
+ */
+ @SuppressWarnings("unchecked")
+ public void testCannotOptimizeDifferentContractsCreateInstance() throws Exception {
+ ServiceContract<?> contract = new JavaServiceContract(Object.class);
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.isOptimizable()).andReturn(true);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap());
+ EasyMock.replay(wire);
+ WireService service = EasyMock.createMock(WireService.class);
+ service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class));
+ EasyMock.expectLastCall().andReturn(new Foo() {
+ public void hello() {
+
+ }
+ });
+ EasyMock.replay(service);
+
+ WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service);
+ factory.getInstance();
+ EasyMock.verify(service);
+ EasyMock.verify(wire);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testNoJavaInterfaceCreateInstance() throws Exception {
+ ServiceContract<?> contract = new JavaServiceContract();
+ OutboundWire wire = EasyMock.createMock(OutboundWire.class);
+ EasyMock.expect(wire.isOptimizable()).andReturn(true);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn((Map) Collections.emptyMap());
+ EasyMock.replay(wire);
+ WireService service = EasyMock.createMock(WireService.class);
+ service.createProxy(EasyMock.eq(Foo.class), EasyMock.eq(wire), EasyMock.isA(Map.class));
+ EasyMock.expectLastCall().andReturn(new Foo() {
+ public void hello() {
+
+ }
+ });
+ EasyMock.replay(service);
+
+ WireObjectFactory<Foo> factory = new WireObjectFactory<Foo>(Foo.class, wire, service);
+ factory.getInstance();
+ EasyMock.verify(service);
+ EasyMock.verify(wire);
+ }
+
+ private interface Foo {
+ void hello();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java
new file mode 100644
index 0000000000..c0d40c6369
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+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.Message;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * Verifies wire optimization analysis
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class WireOptimizationTestCase extends TestCase {
+ private Operation operation;
+
+ public void foo() {
+ }
+
+ public void testSourceWireInterceptorOptimization() throws Exception {
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setContainer(component);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ chain.addInterceptor(new OptimizableInterceptor());
+ wire.addInvocationChain(operation, chain);
+ assertTrue(WireUtils.isOptimizable(wire));
+ }
+
+ public void testSourceWireNonInterceptorOptimization() throws Exception {
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ OutboundWire wire = new OutboundWireImpl();
+ wire.setContainer(component);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ chain.addInterceptor(new NonOptimizableInterceptor());
+ wire.addInvocationChain(operation, chain);
+ assertFalse(WireUtils.isOptimizable(wire));
+ }
+
+ public void testTargetWireInterceptorOptimization() throws Exception {
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.expect(component.isOptimizable()).andReturn(true);
+ EasyMock.replay(component);
+ InboundWire wire = new InboundWireImpl();
+ wire.setContainer(component);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new OptimizableInterceptor());
+ wire.addInvocationChain(operation, chain);
+ assertTrue(WireUtils.isOptimizable(wire));
+
+ }
+
+ public void testTargetWireNoOptimizationNonAtomicContainer() throws Exception {
+ Component component = EasyMock.createNiceMock(Component.class);
+ EasyMock.expect(component.isOptimizable()).andReturn(true);
+ EasyMock.replay(component);
+ InboundWire wire = new InboundWireImpl();
+ wire.setContainer(component);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new OptimizableInterceptor());
+ wire.addInvocationChain(operation, chain);
+ assertTrue(WireUtils.isOptimizable(wire));
+ }
+
+ public void testTargetWireNonInterceptorOptimization() throws Exception {
+ AtomicComponent component = EasyMock.createNiceMock(AtomicComponent.class);
+ EasyMock.replay(component);
+ InboundWire wire = new InboundWireImpl();
+ wire.setContainer(component);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.addInterceptor(new NonOptimizableInterceptor());
+ wire.addInvocationChain(operation, chain);
+ assertFalse(WireUtils.isOptimizable(wire));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+
+ }
+
+ private class OptimizableInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ return null;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return true;
+ }
+ }
+
+ private class NonOptimizableInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ return null;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java
new file mode 100644
index 0000000000..1838fd35bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireServiceExtensionTestCase.java
@@ -0,0 +1,333 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentReferenceDefinition;
+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.Multiplicity;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ReferenceTarget;
+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.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.ProxyCreationException;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
+import org.apache.tuscany.spi.wire.WireInvocationHandler;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.mock.binding.MockServiceBinding;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireServiceExtensionTestCase extends TestCase {
+ private TestWireService wireService;
+ private Operation<Type> operation;
+ private ServiceContract<Type> contract;
+ private Operation<Type> callbackOperation;
+
+ public void testCreateInboundChain() throws Exception {
+ InboundInvocationChain chain = wireService.createInboundChain(operation);
+ assertEquals(operation, chain.getOperation());
+ }
+
+ public void testCreateOutboundChain() throws Exception {
+ OutboundInvocationChain chain = wireService.createOutboundChain(operation);
+ assertEquals(operation, chain.getOperation());
+ }
+
+ public void testCreateServiceWire() throws Exception {
+ ServiceDefinition definition = new ServiceDefinition("foo", contract, false);
+ TargetInvoker invoker = EasyMock.createMock(TargetInvoker.class);
+ MessageImpl resp = new MessageImpl();
+ EasyMock.expect(invoker.invoke(EasyMock.isA(Message.class))).andReturn(resp);
+ EasyMock.replay(invoker);
+ InboundWire wire = wireService.createWire(definition);
+ assertEquals("foo", wire.getServiceName());
+ assertEquals(1, wire.getInvocationChains().size());
+ assertEquals(contract, wire.getServiceContract());
+ InboundInvocationChain chain = wire.getInvocationChains().get(operation);
+ assertEquals(operation, chain.getOperation());
+ // verify the chain is invokable
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ assertNotNull(chain.getHeadInterceptor().invoke(msg));
+ EasyMock.verify(invoker);
+ }
+
+ /*public void testCreateReferenceWire() throws Exception {
+ AbstractReferenceDefinition definition = new AbstractReferenceDefinition("foo", contract);
+ ReferenceTarget target = new ReferenceTarget();
+ target.addTarget(new URI("bar"));
+ target.setReferenceName("refName");
+
+ OutboundWire wire = wireService.createWire(target, definition).get(0);
+ assertEquals("refName", wire.getReferenceName());
+ assertEquals("bar", wire.getTargetName().toString());
+ assertFalse(wire.isAutowire());
+ assertEquals(1, wire.getInvocationChains().size());
+ assertEquals(contract, wire.getServiceContract());
+ OutboundInvocationChain chain = wire.getInvocationChains().get(operation);
+ assertEquals(operation, chain.getOperation());
+ assertNull(chain.getHeadInterceptor());
+ assertEquals(Callback.class, wire.getCallbackInterface());
+ assertEquals(1, wire.getTargetCallbackInvocationChains().size());
+ InboundInvocationChain callbackChain = wire.getTargetCallbackInvocationChains().get(callbackOperation);
+ assertEquals(callbackOperation, callbackChain.getOperation());
+
+ TargetInvoker invoker = EasyMock.createMock(TargetInvoker.class);
+ MessageImpl resp = new MessageImpl();
+ EasyMock.expect(invoker.invoke(EasyMock.isA(Message.class))).andReturn(resp);
+ EasyMock.replay(invoker);
+ // verify the callback chain is invokable
+ MessageImpl msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ assertNotNull(callbackChain.getHeadInterceptor().invoke(msg));
+ EasyMock.verify(invoker);
+ }*/
+
+ public void testCreateAutowireReferenceWire() throws Exception {
+ ComponentTypeReferenceDefinition definition = new ComponentTypeReferenceDefinition("foo", contract);
+ definition.setAutowire(true);
+ ComponentReferenceDefinition compRef = new ComponentReferenceDefinition(definition);
+ //ReferenceTarget target = new ReferenceTarget();
+ //target.setReferenceName("refName");
+ OutboundWire wire = wireService.createWire(new ArrayList<URI>(), compRef).get(0);
+ assertTrue(wire.isAutowire());
+ assertEquals("foo", wire.getReferenceName());
+ assertEquals(contract, wire.getServiceContract());
+ assertEquals(Callback.class, wire.getCallbackInterface());
+ }
+
+ public void testCreateReferenceMultipleWire() throws Exception {
+ ComponentTypeReferenceDefinition ctRefDef = new ComponentTypeReferenceDefinition("foo", contract);
+ ComponentReferenceDefinition definition = new ComponentReferenceDefinition(ctRefDef);
+ definition.setMultiplicity(Multiplicity.ONE_N);
+
+ //ReferenceTarget target = new ReferenceTarget();
+ List<URI> target = new ArrayList<URI>();
+ target.add(new URI("bar"));
+ target.add(new URI("bar2"));
+ //target.setReferenceName("refName");
+
+ List<OutboundWire> wires = wireService.createWire(target, definition);
+ assertEquals(2, wires.size());
+ }
+
+ public void testCreateComponentWires() throws Exception {
+ ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ComponentTypeReferenceDefinition, Property<?>>();
+ ComponentTypeReferenceDefinition referenceDefinition = new ComponentTypeReferenceDefinition("refName", contract);
+ type.add(referenceDefinition);
+ ServiceDefinition serviceDefinition = new ServiceDefinition("foo", contract, false);
+ type.add(serviceDefinition);
+
+ Implementation<ComponentType> impl = new Implementation<ComponentType>() {
+ };
+ impl.setComponentType(type);
+
+ ComponentDefinition<Implementation<ComponentType>> definition =
+ new ComponentDefinition<Implementation<ComponentType>>("Foo", impl);
+ ComponentReferenceDefinition compRef =
+ new ComponentReferenceDefinition(type.getReferences().get("refName"));
+ compRef.addTarget(new URI("bar"));
+ definition.add(compRef);
+
+ /*ReferenceTarget target = new ReferenceTarget();
+ target.addTarget(new URI("bar"));
+ target.setReferenceName("refName");
+ definition.add(target);
+ */
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ component.addInboundWire(EasyMock.isA(InboundWire.class));
+ component.addOutboundWire(EasyMock.isA(OutboundWire.class));
+ EasyMock.replay(component);
+
+ wireService.createWires(component, definition);
+ EasyMock.verify(component);
+ }
+
+ public void testCreateReferenceBindingWire() throws Exception {
+ ReferenceBinding binding = new MockReferenceBinding();
+ QualifiedName qName = new QualifiedName("target");
+
+ wireService.createWires(binding, contract, qName);
+
+ InboundWire inboundWire = binding.getInboundWire();
+ assertEquals(1, inboundWire.getInvocationChains().size());
+ assertEquals(contract, inboundWire.getServiceContract());
+ assertEquals(binding, inboundWire.getContainer());
+
+ OutboundWire outboundWire = binding.getOutboundWire();
+ assertEquals("target", outboundWire.getTargetName().toString());
+ assertEquals(1, outboundWire.getInvocationChains().size());
+ assertEquals(contract, outboundWire.getServiceContract());
+ assertEquals(binding, outboundWire.getContainer());
+ }
+
+ public void testCreateServiceBindingWire() throws Exception {
+ ServiceBinding binding = new MockServiceBinding();
+
+ wireService.createWires(binding, contract, "target");
+
+ InboundWire inboundWire = binding.getInboundWire();
+ assertEquals(1, inboundWire.getInvocationChains().size());
+ assertEquals(contract, inboundWire.getServiceContract());
+ assertEquals(binding, inboundWire.getContainer());
+
+ OutboundWire outboundWire = binding.getOutboundWire();
+ assertEquals("target", outboundWire.getTargetName().toString());
+ assertEquals(1, outboundWire.getInvocationChains().size());
+ assertEquals(contract, outboundWire.getServiceContract());
+ assertEquals(binding, outboundWire.getContainer());
+ assertEquals(1, outboundWire.getTargetCallbackInvocationChains().size());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireService = new TestWireService(new WorkContextImpl());
+
+ operation = new Operation<Type>("foo", null, null, null);
+ callbackOperation = new Operation<Type>("foo", null, null, null);
+ Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
+ operations.put("foo", operation);
+ Map<String, Operation<Type>> callbackOperations = new HashMap<String, Operation<Type>>();
+ callbackOperations.put("foo", callbackOperation);
+ contract = new ServiceContract<Type>() {
+ };
+ contract.setOperations(operations);
+ contract.setCallbackClass(Callback.class);
+ contract.setCallbackName(Callback.class.getName());
+ contract.setCallbackOperations(callbackOperations);
+ }
+
+ private interface Callback {
+
+ }
+
+ private class TestWireService extends WireServiceExtension {
+ protected TestWireService(WorkContext context) {
+ super(context, null);
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException {
+ return null;
+ }
+
+ public <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, OutboundChainHolder> mapping)
+ throws ProxyCreationException {
+ return null;
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException {
+ return null;
+ }
+
+ public WireInvocationHandler createHandler(Class<?> interfaze, Wire wire) {
+ return null;
+ }
+
+
+ public List<OutboundWire> createWire(List<URI> refTargetURIs, ComponentReferenceDefinition def) {
+ return super.createWire(refTargetURIs, def);
+ }
+ }
+
+ private class MockReferenceBinding extends AbstractSCAObject implements ReferenceBinding {
+ private ServiceContract<?> bindingServiceContract;
+ private InboundWire inboundWire;
+ private OutboundWire outboundWire;
+
+ public MockReferenceBinding() {
+ super("foo", null);
+ }
+
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public void setReference(Reference reference) {
+
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public void setInboundWire(InboundWire inboundWire) {
+ this.inboundWire = inboundWire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+
+ public Scope getScope() {
+ return null;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java
new file mode 100644
index 0000000000..331c0760d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.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.core.wire;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+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.OutboundChainHolder;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireUtilsTestCase extends TestCase {
+ private Method m;
+
+ public void testCreateInterfaceToWireMapping() throws Exception {
+ OutboundWire wire = new OutboundWireImpl();
+ Operation<Type> op = new Operation<Type>("hello", null, null, null);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(op);
+ wire.addInvocationChain(op, chain);
+ Map<Method, OutboundChainHolder> chains = WireUtils.createInterfaceToWireMapping(Foo.class, wire);
+ assertEquals(1, chains.size());
+ assertNotNull(chains.get(m));
+ }
+
+ public void testCreateInterfaceToWireMappingNoOperation() throws Exception {
+ OutboundWire wire = new OutboundWireImpl();
+ Operation<Type> op = new Operation<Type>("goodbye", null, null, null);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(op);
+ wire.addInvocationChain(op, chain);
+ try {
+ WireUtils.createInterfaceToWireMapping(Foo.class, wire);
+ fail();
+ } catch (NoMethodForOperationException e) {
+ // expected
+ }
+ }
+
+ public void testCreateInboundMapping() throws Exception {
+ InboundWire wire = new InboundWireImpl();
+ Operation<Type> op = new Operation<Type>("hello", null, null, null);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(op);
+ wire.addInvocationChain(op, chain);
+ Map<Method, InboundInvocationChain> chains = WireUtils.createInboundMapping(wire, new Method[]{m});
+ assertEquals(1, chains.size());
+ assertNotNull(chains.get(m));
+ }
+
+ public void testCreateInboundMappingNoOperation() throws Exception {
+ InboundWire wire = new InboundWireImpl();
+ Operation<Type> op = new Operation<Type>("goodbye", null, null, null);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(op);
+ wire.addInvocationChain(op, chain);
+ try {
+ WireUtils.createInboundMapping(wire, new Method[]{m});
+ fail();
+ } catch (NoMethodForOperationException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ m = Foo.class.getMethod("hello");
+ }
+
+ private interface Foo {
+ void hello();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerSerializationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerSerializationTestCase.java
new file mode 100644
index 0000000000..df4dc63ea4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerSerializationTestCase.java
@@ -0,0 +1,54 @@
+package org.apache.tuscany.core.wire.jdk;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandlerSerializationTestCase extends TestCase {
+ private InboundWire wire;
+ private WorkContext workContext;
+
+ public void testSerializeDeserialize() throws Exception {
+ JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, workContext);
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ObjectOutputStream ostream = new ObjectOutputStream(stream);
+ ostream.writeObject(handler);
+
+ ObjectInputStream istream = new ObjectInputStream(new ByteArrayInputStream(stream.toByteArray()));
+ SCAExternalizable externalizable = (SCAExternalizable) istream.readObject();
+
+ externalizable.setWorkContext(workContext);
+ externalizable.reactivate();
+ EasyMock.verify(wire);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(wire);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getInboundWire(EasyMock.eq("foo"))).andReturn(wire);
+ EasyMock.replay(component);
+ workContext = new WorkContextImpl();
+ workContext.setCurrentAtomicComponent(component);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ workContext.setCurrentAtomicComponent(null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..b8cbde687d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.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.wire.jdk;
+
+import java.lang.reflect.Proxy;
+
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandlerTestCase extends TestCase {
+
+ public void testToString() {
+ InboundWireImpl wire = new InboundWireImpl();
+ wire.setServiceContract(new JavaServiceContract(Foo.class));
+ JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, new WorkContextImpl());
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.toString());
+ }
+
+ public void testHashCode() {
+ InboundWireImpl wire = new InboundWireImpl();
+ wire.setServiceContract(new JavaServiceContract(Foo.class));
+ JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, new WorkContextImpl());
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.hashCode());
+ }
+
+ private interface Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java
new file mode 100644
index 0000000000..a631982958
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire.jdk;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKInboundInvocationHandlerSerializationTestCase extends TestCase {
+ private InboundWire wire;
+ private WorkContext workContext;
+ private TargetInvoker invoker;
+
+ public void testSerializeDeserialize() throws Throwable {
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(Foo.class, wire, workContext);
+ handler.invoke(Foo.class.getMethod("invoke"), null);
+
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ObjectOutputStream ostream = new ObjectOutputStream(stream);
+ ostream.writeObject(handler);
+
+ ObjectInputStream istream = new ObjectInputStream(new ByteArrayInputStream(stream.toByteArray()));
+ JDKInboundInvocationHandler externalizable = (JDKInboundInvocationHandler) istream.readObject();
+
+ externalizable.setWorkContext(workContext);
+ externalizable.reactivate();
+ externalizable.invoke(Foo.class.getMethod("invoke"), null);
+ EasyMock.verify(wire);
+ EasyMock.verify(invoker);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wire = EasyMock.createMock(InboundWire.class);
+ Map<Operation<?>, InboundInvocationChain> map = new HashMap<Operation<?>, InboundInvocationChain>();
+ Operation<Object> operation = new Operation<Object>("invoke", null, null, null, false, null, NO_CONVERSATION);
+ map.put(operation, createChain(operation));
+
+ EasyMock.expect(wire.getServiceName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn(map).times(2);
+ EasyMock.replay(wire);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getInboundWire(EasyMock.eq("foo"))).andReturn(wire);
+ EasyMock.replay(component);
+ workContext = new WorkContextImpl();
+ workContext.setCurrentAtomicComponent(component);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ workContext.setCurrentAtomicComponent(null);
+ }
+
+ private InboundInvocationChain createChain(Operation operation) {
+ invoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl()).times(2);
+ EasyMock.expect(invoker.isCacheable()).andReturn(false).atLeastOnce();
+ EasyMock.replay(invoker);
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ chain.setTargetInvoker(invoker);
+ chain.addInterceptor(new InvokerInterceptor());
+ chain.prepare();
+ return chain;
+ }
+
+ public class Foo {
+ public void invoke() {
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..1a4238c589
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.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.core.wire.jdk;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.mock.component.SimpleTarget;
+import org.apache.tuscany.core.mock.component.SimpleTargetImpl;
+import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
+import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
+import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.easymock.classextension.EasyMock;
+
+/**
+ * Verifies invocations on inbound wires
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JDKInboundInvocationHandlerTestCase extends TestCase {
+
+ private Method echo;
+ private Operation operation;
+
+ public void testInterceptorInvoke() throws Throwable {
+ MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
+ InboundInvocationChain chain = new InboundInvocationChainImpl(operation);
+ MockSyncInterceptor interceptor = new MockSyncInterceptor();
+ chain.addInterceptor(interceptor);
+ chain.addInterceptor(new InvokerInterceptor());
+ chain.setTargetInvoker(invoker);
+ chain.prepare();
+ InboundWire wire = createWire(chain);
+
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
+ assertEquals("foo", handler.invoke(echo, new String[]{"foo"}));
+ assertEquals(1, interceptor.getCount());
+ }
+
+ public void testDirectErrorInvoke() throws Throwable {
+ InboundInvocationChain source = new InboundInvocationChainImpl(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+ InboundWire wire = createWire(source);
+
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
+ try {
+ assertEquals("foo", handler.invoke(echo, new Object[]{}));
+ fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ // should throw
+ }
+ }
+
+ public void testDirectInvoke() throws Throwable {
+ InboundInvocationChain source = new InboundInvocationChainImpl(operation);
+ MockStaticInvoker invoker = new MockStaticInvoker(echo, new SimpleTargetImpl());
+ source.setTargetInvoker(invoker);
+ InboundWire wire = createWire(source);
+
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
+ assertEquals("foo", handler.invoke(echo, new Object[]{"foo"}));
+ }
+
+ public void testToString() {
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ InboundWireImpl wire = new InboundWireImpl();
+ wire.setServiceContract(new ServiceContract<Foo>(Foo.class) {
+ });
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.toString());
+ }
+
+ public void testHashCode() {
+ WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
+ EasyMock.replay(workContext);
+ InboundWireImpl wire = new InboundWireImpl();
+ wire.setServiceContract(new ServiceContract<Foo>(Foo.class) {
+ });
+ JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.hashCode());
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ ServiceContract<?> contract;
+ try {
+ contract = registry.introspect(SimpleTarget.class);
+ } catch (InvalidServiceContractException e) {
+ throw new AssertionError();
+ }
+ operation = contract.getOperations().get("echo");
+ echo = SimpleTarget.class.getMethod("echo", String.class);
+ }
+
+
+ private InboundWire createWire(InboundInvocationChain chain) {
+ DataType<Type> type = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ types.add(type);
+ DataType<List<DataType<Type>>> inputType =
+ new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("echo", inputType, null, null, false, null, NO_CONVERSATION);
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(operation, chain);
+ InboundWire wire = new InboundWireImpl();
+ wire.addInvocationChains(chains);
+ wire.setServiceContract(new ServiceContract<SimpleTarget>(SimpleTarget.class) {
+ });
+ return wire;
+ }
+
+ private interface Foo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
new file mode 100644
index 0000000000..39d8113584
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire.jdk;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+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;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKOutboundInvocationHandlerProxyTestCase extends TestCase {
+
+ private JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ private OutboundWire wire;
+ private Method clientHello;
+ private TargetInvoker targetInvoker;
+
+ public void testDifferentInterface() throws Throwable {
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Client.class, wire, null);
+ handler.invoke(null, clientHello, null);
+ EasyMock.verify(targetInvoker);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wire = new OutboundWireImpl();
+ JavaServiceContract contract = registry.introspect(Target.class);
+ for (Operation<?> operation : contract.getOperations().values()) {
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ wire.addInvocationChain(operation, chain);
+ targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invokeTarget(EasyMock.isNull(), EasyMock.eq(TargetInvoker.NONE)))
+ .andReturn(new MessageImpl());
+ EasyMock.expect(targetInvoker.isCacheable()).andReturn(false);
+ EasyMock.replay(targetInvoker);
+ chain.setTargetInvoker(targetInvoker);
+ }
+ wire.setServiceContract(contract);
+ clientHello = Client.class.getMethod("hello");
+
+ }
+
+ private interface Target {
+ String hello();
+ }
+
+ private interface Client {
+ String hello();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java
new file mode 100644
index 0000000000..c6e449d291
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wire.jdk;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.ServiceContract;
+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;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKOutboundInvocationHandlerSerializationTestCase extends TestCase {
+ private OutboundWire wire;
+ private WorkContext workContext;
+ private TargetInvoker invoker;
+
+ public void testSerializeDeserialize() throws Throwable {
+ JDKOutboundInvocationHandler handler =
+ new JDKOutboundInvocationHandler(Foo.class, wire, workContext);
+ handler.invoke(Foo.class.getMethod("invoke"), null);
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ ObjectOutputStream ostream = new ObjectOutputStream(stream);
+ ostream.writeObject(handler);
+
+ ObjectInputStream istream = new ObjectInputStream(new ByteArrayInputStream(stream.toByteArray()));
+ JDKOutboundInvocationHandler externalizable = (JDKOutboundInvocationHandler) istream.readObject();
+
+ externalizable.setWorkContext(workContext);
+ externalizable.reactivate();
+ externalizable.invoke(Foo.class.getMethod("invoke"), null);
+ EasyMock.verify(invoker);
+ EasyMock.verify(wire);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ SCAObject container = EasyMock.createMock(SCAObject.class);
+ ServiceContract<Foo> contract = new ServiceContract<Foo>() {
+ };
+ contract.setInterfaceClass(Foo.class);
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ EasyMock.expect(container.getName()).andReturn("bar").atLeastOnce();
+ EasyMock.replay(container);
+ wire = EasyMock.createMock(OutboundWire.class);
+ Map<Operation<?>, OutboundInvocationChain> map = new HashMap<Operation<?>, OutboundInvocationChain>();
+ Operation<Object> operation = new Operation<Object>("invoke", null, null, null, false, null, NO_CONVERSATION);
+ ServiceContract<Object> opContract = new ServiceContract<Object>() {
+ };
+ contract.setInterfaceClass(Foo.class);
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ operation.setServiceContract(opContract);
+ map.put(operation, createChain(operation));
+ EasyMock.expect(wire.getContainer()).andReturn(container).atLeastOnce();
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getReferenceName()).andReturn("foo").atLeastOnce();
+ EasyMock.expect(wire.getInvocationChains()).andReturn(map).times(2);
+ EasyMock.replay(wire);
+ Map<String, List<OutboundWire>> wires = new HashMap<String, List<OutboundWire>>();
+ List<OutboundWire> list = new ArrayList<OutboundWire>();
+ list.add(wire);
+ wires.put("foo", list);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getOutboundWires()).andReturn(wires);
+ EasyMock.replay(component);
+ workContext = new WorkContextImpl();
+ workContext.setCurrentAtomicComponent(component);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ workContext.setCurrentAtomicComponent(null);
+ }
+
+ private OutboundInvocationChain createChain(Operation operation) {
+ invoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(invoker.invoke(EasyMock.isA(Message.class))).andReturn(new MessageImpl()).times(2);
+ EasyMock.expect(invoker.isCacheable()).andReturn(false).atLeastOnce();
+ EasyMock.replay(invoker);
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ chain.setTargetInvoker(invoker);
+ chain.addInterceptor(new InvokerInterceptor());
+ chain.prepare();
+ return chain;
+ }
+
+ public class Foo {
+
+ public void invoke() {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..4d2af8acf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire.jdk;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.InteractionScope;
+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.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKOutboundInvocationHandlerTestCase extends TestCase {
+
+ public void testToString() {
+ OutboundWireImpl wire = new OutboundWireImpl();
+ ServiceContract contract = new JavaServiceContract(Foo.class);
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ wire.setServiceContract(contract);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.toString());
+ }
+
+ public void testHashCode() {
+ OutboundWireImpl wire = new OutboundWireImpl();
+ ServiceContract contract = new JavaServiceContract(Foo.class);
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ wire.setServiceContract(contract);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
+ Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
+ assertNotNull(foo.hashCode());
+ }
+
+ public void testConversational() throws Throwable {
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+ Map<Operation<?>, OutboundInvocationChain> outboundChains =
+ new HashMap<Operation<?>, OutboundInvocationChain>();
+ DataType<Type> type1 = new DataType<Type>(String.class, String.class);
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ types.add(type1);
+ DataType<List<DataType<Type>>> inputType1 = new DataType<List<DataType<Type>>>(Object[].class, types);
+ DataType<Type> outputType1 = new DataType<Type>(String.class, String.class);
+ Operation<Type> op1 = new Operation<Type>("test", inputType1, outputType1, null);
+ ServiceContract<Type> outboundContract = new JavaServiceContract(Foo.class);
+ outboundContract.setInteractionScope(InteractionScope.CONVERSATIONAL);
+ op1.setServiceContract(outboundContract);
+
+ WorkContext wc = new WorkContextImpl();
+ MockInvoker invoker = new MockInvoker(wc);
+ OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
+ expect(outboundChain.getTargetInvoker()).andReturn(invoker).anyTimes();
+ expect(outboundChain.getHeadInterceptor()).andReturn(null).anyTimes();
+ replay(outboundChain);
+ outboundChains.put(op1, outboundChain);
+ expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
+ expect(outboundWire.getReferenceName()).andReturn("fooRef").atLeastOnce();
+ expect(outboundWire.getContainer()).andReturn(null).anyTimes();
+ expect(outboundWire.getServiceContract()).andReturn(outboundContract).anyTimes();
+ replay(outboundWire);
+
+ String convID = UUID.randomUUID().toString();
+ wc.setIdentifier(Scope.CONVERSATION, convID);
+ invoker.setCurrentConversationID(convID);
+
+ outboundContract.setRemotable(true);
+ invoker.setRemotableTest(true);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, outboundWire, wc);
+ handler.invoke(Foo.class.getMethod("test", String.class), new Object[]{"bar"});
+ String currentConvID = (String) wc.getIdentifier(Scope.CONVERSATION);
+ assertSame(convID, currentConvID);
+
+ outboundContract.setRemotable(false);
+ invoker.setRemotableTest(false);
+ JDKOutboundInvocationHandler handler2 = new JDKOutboundInvocationHandler(Foo.class, outboundWire, wc);
+ handler2.invoke(Foo.class.getMethod("test", String.class), new Object[]{"bar"});
+ currentConvID = (String) wc.getIdentifier(Scope.CONVERSATION);
+ assertSame(convID, currentConvID);
+ }
+
+ private interface Foo {
+ String test(String s);
+ }
+
+ private class MockInvoker implements TargetInvoker {
+
+ private WorkContext wc;
+ private String currentConversationID;
+ private boolean remotableTest;
+
+ public MockInvoker(WorkContext wc) {
+ this.wc = wc;
+ }
+
+ public void setCurrentConversationID(String id) {
+ currentConversationID = id;
+ }
+
+ public void setRemotableTest(boolean remotableTest) {
+ this.remotableTest = remotableTest;
+ }
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ assertEquals("bar", Array.get(payload, 0));
+ String convID = (String) wc.getIdentifier(Scope.CONVERSATION);
+ if (remotableTest) {
+ assertNotSame(convID, currentConversationID);
+ } else {
+ assertSame(convID, currentConversationID);
+ }
+ return "response";
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ fail();
+ return null;
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java
new file mode 100644
index 0000000000..994d944d98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.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.wire.jdk;
+
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKProxyTestCase extends TestCase {
+ private JDKWireService wireService;
+ private InboundWire inboundWire;
+ private Map<Operation<?>, InboundInvocationChain> chains;
+
+ public void testCreateProxy() {
+ EasyMock.expect(inboundWire.getServiceName()).andReturn("service");
+ EasyMock.expect(inboundWire.getInvocationChains()).andReturn(chains);
+ EasyMock.replay(inboundWire);
+ TestInterface intf = wireService.createProxy(TestInterface.class, inboundWire);
+ assertTrue(Proxy.isProxyClass(intf.getClass()));
+ EasyMock.verify(inboundWire);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wireService = new JDKWireService();
+ inboundWire = EasyMock.createMock(InboundWire.class);
+ chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ }
+
+ public static interface TestInterface {
+ int primitives(int i);
+
+ String objects(String object);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/ipo.xsd
new file mode 100644
index 0000000000..92a576fb98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/ipo.xsd
@@ -0,0 +1,136 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/order.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/order.wsdl
new file mode 100644
index 0000000000..100890e10b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/impl/order.wsdl
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<definitions name="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
+ xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
+ <element name="checkOrderStatus">
+ <complexType>
+ <sequence>
+ <element name="customerId" type="string" />
+ <element name="order" type="ipo:PurchaseOrderType" />
+ <element name="flag" type="int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="checkOrderStatusResponse">
+ <complexType>
+ <sequence>
+ <element name="status" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="note" type="string" />
+ </schema>
+ </types>
+
+ <message name="CheckOrderStatusInput1">
+ <part name="body" element="xsd1:checkOrderStatus" />
+ </message>
+
+ <message name="CheckOrderStatusOutput1">
+ <part name="body" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <message name="CheckOrderStatusInput2">
+ <part name="p1" element="xsd1:checkOrderStatus" />
+ <part name="p2" element="xsd1:note" />
+ </message>
+
+ <message name="CheckOrderStatusOutput2">
+ <part name="p1" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <portType name="OrderPortType">
+ <operation name="checkOrderStatus">
+ <input message="tns:CheckOrderStatusInput1" />
+ <output message="tns:CheckOrderStatusOutput1" />
+ </operation>
+ <operation name="checkOrderStatus2">
+ <input message="tns:CheckOrderStatusInput2" />
+ <output message="tns:CheckOrderStatusOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/xml/foo.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/xml/foo.xml
new file mode 100644
index 0000000000..0ba8ade1e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/databinding/xml/foo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<f:foo xmlns:f="http://foo" name="foo">
+ <b:bar xmlns:b="http://bar">bar</b:bar>
+</f:foo> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl
new file mode 100644
index 0000000000..5ffd69dc28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1-include.scdl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="boot1-include">
+
+ <component name="component2">
+ <system:implementation.system class="org.apache.tuscany.core.mock.component.BasicInterfaceImpl"/>
+ </component>
+
+ <service name="service2" >
+ <interface.java interface="org.apache.tuscany.core.mock.component.BasicInterface"/>
+ <reference>component2</reference>
+ </service>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl
new file mode 100644
index 0000000000..3911e54e86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot1.scdl
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="boot1">
+ <service name="service" >
+ <interface.java interface="org.apache.tuscany.core.mock.component.BasicInterface"/>
+ <reference>component</reference>
+ </service>
+
+ <component name="component">
+ <system:implementation.system class="org.apache.tuscany.core.mock.component.BasicInterfaceImpl"/>
+ <property name="publicProperty">propval</property>
+ <reference name="publicReference">component2</reference>
+ </component>
+
+ <include name="boot1-include" scdlLocation="boot1-include.scdl"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl
new file mode 100644
index 0000000000..66449f39c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/deployer/boot2.scdl
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ A more complex example closer to a typical bootstrap configuration
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="boot2">
+
+ <!-- expose Deployer API as a service -->
+ <service name="deployer" >
+ <interface.java interface="org.apache.tuscany.spi.deployer.Deployer"/>
+ <reference>deployerImpl</reference>
+ </service>
+
+ <!-- Component that provides the Deployer service -->
+ <component name="deployerImpl">
+ <system:implementation.system class="org.apache.tuscany.core.deployer.DeployerImpl"/>
+ </component>
+
+ <!-- Work management -->
+ <component name="workContext">
+ <system:implementation.system class="org.apache.tuscany.core.component.WorkContextImpl"/>
+ </component>
+
+ <!-- Scope infrastructure -->
+ <component name="scopeRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.component.scope.ScopeRegistryImpl"/>
+ </component>
+
+ <!-- Builder and BuilderRegistry -->
+ <component name="builder">
+ <system:implementation.system class="org.apache.tuscany.core.builder.BuilderRegistryImpl"/>
+ </component>
+
+ <!-- Loader and LoaderRegistry -->
+ <component name="loader">
+ <system:implementation.system class="org.apache.tuscany.core.loader.LoaderRegistryImpl"/>
+ </component>
+
+ <!-- Introspector and IntrospectionRegistry -->
+ <component name="interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.IntrospectionRegistryImpl"/>
+ </component>
+
+ <!-- Connector infrastructure -->
+ <component name="connector">
+ <system:implementation.system class="org.apache.tuscany.core.builder.ConnectorImpl"/>
+ </component>
+
+ <!-- Resource host registry -->
+ <component name="resourceHostRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.services.host.DelegatingResourceHostRegistry"/>
+ </component>
+
+ <!-- Foundation element loader implementations -->
+ <component name="elementLoader.component">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ComponentLoader"/>
+ </component>
+ <component name="elementLoader.componentType">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ComponentTypeElementLoader"/>
+ </component>
+ <component name="elementLoader.interface.java">
+ <system:implementation.system class="org.apache.tuscany.core.idl.java.InterfaceJavaLoader"/>
+ </component>
+ <component name="elementLoader.property">
+ <system:implementation.system class="org.apache.tuscany.core.loader.PropertyLoader"/>
+ </component>
+ <component name="elementLoader.reference">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ReferenceLoader"/>
+ </component>
+ <component name="elementLoader.service">
+ <system:implementation.system class="org.apache.tuscany.core.loader.ServiceLoader"/>
+ </component>
+
+ <component name="wireService">
+ <system:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireService"/>
+ </component>
+
+ <!-- Composite implementation type -->
+ <component name="composite.loader">
+ <system:implementation.system class="org.apache.tuscany.core.implementation.composite.CompositeLoader"/>
+ </component>
+
+ <component name="interfaceJava.interfaceProcessorRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl"/>
+ </component>
+
+ <component name="artifactRepository">
+ <system:implementation.system class="org.apache.tuscany.core.services.artifact.LocalMavenRepository"/>
+ <property name="repository">.m2/repository</property>
+ </component>
+
+ <!-- DataBinding registry -->
+ <component name="databinding.registry">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.DataBindingRegistryImpl" />
+ </component>
+
+ <!-- DataBinding registry -->
+ <component name="databinding.mediator">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.MediatorImpl" />
+ </component>
+
+ <!-- Transformer registry -->
+ <component name="databinding.transformerRegistry" initLevel="90">
+ <system:implementation.system class="org.apache.tuscany.core.databinding.impl.TransformerRegistryImpl" />
+ </component>
+
+ <component name="propertyFactory">
+ <system:implementation.system class="org.apache.tuscany.core.property.PropertyObjectFactoryImpl"/>
+ </component>
+
+ <component name="policyBuilderRegistry">
+ <system:implementation.system class="org.apache.tuscany.core.policy.PolicyBuilderRegistryImpl"/>
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl
new file mode 100644
index 0000000000..2ec1a2ed0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/TestPolicy.scdl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ name="org.apache.tuscany.core.policy.testCase">
+ <policySet name="BasicAuthMsgProtSecurity"
+ provides="sec.confidentiality" appliesTo="binding.ws binding.jms"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <wsp:PolicyAttachment/>
+ <intentMap provides="sec.confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment/>
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ <qualifier name="message">
+ <intentMap provides="sec.confidentiality/message"
+ default="all">
+ <qualifier name="all">
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ <qualifier name="body">
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ </intentMap>
+ </policySet>
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl
new file mode 100644
index 0000000000..584846504b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/loader/test-include.scdl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite>
+ This file just needs to exist
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl
new file mode 100644
index 0000000000..77c6b5edd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/policy/PolicySet.scdl
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ name="org.apache.tuscany.core.policy.testCase">
+ <policySet name="BasicMsgProtSecurity"
+ provides="sec.confidentiality" appliesTo="binding.ws binding.jms"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <wsp:PolicyAttachment/>
+ <intentMap provides="sec.confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment/>
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ <qualifier name="message">
+ <intentMap provides="sec.confidentiality/message"
+ default="all">
+ <qualifier name="all">
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ <qualifier name="body">
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ </intentMap>
+ </policySet>
+
+ <policySet name="Authentication"
+ provides="sec.authentication" appliesTo="binding.ws binding.jms">
+ <wsp:PolicyAttachment/>
+ <intentMap provides="authentication" default="cert">
+ <qualifier name="cert">
+ <wsp:PolicyAttachment/>
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ <qualifier name="basic">
+ <wsp:PolicyAttachment/>
+ </qualifier>
+ </intentMap>
+ </policySet>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/property/ipo.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/property/ipo.xml
new file mode 100644
index 0000000000..58058dbe1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/property/ipo.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<ipo:purchaseOrder
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ipo="http://www.example.com/IPO"
+ xsi:schemaLocation="http://www.example.com/IPO ipo.xsd"
+ orderDate="1999-12-01">
+
+ <shipTo exportCode="1" xsi:type="ipo:UKAddress">
+ <name>Helen Zoe</name>
+ <street>47 Eden Street</street>
+ <city>Cambridge</city>
+ <postcode>CB1 1JR</postcode>
+ </shipTo>
+
+ <billTo xsi:type="ipo:USAddress">
+ <name>Robert Smith</name>
+ <street>8 Oak Avenue</street>
+ <city>Old Town</city>
+ <state>PA</state>
+ <zip>95819</zip>
+ </billTo>
+
+ <items>
+ <item partNum="833-AA">
+ <productName>Lapis necklace</productName>
+ <quantity>1</quantity>
+ <USPrice>99.95</USPrice>
+ <ipo:comment>Want this for the holidays</ipo:comment>
+ <shipDate>1999-12-05</shipDate>
+ </item>
+ </items>
+</ipo:purchaseOrder>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.ext
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl
new file mode 100644
index 0000000000..1e09549194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/org/apache/tuscany/core/services/deployment/test.scdl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite>
+ This file just needs to exist
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/core/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.checkstyle
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.pmd b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.pmd
new file mode 100644
index 0000000000..ffc4fe2bbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-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/host-api/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-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/host-api/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/pom.xml
new file mode 100644
index 0000000000..becc0e010c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-host-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Host API</name>
+ <description>Tuscany Host Programming Interfaces.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/AbstractRuntimeInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/AbstractRuntimeInfo.java
new file mode 100644
index 0000000000..513d02232a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/AbstractRuntimeInfo.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.host;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URI;
+
+/**
+ * Abstract runtime info implementation.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class AbstractRuntimeInfo implements RuntimeInfo {
+
+ /**
+ * This SCA Domain this runtime belongs to.
+ */
+ private final URI domain;
+
+ /**
+ * Application root directory.
+ */
+ private final File applicationRootDirectory;
+
+ /**
+ * Base URL.
+ */
+ private final URL baseUrl;
+
+ /**
+ * Online indicator.
+ */
+ private final boolean online;
+
+ /**
+ * Runtime Id.
+ */
+ private String runtimeId;
+
+ /**
+ * Initializes the runtime info instance.
+ *
+ * @param domain the SCA Domain that this runtime belongs to
+ * @param applicationRootDirectory Application root directory.
+ * @param baseUrl Base Url.
+ * @param online Onlne indicator.
+ * @param runtimeId Runtime Id.
+ */
+ public AbstractRuntimeInfo(final URI domain,
+ final File applicationRootDirectory,
+ final URL baseUrl,
+ final boolean online,
+ final String runtimeId) {
+ this.domain = domain;
+ this.applicationRootDirectory = applicationRootDirectory;
+ this.baseUrl = baseUrl;
+ this.online = online;
+ this.runtimeId = runtimeId;
+ }
+
+ /**
+ * Returns the SCA domain associated with this runtime.
+ * A null domain indicates that this is a standalone runtime with a self-contained assembly.
+ *
+ * @return the SCA domain associated with this runtime; may be null
+ */
+ public URI getDomain() {
+ return domain;
+ }
+
+ /**
+ * Returns the unique runtime is in the SCA domain.
+ *
+ * @return the SCA domain associated with this runtime; may be null
+ */
+ public String getRuntimeId() {
+ return runtimeId;
+ }
+
+ /**
+ * Return the root directory used to resolve application file paths.
+ *
+ * @return the directory used to resolve application file paths.
+ */
+ public final File getApplicationRootDirectory() {
+ return applicationRootDirectory;
+ }
+
+ /**
+ * Gets the base URL for the runtime.
+ *
+ * @return The base URL for the runtime.
+ */
+ public final URL getBaseURL() {
+ return baseUrl;
+ }
+
+ /**
+ * Returns whether the runtime considers itself "online" or connected to the internet.
+ * This can be used by services to enable access to remote resources.
+ *
+ * @return true if the runtime is online.
+ */
+ public final boolean isOnline() {
+ return online;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/MonitorFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/MonitorFactory.java
new file mode 100644
index 0000000000..d338681641
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/MonitorFactory.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.host;
+
+import java.util.Map;
+
+/**
+ * A MonitorFactory creates implementations of components' monitor interfaces that interface with a its monitoring
+ * scheme. For example, a implementation may create versions that emit appropriate logging events or which send
+ * notifications to a management API.
+ *
+ * MonitorFactory implementations must provide a no-arg constructor and implement the {@link #initialize} method
+ * to perform configuration of instances created using that constructor. Additional constructors may be defined;
+ * typically their implementations delegate to {@link #initialize}.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface MonitorFactory {
+ /**
+ * Initializes MonitorFactory instances with implementation-specific configuration properties.
+ *
+ * @param configProperties a map of named configuration properties. May be null.
+ * @throws IllegalArgumentException if the instance can't be configured using the supplied properties
+ */
+ void initialize(Map<String, Object> configProperties);
+ /**
+ * Return a monitor for a component's monitor interface.
+ *
+ * @param monitorInterface the component's monitoring interface
+ * @return an implementation of the monitoring interface; will not be null
+ */
+ <T> T getMonitor(Class<T> monitorInterface);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/RuntimeInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/RuntimeInfo.java
new file mode 100644
index 0000000000..c75e325256
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/RuntimeInfo.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.host;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * Interface that provides information on the runtime environment.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeInfo {
+ /**
+ * The default name that the runtime should assign to the component providing this service.
+ */
+ String COMPONENT_NAME = "RuntimeInfo";
+
+ /**
+ * Returns the SCA domain associated with this runtime.
+ * A null domain indicates that this is a standalone runtime with a self-contained assembly.
+ *
+ * @return the SCA domain associated with this runtime; may be null
+ */
+ URI getDomain();
+
+ /**
+ * Returns the unique runtime is in the SCA domain.
+ *
+ * @return the SCA domain associated with this runtime; may be null
+ */
+ String getRuntimeId();
+
+ /**
+ * Return the root directory used to resolve application file paths.
+ *
+ * @return the directory used to resolve application file paths.
+ */
+ File getApplicationRootDirectory();
+
+ /**
+ * Gets the base URL for the runtime.
+ *
+ * @return The base URL for the runtime.
+ */
+ URL getBaseURL();
+
+ /**
+ * Returns whether the runtime considers itself "online" or connected to the internet.
+ * This can be used by services to enable access to remote resources.
+ *
+ * @return true if the runtime is online.
+ */
+ boolean isOnline();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java
new file mode 100644
index 0000000000..a8c15aa5d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/AssemblyService.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.host.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * Service interface for managing the logical assembly for a Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AssemblyService {
+
+ /**
+ * Add the composite identified by a supplied URI to the Domain Level
+ * Composite. The supplied composite is added to the domain composite with
+ * semantics that correspond to the domain-level composite having an
+ * &lt;include&gt; statement that references the supplied composite. All of
+ * the composite’s components become top-level components and the services
+ * become externally visible services.
+ *
+ * @param contribution The URI of the contribution
+ * @param composite The URI of the composite
+ * @return The added composite
+ * @throws DeploymentException
+ */
+ Object addCompositeToDomain(URI contribution, URI composite, String artifactName) throws DeploymentException;
+
+ /**
+ * Remove from the Domain Level composite the elements corresponding to the
+ * composite identified by a supplied composite URI. This means that the
+ * removal of the components, wires, services and references originally
+ * added to the domain level composite by the identified composite.
+ *
+ * @param contribution
+ * @param composite
+ * @throws DeploymentException
+ */
+ void removeCompositeFromDomain(URI contribution, URI composite) throws DeploymentException;
+
+ /**
+ * Returns a &lt;composite&gt; definition that has an &lt;include&gt; line
+ * for each composite that had been added to the domain level composite.
+ *
+ * @return The composite representing the SCA domain
+ */
+ Object getDomainComposite();
+
+ /**
+ * Get the definitions for named artifacts in the included composites.
+ *
+ * @param <T> The type of the definition
+ * @param contribution The URI of an installed contribution
+ * @param type The java type of the symbol space such as
+ * javax.wsdl.Definition
+ * @param namespace The namespace of the artifact
+ * @param name The name of the artifact
+ * @return A single definition, in whatever form is appropriate for that
+ * definition type.
+ */
+ <T> T getDefinition(URI contribution, Class<T> type, String namespace, String name);
+
+ /**
+ * Apply a set of changes to the SCA Domain's logical assembly.
+ *
+ * @param changeSet the location of a resource containing a set of changes
+ * @throws DeploymentException if there was a problem making the changes
+ * @throws IOException if there was a problem accessing the resource
+ */
+ void applyChanges(URL changeSet) throws DeploymentException, IOException;
+
+ /**
+ * Apply a set of changes to the SCA Domain's logical assembly.
+ *
+ * @param changeSet a stream for reading a resource containing a set of
+ * changes; the stream will not be closed but no guarantee is
+ * made on the position the stream is left in
+ * @param contentType the type of changeSet on the stream; must be a valid
+ * Content-Type value as specified by <a
+ * href="http://www.ietf.org/rfc/rfc2045.txt">RFC2045</a> and
+ * must not be null
+ * @throws DeploymentException if there was a problem making the changes
+ * @throws IOException if there was a problem reading the stream
+ */
+ void applyChanges(InputStream changeSet, String contentType) throws DeploymentException, IOException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContentTypes.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContentTypes.java
new file mode 100644
index 0000000000..a1f0b26b40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContentTypes.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.host.deployment;
+
+/**
+ * Definitions of common Content-Type values.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class ContentTypes {
+ /**
+ * An Assembly changeSet represented as XML.
+ */
+ public static final String CHANGESET_XML = "application/x-apache.tuscany.changeSet+xml";
+
+ private ContentTypes() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.java
new file mode 100644
index 0000000000..1068acfcca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionProcessorException.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.host.deployment;
+
+/**
+ * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
+ * The Content-Type value supplied will be returned as the message text for this exception.
+ *
+ * @version $Rev: 490357 $ $Date: 2006-12-26 11:06:27 -0800 (Tue, 26 Dec 2006) $
+ */
+public class ContributionProcessorException extends DeploymentException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5187793020502900879L;
+
+ /**
+ * @param message the exception message
+ */
+ public ContributionProcessorException(String message) {
+ super(message);
+ }
+
+ /**
+ *
+ * @param message the exception message
+ * @param identifier an identifier for this exception
+ */
+ public ContributionProcessorException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ /**
+ * @param message the exception message
+ * @param cause a cause for the exception
+ */
+ public ContributionProcessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ * @param identifier
+ * @param cause
+ */
+ public ContributionProcessorException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ /**
+ * @param cause
+ */
+ public ContributionProcessorException(Throwable cause) {
+ super(cause);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.java
new file mode 100644
index 0000000000..307d6e36dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/ContributionService.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.host.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+/**
+ * Service interface that manages artifacts contributed to a Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionService {
+ /**
+ * Contribute an artifact to the SCA Domain. The type of the contribution is
+ * determined by the Content-Type of the resource or, if that is undefined,
+ * by some implementation-specific means (such as mapping an extension in
+ * the URL's path).
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL the location of the resource containing the artifact
+ * @param storeInRepository flag that identifies if you want to copy the
+ * contribution to the repository
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ void contribute(URI contributionURI, URL sourceURL, boolean storeInRepository) throws DeploymentException,
+ IOException;
+
+ /**
+ * Contribute an artifact to the SCA Domain.
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param contributionContent a stream containing the resource being
+ * contributed; the stream will not be closed but the read
+ * position after the call is undefined
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ void contribute(URI contributionURI, InputStream contributionContent)
+ throws DeploymentException, IOException;
+
+ /**
+ * Get the model for an installed contribution
+ *
+ * @param contribution The URI of an installed contribution
+ * @return The model for the contribution or null if there is no such
+ * contribution
+ */
+ Object getContribution(URI contribution);
+
+ /**
+ * Adds or updates a deployment composite using a supplied composite
+ * ("composite by value" – a data structure, not an existing resource in the
+ * domain) to the contribution identified by a supplied contribution URI.
+ * The added or updated deployment composite is given a relative URI that
+ * matches the "name" attribute of the composite, with a ".composite"
+ * suffix.
+ */
+ void addDeploymentComposite(URI contribution, Object composite);
+
+ /**
+ * Remove a contribution from the SCA domain
+ *
+ * @param contribution The URI of the contribution
+ * @throws DeploymentException
+ */
+ void remove(URI contribution) throws DeploymentException;
+
+ /**
+ * Resolve an artifact by QName within the contribution
+ *
+ * @param <T> The java type of the artifact such as javax.wsdl.Definition
+ * @param contribution The URI of the contribution
+ * @param definitionType The java type of the artifact
+ * @param namespace The namespace of the artifact
+ * @param name The name of the artifact
+ * @return The resolved artifact
+ */
+ <T> T resolve(URI contribution, Class<T> definitionType, String namespace, String name);
+
+ /**
+ * Resolve the reference to an artifact by the location URI within the given
+ * contribution. Some typical use cases are:
+ * <ul>
+ * <li>Reference a XML schema using
+ * {http://www.w3.org/2001/XMLSchema-instance}schemaLocation or
+ * <li>Reference a list of WSDLs using
+ * {http://www.w3.org/2004/08/wsdl-instance}wsdlLocation
+ * </ul>
+ *
+ * @param contribution The URI of the contribution
+ * @param namespace The namespace of the artifact. This is for validation
+ * purpose. If the namespace is null, then no check will be
+ * performed.
+ * @param uri The location URI
+ * @param baseURI The URI of the base artifact where the reference is
+ * declared
+ * @return The URL of the resolved artifact
+ */
+ URL resolve(URI contribution, String namespace, URI uri, URI baseURI);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/DeploymentException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/DeploymentException.java
new file mode 100644
index 0000000000..95ebb50b5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/DeploymentException.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.host.deployment;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Base class for exceptions raised during deployment.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class DeploymentException extends TuscanyException {
+ protected DeploymentException() {
+ }
+
+ protected DeploymentException(String message) {
+ super(message);
+ }
+
+ protected DeploymentException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected DeploymentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected DeploymentException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected DeploymentException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/UnsupportedContentTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/UnsupportedContentTypeException.java
new file mode 100644
index 0000000000..d79fe3258a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/deployment/UnsupportedContentTypeException.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.host.deployment;
+
+/**
+ * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
+ * The Content-Type value supplied will be returned as the message text for this exception.
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnsupportedContentTypeException extends DeploymentException {
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported.
+ *
+ * @param contentType the type that is not supported
+ */
+ public UnsupportedContentTypeException(String contentType) {
+ super(contentType);
+ }
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported
+ * and an identifier to use with this exception (typically the resource being processed).
+ *
+ * @param contentType the type that is not supported
+ * @param identifier an identifier for this exception
+ */
+ public UnsupportedContentTypeException(String contentType, String identifier) {
+ super(contentType, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/launcher/Launcher.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/launcher/Launcher.java
new file mode 100644
index 0000000000..913f52c350
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/launcher/Launcher.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.host.launcher;
+
+import java.net.URL;
+
+import org.osoa.sca.CompositeContext;
+
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.host.MonitorFactory;
+
+/**
+ * Interface that allows a host to launch a runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Launcher {
+ /**
+ * Boot the Tuscany runtime.
+ *
+ * @param systemScdl the SCDL defining the runtime's system configuration
+ * @param systemClassLoader the root classloader to use to deploy the system SCDL
+ * @param monitorFactory the monitor factory initialize the runtime with
+ * @throws TuscanyException if there was a problem booting the runtimr
+ */
+ void bootRuntime(URL systemScdl, ClassLoader systemClassLoader, MonitorFactory monitorFactory)
+ throws TuscanyException;
+
+ /**
+ * Shutdown the Tuscany runtime.
+ */
+ void shutdownRuntime();
+
+ /**
+ * Boot a default application into the runtime.
+ *
+ * @param applicationScdl the application's SCDL
+ * @param applicationClassLoader the classloader to use to deploy the application
+ * @return the CompositeContext for the application
+ */
+ CompositeContext bootApplication(URL applicationScdl, ClassLoader applicationClassLoader);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/management/ManagementService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/management/ManagementService.java
new file mode 100644
index 0000000000..1b62d3bbed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/management/ManagementService.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.host.management;
+
+/**
+ *
+ * @version $Revision$ $Date$
+ */
+public interface ManagementService<T> {
+
+ /**
+ * Registers the object for management.
+ *
+ * @param name Name under which the object is registered.
+ * @param managedObject Managed object to be registered.
+ */
+ void registerComponent(String name, T managedObject);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/ExceptionFormatter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/ExceptionFormatter.java
new file mode 100644
index 0000000000..4c1e04ecb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/ExceptionFormatter.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.host.monitor;
+
+import java.io.PrintWriter;
+
+/**
+ * Formats exception data during a monitor event
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionFormatter {
+
+ boolean canFormat(Class<?> type);
+
+ PrintWriter write(PrintWriter writer, Throwable exception);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/FormatterRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/FormatterRegistry.java
new file mode 100644
index 0000000000..277abb63a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/monitor/FormatterRegistry.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.host.monitor;
+
+/**
+ * A registry for exception formatters
+ *
+ * @version $Rev$ $Date$
+ */
+public interface FormatterRegistry {
+
+ /**
+ * Registers the given formatter
+ *
+ * @param formatter the formatter to register
+ */
+ void register(ExceptionFormatter formatter);
+
+ /**
+ * De-registers the given formatter
+ *
+ * @param formatter the formatter to de-register
+ */
+ void unregister(ExceptionFormatter formatter);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHost.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHost.java
new file mode 100644
index 0000000000..3dc68f430d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHost.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.host.rmi;
+
+import java.rmi.Remote;
+
+/* RMI Service hosting interface to be implemented by host environments that allows SCA Components
+ * to register RMI Services to handle inbound service requests over RMI to SCA Components
+ */
+
+public interface RMIHost {
+ int RMI_DEFAULT_PORT = 1299;
+
+ // registers an RMI service with the given name and port
+ void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ // registers an RMI service with the given name and default port (1099)
+ void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ // unregister a service registered under the given service name and port number
+ void unregisterService(String serviceName, int port) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ // unregister a service registered under the given service name and defalut port number (1099)
+ void unregisterService(String serviceName) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ //find a remote service hosted on the given host, port and service name
+ Remote findService(String host, String port, String svcName) throws RMIHostException,
+ RMIHostRuntimeException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostAdmin.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostAdmin.java
new file mode 100644
index 0000000000..dedfff1cdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostAdmin.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.host.rmi;
+
+import java.rmi.registry.Registry;
+import java.util.List;
+
+/* RMI Service hosting Admin Interface to be implemented by host environments that allows SCA Components
+ * to register RMI Services to handle inbound service requests over RMI to SCA Components. This interface
+ * can be used by admin functions to obtain information on RMI registries started and running in the host
+ * environment
+ */
+
+public interface RMIHostAdmin {
+ //gets all RMI registries running on the host. Each element of the list is an object of type
+ //java.rmi.registry
+ List getAllRegistries() throws RMIHostRuntimeException;
+
+ //gets a registry that is running at a particular port
+ Registry getRegistry(int port) throws RMIHostRuntimeException;
+
+ //more methods to be added
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostException.java
new file mode 100644
index 0000000000..5d7733927d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostException.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.host.rmi;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * This exception will relate to situations where the end applicaition's input is the cause of the exception
+ *
+ * @version $Rev$ $Date$
+ */
+public class RMIHostException extends TuscanyException {
+ private static final long serialVersionUID = 8031031440259175970L;
+
+ public RMIHostException() {
+ }
+
+ public RMIHostException(String message) {
+ super(message);
+ }
+
+ public RMIHostException(Throwable e) {
+ super(e);
+ }
+
+ public RMIHostException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostRuntimeException.java
new file mode 100644
index 0000000000..35b207b5d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/rmi/RMIHostRuntimeException.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.host.rmi;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * This exception relates to cases where there is a problem with the
+ * Host runtime
+ *
+ */
+public class RMIHostRuntimeException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = -1L;
+
+ public RMIHostRuntimeException() {
+ }
+
+ public RMIHostRuntimeException(String message) {
+ super(message);
+ }
+
+ public RMIHostRuntimeException(Throwable e) {
+ super(e);
+ }
+
+ public RMIHostRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/InitializationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/InitializationException.java
new file mode 100644
index 0000000000..20b518609e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/InitializationException.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.host.runtime;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public class InitializationException extends TuscanyException {
+
+ public InitializationException(String message) {
+ super(message);
+ }
+
+ public InitializationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/ShutdownException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/ShutdownException.java
new file mode 100644
index 0000000000..769c928471
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/ShutdownException.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.host.runtime;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes an error during runtime shutdown
+ *
+ * @version $Rev$ $Date$
+ */
+public class ShutdownException extends TuscanyException {
+
+ public ShutdownException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
new file mode 100644
index 0000000000..5c3ab06337
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.host.runtime;
+
+import java.net.URL;
+
+import org.apache.tuscany.host.MonitorFactory;
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.host.management.ManagementService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TuscanyRuntime {
+ /**
+ * Returns the location of the SCDL used to boot this runtime.
+ *
+ * @return the location of the SCDL used to boot this runtime
+ */
+ URL getSystemScdl();
+
+ /**
+ * Sets the location of the SCDL used to boot this runtime.
+ *
+ * @param systemScdl the location of the SCDL used to boot this runtime
+ */
+ void setSystemScdl(URL systemScdl);
+
+ /**
+ * Returns the host ClassLoader that is parent to all Tuscany classloaders.
+ *
+ * @return the host's ClassLoader
+ */
+ ClassLoader getHostClassLoader();
+
+ /**
+ * Sets the host ClassLoader; this will be a parent for all Tuscany classloaders.
+ *
+ * @param classLoader the host's ClassLoader
+ */
+ void setHostClassLoader(ClassLoader classLoader);
+
+ /**
+ * Returns the info this runtime will make available to service components.
+ *
+ * @return the info this runtime will make available to service components
+ */
+ RuntimeInfo getRuntimeInfo();
+
+ /**
+ * Sets the info this runtime should make available to service components. The instance supplied here should be
+ * registered in the system composite with the name {@link RuntimeInfo#COMPONENT_NAME "RuntimeInfo"}.
+ *
+ * @param runtimeInfo the information this runtime should make available to service components
+ */
+ void setRuntimeInfo(RuntimeInfo runtimeInfo);
+
+ /**
+ * Returns the MonitorFactory that this runtime is using.
+ *
+ * @return the MonitorFactory that this runtime is using
+ */
+ MonitorFactory getMonitorFactory();
+
+ /**
+ * Sets the MonitorFactory that this runtime should use.
+ *
+ * @param monitorFactory the MonitorFactory that this runtime should use
+ */
+ void setMonitorFactory(MonitorFactory monitorFactory);
+
+ /**
+ * Sets the ManagementService that this runtime should use.
+ *
+ * @param managementService the ManagementService that this runtime should use
+ */
+ void setManagementService(ManagementService<?> managementService);
+
+ /**
+ * Returns the ManagementService that this runtime is using.
+ *
+ * @return the ManagementService that this runtime is using
+ */
+ ManagementService<?> getManagementService();
+
+ /**
+ * Initialize a runtime.
+ *
+ * @throws InitializationException if there is an error initializing the runtime
+ */
+ void initialize() throws InitializationException;
+
+ /**
+ * Destroy the runtime. Any further invocations should result in an error.
+ *
+ * @throws ShutdownException if there is an error destroying the runtime
+ */
+ void destroy() throws ShutdownException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/servlet/ServletRequestInjector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/servlet/ServletRequestInjector.java
new file mode 100644
index 0000000000..e4b11aee90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/servlet/ServletRequestInjector.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.host.servlet;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * Interface to a system component that dispatches servlet requests to the Tuscany runtime
+ */
+public interface ServletRequestInjector {
+
+ /**
+ * Dispatch servlet requests to the Tuscany runtime
+ *
+ * @param req the ServletRequest object that contains the request the client made of the servlet
+ * @param res the ServletResponse object that contains the response the servlet returns to the client
+ * @throws ServletException if the request cannot be handled
+ * @throws IOException if an input or output error occurs while handling the request
+ */
+ void service(ServletRequest req, ServletResponse res) throws ServletException, IOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostExceptionTestCase.java
new file mode 100644
index 0000000000..0e62dbb3e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostExceptionTestCase.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.host.rmi;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RMIHostExceptionTestCase extends TestCase {
+ private static final Throwable CAUSE = new Throwable("Cause");
+ private static final String MESSAGE = "Message";
+
+ public void testNoArgConstructor() {
+ Exception ex = new RMIHostException();
+ assertNull(ex.getMessage());
+ assertNull(ex.getCause());
+ }
+
+ public void testMessageConstructor() {
+ Exception ex = new RMIHostException(MESSAGE);
+ assertEquals(MESSAGE, ex.getMessage());
+ assertNull(ex.getCause());
+ }
+
+ public void testThrowableConstructor() {
+ Exception ex = new RMIHostException(CAUSE);
+ assertEquals(CAUSE.getClass().getName() + ": " + CAUSE.getMessage(), ex.getMessage());
+ assertEquals(CAUSE, ex.getCause());
+ }
+
+ public void testMessageThrowableConstructor() {
+ Exception ex = new RMIHostException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, ex.getMessage());
+ assertEquals(CAUSE, ex.getCause());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostRuntimeExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostRuntimeExceptionTestCase.java
new file mode 100644
index 0000000000..5071a68132
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/host-api/src/test/java/org/apache/tuscany/host/rmi/RMIHostRuntimeExceptionTestCase.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.host.rmi;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RMIHostRuntimeExceptionTestCase extends TestCase {
+ private static final Throwable CAUSE = new Throwable("Cause");
+ private static final String MESSAGE = "Message";
+
+ public void testNoArgConstructor() {
+ Exception ex = new RMIHostRuntimeException();
+ assertNull(ex.getMessage());
+ assertNull(ex.getCause());
+ }
+
+ public void testMessageConstructor() {
+ Exception ex = new RMIHostRuntimeException(MESSAGE);
+ assertSame(MESSAGE, ex.getMessage());
+ assertNull(ex.getCause());
+ }
+
+ public void testThrowableConstructor() {
+ Exception ex = new RMIHostRuntimeException(CAUSE);
+ assertEquals(CAUSE.getClass().getName() + ": " + CAUSE.getMessage(), ex.getMessage());
+ assertSame(CAUSE, ex.getCause());
+ }
+
+ public void testMessageThrowableConstructor() {
+ Exception ex = new RMIHostRuntimeException(MESSAGE, CAUSE);
+ assertSame(MESSAGE, ex.getMessage());
+ assertSame(CAUSE, ex.getCause());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/pom.xml
new file mode 100644
index 0000000000..b5e992a52c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/pom.xml
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Kernel Sub-Project</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+
+ <properties>
+ <!-- version the SCA API that we implement -->
+ <scaSpecVersion>1.0</scaSpecVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <!-- dependencies used by the kernel -->
+ <dependencyManagement>
+ <dependencies>
+ <!-- org.osoa.sca API -->
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${scaSpecVersion}</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- javax.servlet API -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- javax.resource.spi.Work API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- java.xml.stream API -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- junit version -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- EasyMock version -->
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>api</module>
+ <module>host-api</module>
+ <module>spi</module>
+ <module>core</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>api</module>
+ <module>host-api</module>
+ <module>spi</module>
+ <module>core</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>api</module>
+ <module>host-api</module>
+ <module>spi</module>
+ <module>core</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>javadoc</id>
+ <modules>
+ <module>api</module>
+ <module>host-api</module>
+ <module>spi</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.checkstyle
new file mode 100644
index 0000000000..2220ea6512
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.checkstyle
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <local-check-config name="Tuscany" location="F:\TuscanyLatest\buildtools\src\main\resources\tuscany-checkstyle.xml" type="external" description="">
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.pmd b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.pmd
new file mode 100644
index 0000000000..9606e17e2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.pmd
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/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/spi/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/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/spi/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/pom.xml
new file mode 100644
index 0000000000..928fe72439
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-spi</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA SPI</name>
+ <description>Tuscany Service Provider Interfaces.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-host-api</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/doc/Context Model.emx b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/doc/Context Model.emx
new file mode 100644
index 0000000000..0445ea5a6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/doc/Context Model.emx
@@ -0,0 +1,673 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--xtools2_universal_type_manager-->
+<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.ibm.com/xtools/1.5.0/Notation" xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML" xmlns:umlnotation="http://www.ibm.com/xtools/1.5.0/Umlnotation" xmi:id="_al1S8NovEdqRBPR5WyT36A" name="Context Model" appliedProfile="_al1S9NovEdqRBPR5WyT36A _al1S99ovEdqRBPR5WyT36A _al1S-tovEdqRBPR5WyT36A _al1S_dovEdqRBPR5WyT36A _al1TANovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S8dovEdqRBPR5WyT36A" source="uml2.diagrams" references="_al1S8tovEdqRBPR5WyT36A">
+ <contents xmi:type="notation:Diagram" xmi:id="_al1S8tovEdqRBPR5WyT36A" type="Class" name="Main">
+ <children xmi:id="_ePDcYdovEdqRBPR5WyT36A" sourceEdges="_Fd3lQdowEdqRBPR5WyT36A _R5Rjwdo1EdqRBPR5WyT36A _pdfmkNo2EdqRBPR5WyT36A" targetEdges="_hmIF4dovEdqRBPR5WyT36A _mu9A4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" element="_ePDcYNovEdqRBPR5WyT36A">
+ <children xmi:id="_ePJjANovEdqRBPR5WyT36A" type="ImageCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_ePJjAdovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_ePJjAtovEdqRBPR5WyT36A" type="Stereotype" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjA9ovEdqRBPR5WyT36A" type="Kind" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjBNovEdqRBPR5WyT36A" type="Name" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjBdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjBtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ePJjB9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ePJjCdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ePDcYtovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ePDcY9ovEdqRBPR5WyT36A" x="6693" y="3545"/>
+ </children>
+ <children xmi:id="_fs1pANovEdqRBPR5WyT36A" sourceEdges="_hmIF4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" targetEdges="_xInjYdovEdqRBPR5WyT36A" element="_fsviYNovEdqRBPR5WyT36A">
+ <children xmi:id="_fs1pA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_fs1pBNovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_fs1pBdovEdqRBPR5WyT36A" type="Stereotype" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pBtovEdqRBPR5WyT36A" type="Kind" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pB9ovEdqRBPR5WyT36A" type="Name" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pCNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pCdovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_fs1pCtovEdqRBPR5WyT36A" type="OperationCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pC9ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_fs1pDNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pDdovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_fs1pAdovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fs1pAtovEdqRBPR5WyT36A" x="2226" y="8268"/>
+ </children>
+ <children xmi:id="_ikr_4NovEdqRBPR5WyT36A" sourceEdges="_mu9A4dovEdqRBPR5WyT36A" element="_ikl5QNovEdqRBPR5WyT36A">
+ <children xmi:id="_ikr_49ovEdqRBPR5WyT36A" type="ImageCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_ikr_5NovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_ikr_5dovEdqRBPR5WyT36A" type="Stereotype" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_5tovEdqRBPR5WyT36A" type="Kind" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_59ovEdqRBPR5WyT36A" type="Name" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_6NovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_6dovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ikr_6tovEdqRBPR5WyT36A" type="OperationCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_69ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ikr_7NovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_7dovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ikr_4dovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ikr_4tovEdqRBPR5WyT36A" x="9222" y="8268"/>
+ </children>
+ <children xmi:id="_tZF9odovEdqRBPR5WyT36A" sourceEdges="_xInjYdovEdqRBPR5WyT36A _BkUg0dowEdqRBPR5WyT36A" element="_tZF9oNovEdqRBPR5WyT36A">
+ <children xmi:id="_tZF9pNovEdqRBPR5WyT36A" type="ImageCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_tZF9pdovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_tZF9ptovEdqRBPR5WyT36A" type="Stereotype" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9p9ovEdqRBPR5WyT36A" type="Kind" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9qNovEdqRBPR5WyT36A" type="Name" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9qdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9qtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_tZF9q9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_tZF9rdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_tZF9otovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_tZF9o9ovEdqRBPR5WyT36A" x="2226" y="12084"/>
+ </children>
+ <children xmi:id="_z_m-oNovEdqRBPR5WyT36A" sourceEdges="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_3Ic-4NovEdqRBPR5WyT36A _9XeF4tovEdqRBPR5WyT36A _Fd3lQdowEdqRBPR5WyT36A" element="_z_g4ANovEdqRBPR5WyT36A">
+ <children xmi:id="_z_m-o9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_z_m-pNovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_z_m-pdovEdqRBPR5WyT36A" type="Stereotype" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-ptovEdqRBPR5WyT36A" type="Kind" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-p9ovEdqRBPR5WyT36A" type="Name" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-qNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-qdovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_z_m-qtovEdqRBPR5WyT36A" type="OperationCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-q9ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_z_m-rNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-rdovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_z_m-odovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_z_m-otovEdqRBPR5WyT36A" x="17172" y="6996"/>
+ </children>
+ <children xmi:id="_1y-ZsNovEdqRBPR5WyT36A" sourceEdges="_3Ic-4NovEdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" targetEdges="_BkUg0dowEdqRBPR5WyT36A" element="_1yyMcNovEdqRBPR5WyT36A">
+ <children xmi:id="_1y-Zs9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_1y-ZtNovEdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_1y-ZtdovEdqRBPR5WyT36A" type="Stereotype" element="_1yyMcNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_1y-ZttovEdqRBPR5WyT36A" type="Name" element="_1yyMcNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_1y-Zt9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZuNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-ZudovEdqRBPR5WyT36A" type="OperationCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZutovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-Zu9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZvNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-ZvdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_1y-ZvtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_1y-ZsdovEdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1y-ZstovEdqRBPR5WyT36A" x="13992" y="12084"/>
+ </children>
+ <children xmi:id="_4WSrANovEdqRBPR5WyT36A" sourceEdges="_9XeF4tovEdqRBPR5WyT36A _9PaR4No2EdqRBPR5WyT36A" element="_4WMkYNovEdqRBPR5WyT36A">
+ <children xmi:id="_4WSrA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_4WSrBNovEdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_4WSrBdovEdqRBPR5WyT36A" type="Stereotype" element="_4WMkYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_4WSrBtovEdqRBPR5WyT36A" type="Name" element="_4WMkYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_4WSrB9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrCdovEdqRBPR5WyT36A" type="OperationCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrC9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrDNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrDdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_4WSrDtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_4WSrAdovEdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4WSrAtovEdqRBPR5WyT36A" x="19716" y="12084"/>
+ </children>
+ <children xmi:id="_o2m3oNo0EdqRBPR5WyT36A" targetEdges="_9PaR4No2EdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" element="_o2gxANo0EdqRBPR5WyT36A">
+ <children xmi:id="_o2m3o9o0EdqRBPR5WyT36A" type="ImageCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_o2m3pNo0EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_o2m3pdo0EdqRBPR5WyT36A" type="Stereotype" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3pto0EdqRBPR5WyT36A" type="Kind" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3p9o0EdqRBPR5WyT36A" type="Name" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3qNo0EdqRBPR5WyT36A" type="AttributeCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3qdo0EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_o2m3qto0EdqRBPR5WyT36A" type="OperationCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3q9o0EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_o2m3rNo0EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3rdo0EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_o2m3odo0EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_o2m3oto0EdqRBPR5WyT36A" x="23532" y="6996"/>
+ </children>
+ <children xmi:id="_M0FLkNo1EdqRBPR5WyT36A" targetEdges="_R5Rjwdo1EdqRBPR5WyT36A _V7zlEdo1EdqRBPR5WyT36A" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <children xmi:id="_M0FLk9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_M0FLlNo1EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_M0FLldo1EdqRBPR5WyT36A" type="Stereotype" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLlto1EdqRBPR5WyT36A" type="Kind" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLl9o1EdqRBPR5WyT36A" type="Name" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLmNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLmdo1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_M0FLmto1EdqRBPR5WyT36A" type="OperationCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLm9o1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_M0FLnNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLndo1EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_M0FLkdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_M0FLkto1EdqRBPR5WyT36A" x="6678" y="318"/>
+ </children>
+ <children xmi:id="_TJHbANo1EdqRBPR5WyT36A" sourceEdges="_V7zlEdo1EdqRBPR5WyT36A" targetEdges="_cN4xsdo2EdqRBPR5WyT36A" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <children xmi:id="_TJHbA9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_TJHbBNo1EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_TJHbBdo1EdqRBPR5WyT36A" type="Stereotype" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbBto1EdqRBPR5WyT36A" type="Kind" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbB9o1EdqRBPR5WyT36A" type="Name" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbCNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbCdo1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_TJHbCto1EdqRBPR5WyT36A" type="OperationCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbC9o1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_TJHbDNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbDdo1EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_TJHbAdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TJHbAto1EdqRBPR5WyT36A" x="16854" y="318"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLDiagramStyle" xmi:id="_al1S89ovEdqRBPR5WyT36A"/>
+ <edges xmi:id="_hmIF4dovEdqRBPR5WyT36A" element="_hmIF4NovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_hmIF5NovEdqRBPR5WyT36A" type="NameLabel" element="_hmIF4NovEdqRBPR5WyT36A">
+ <children xmi:id="_hmIF5tovEdqRBPR5WyT36A" type="Stereotype" element="_hmIF4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_hmIF59ovEdqRBPR5WyT36A" type="Name" element="_hmIF4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_hmIF5dovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_hmIF4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hmIF49ovEdqRBPR5WyT36A" points="[26, -31, -110, 148]$[140, -148, 4, 31]"/>
+ </edges>
+ <edges xmi:id="_mu9A4dovEdqRBPR5WyT36A" element="_mu9A4NovEdqRBPR5WyT36A" source="_ikr_4NovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_mu9A5NovEdqRBPR5WyT36A" type="NameLabel" element="_mu9A4NovEdqRBPR5WyT36A">
+ <children xmi:id="_mu9A5tovEdqRBPR5WyT36A" type="Stereotype" element="_mu9A4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_mu9A59ovEdqRBPR5WyT36A" type="Name" element="_mu9A4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_mu9A5dovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_mu9A4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mu9A49ovEdqRBPR5WyT36A" points="[-185, -820, 2937, 3916]$[-185, -3042, 2937, 1694]$[-3255, -3042, -133, 1694]$[-3255, -3916, -133, 820]"/>
+ </edges>
+ <edges xmi:id="_pe3jwNovEdqRBPR5WyT36A" element="_peM1YNovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jw9ovEdqRBPR5WyT36A" type="NameLabel" element="_peM1YNovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jxdovEdqRBPR5WyT36A" type="Stereotype" element="_peM1YNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_pe3jxtovEdqRBPR5WyT36A" type="Name" element="_peM1YNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jxNovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pe3jx9ovEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jydovEdqRBPR5WyT36A" type="ToMultiplicity" element="_peM1YtovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jyNovEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pe3jytovEdqRBPR5WyT36A" type="ToRoleLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jzNovEdqRBPR5WyT36A" type="ToRole" element="_peM1YtovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jy9ovEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pe3jzdovEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jz9ovEdqRBPR5WyT36A" type="FromMultiplicity" element="_peM1YdovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jztovEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pe3j0NovEdqRBPR5WyT36A" type="FromRoleLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j0tovEdqRBPR5WyT36A" type="FromRole" element="_peM1YdovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j0dovEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pe3j09ovEdqRBPR5WyT36A" type="ToQualifierLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j1dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YtovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j1tovEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j1NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pe3j19ovEdqRBPR5WyT36A" type="FromQualifierLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j2dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YdovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j2tovEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j2NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pe3jwdovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pe3jwtovEdqRBPR5WyT36A" points="[-317, -820, -3916, 3916]$[-1931, -4762, -5530, -26]$[2382, -4762, -1217, -26]"/>
+ </edges>
+ <edges xmi:id="_xInjYdovEdqRBPR5WyT36A" element="_xInjYNovEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_fs1pANovEdqRBPR5WyT36A">
+ <children xmi:id="_xInjZNovEdqRBPR5WyT36A" type="NameLabel" element="_xInjYNovEdqRBPR5WyT36A">
+ <children xmi:id="_xInjZtovEdqRBPR5WyT36A" type="Stereotype" element="_xInjYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_xInjZ9ovEdqRBPR5WyT36A" type="Name" element="_xInjYNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_xInjZdovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_xInjYtovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_xInjY9ovEdqRBPR5WyT36A" points="[-4, -31, 1, 113]$[-4, -115, 1, 29]"/>
+ </edges>
+ <edges xmi:id="_3Ic-4NovEdqRBPR5WyT36A" element="_3IW4QNovEdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_3Ic-49ovEdqRBPR5WyT36A" type="NameLabel" element="_3IW4QNovEdqRBPR5WyT36A">
+ <children xmi:id="_3Ic-5dovEdqRBPR5WyT36A" type="Stereotype" element="_3IW4QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_3Ic-5tovEdqRBPR5WyT36A" type="Name" element="_3IW4QNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_3Ic-5NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_3Ic-4dovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3Ic-4tovEdqRBPR5WyT36A" points="[6, -24, -37, 154]$[-22, -170, -65, 8]"/>
+ </edges>
+ <edges xmi:id="_9XeF4tovEdqRBPR5WyT36A" element="_9XeF4NovEdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_9XeF5dovEdqRBPR5WyT36A" type="NameLabel" element="_9XeF4NovEdqRBPR5WyT36A">
+ <children xmi:id="_9XeF59ovEdqRBPR5WyT36A" type="Stereotype" element="_9XeF4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_9XeF6NovEdqRBPR5WyT36A" type="Name" element="_9XeF4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9XeF5tovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9XeF49ovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9XeF5NovEdqRBPR5WyT36A" points="[-23, -23, 162, 151]$[-121, -170, 64, 4]"/>
+ </edges>
+ <edges xmi:id="_BkUg0dowEdqRBPR5WyT36A" element="_Bj8GUNowEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_1y-ZsNovEdqRBPR5WyT36A">
+ <children xmi:id="_BkancNowEdqRBPR5WyT36A" type="NameLabel" element="_Bj8GUNowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanctowEdqRBPR5WyT36A" type="Stereotype" element="_Bj8GUNowEdqRBPR5WyT36A"/>
+ <children xmi:id="_Bkanc9owEdqRBPR5WyT36A" type="Name" element="_Bj8GUNowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkancdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_BkandNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkandtowEdqRBPR5WyT36A" type="ToMultiplicity" element="_Bj8GUtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanddowEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Bkand9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanedowEdqRBPR5WyT36A" type="ToRole" element="_Bj8GUtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkaneNowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_BkanetowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanfNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_Bj8GUdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Bkane9owEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_BkanfdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_Bkanf9owEdqRBPR5WyT36A" type="FromRole" element="_Bj8GUdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanftowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_BkangNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkangtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkang9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkangdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_BkanhNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanhtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkanh9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanhdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_BkUg0towEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_BkUg09owEdqRBPR5WyT36A" points="[83, -24, -490, 123]$[486, -151, -87, -4]"/>
+ </edges>
+ <edges xmi:id="_Fd3lQdowEdqRBPR5WyT36A" element="_FdlRYNowEdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lRNowEdqRBPR5WyT36A" type="NameLabel" element="_FdlRYNowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lRtowEdqRBPR5WyT36A" type="Stereotype" element="_FdlRYNowEdqRBPR5WyT36A"/>
+ <children xmi:id="_Fd3lR9owEdqRBPR5WyT36A" type="Name" element="_FdlRYNowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lRdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_Fd3lSNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lStowEdqRBPR5WyT36A" type="ToMultiplicity" element="_FdlRYtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lSdowEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Fd3lS9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lTdowEdqRBPR5WyT36A" type="ToRole" element="_FdlRYtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lTNowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_Fd3lTtowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lUNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_FdlRYdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lT9owEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Fd3lUdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lU9owEdqRBPR5WyT36A" type="FromRole" element="_FdlRYdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lUtowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_Fd3lVNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lVtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYtowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lV9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lVdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_Fd3lWNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lWtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYdowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lW9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lWdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_Fd3lQtowEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Fd3lQ9owEdqRBPR5WyT36A" points="[46, -11, -369, -9]$[351, -11, -64, -9]"/>
+ </edges>
+ <edges xmi:id="_R5Rjwdo1EdqRBPR5WyT36A" element="_R5RjwNo1EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
+ <children xmi:id="_R5RjxNo1EdqRBPR5WyT36A" type="NameLabel" element="_R5RjwNo1EdqRBPR5WyT36A">
+ <children xmi:id="_R5Rjxto1EdqRBPR5WyT36A" type="Stereotype" element="_R5RjwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_R5Rjx9o1EdqRBPR5WyT36A" type="Name" element="_R5RjwNo1EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_R5Rjxdo1EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_R5Rjwto1EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_R5Rjw9o1EdqRBPR5WyT36A" points="[-2, -31, -2, 91]$[-2, -91, -2, 31]"/>
+ </edges>
+ <edges xmi:id="_V7zlEdo1EdqRBPR5WyT36A" element="_V7zlENo1EdqRBPR5WyT36A" source="_TJHbANo1EdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
+ <children xmi:id="_V7zlFNo1EdqRBPR5WyT36A" type="NameLabel" element="_V7zlENo1EdqRBPR5WyT36A">
+ <children xmi:id="_V7zlFto1EdqRBPR5WyT36A" type="Stereotype" element="_V7zlENo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_V7zlF9o1EdqRBPR5WyT36A" type="Name" element="_V7zlENo1EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_V7zlFdo1EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_V7zlEto1EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_V7zlE9o1EdqRBPR5WyT36A" points="[-73, 0, 339, 0]$[-457, 0, -45, 0]"/>
+ </edges>
+ <edges xmi:id="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_pdfmkNo2EdqRBPR5WyT36A" element="_cNskcNo2EdqRBPR5WyT36A" source="_z_m-oNovEdqRBPR5WyT36A" target="_TJHbANo1EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xtNo2EdqRBPR5WyT36A" type="NameLabel" element="_cNskcNo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xtto2EdqRBPR5WyT36A" type="Stereotype" element="_cNskcNo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_cN4xt9o2EdqRBPR5WyT36A" type="Name" element="_cNskcNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xtdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_cN4xuNo2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xuto2EdqRBPR5WyT36A" type="ToMultiplicity" element="_cNskcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xudo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_cN4xu9o2EdqRBPR5WyT36A" type="ToRoleLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xvdo2EdqRBPR5WyT36A" type="ToRole" element="_cNskcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xvNo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_cN_fYNo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fYto2EdqRBPR5WyT36A" type="FromMultiplicity" element="_cNskcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fYdo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_cN_fY9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fZdo2EdqRBPR5WyT36A" type="FromRole" element="_cNskcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZNo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_cN_fZto2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_faNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcto2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fado2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZ9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_cN_fato2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fbNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fbdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fa9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_cN4xsto2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cN4xs9o2EdqRBPR5WyT36A" points="[-2, -29, 1, 91]$[26, -89, 29, 31]"/>
+ </edges>
+ <edges xmi:id="_pdfmkNo2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_cN4xsdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfml9o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmmdo2EdqRBPR5WyT36A" type="ToMultiplicity" element="_pdTZUdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmmNo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pdfmmto2EdqRBPR5WyT36A" type="ToRoleLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmnNo2EdqRBPR5WyT36A" type="ToRole" element="_pdTZUdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmm9o2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pdfmndo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmn9o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_pdTZUNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmnto2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pdfmoNo2EdqRBPR5WyT36A" type="FromRoleLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmoto2EdqRBPR5WyT36A" type="FromRole" element="_pdTZUNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmodo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pdfmo9o2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmpdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmpto2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmpNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pdfmp9o2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmqdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmqto2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmqNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pdfmq9o2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmrto2EdqRBPR5WyT36A" type="ImageCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_pdfmr9o2EdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_pdfmsNo2EdqRBPR5WyT36A" type="Stereotype" element="_pdHMENo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_pdfmsdo2EdqRBPR5WyT36A" type="Name" element="_pdHMENo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_pdfmsto2EdqRBPR5WyT36A" type="AttributeCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfms9o2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmtNo2EdqRBPR5WyT36A" type="OperationCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmtdo2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmtto2EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmt9o2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmuNo2EdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_pdfmudo2EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_pdfmrNo2EdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pdfmrdo2EdqRBPR5WyT36A" y="1323"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pdfmkdo2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pdfmkto2EdqRBPR5WyT36A" points="[46, 3, -366, 94]$[412, -91, 0, 0]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_pdrz0No2EdqRBPR5WyT36A" id="100"/>
+ </edges>
+ <edges xmi:id="_9PaR4No2EdqRBPR5WyT36A" element="_9PH-ANo2EdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR49o2EdqRBPR5WyT36A" type="NameLabel" element="_9PH-ANo2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR5do2EdqRBPR5WyT36A" type="Stereotype" element="_9PH-ANo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_9PaR5to2EdqRBPR5WyT36A" type="Name" element="_9PH-ANo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR5No2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9PaR59o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR6do2EdqRBPR5WyT36A" type="ToMultiplicity" element="_9PH-Ato2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR6No2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9PaR6to2EdqRBPR5WyT36A" type="ToRoleLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR7No2EdqRBPR5WyT36A" type="ToRole" element="_9PH-Ato2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR69o2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9PaR7do2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR79o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_9PH-Ado2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR7to2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9PaR8No2EdqRBPR5WyT36A" type="FromRoleLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR8to2EdqRBPR5WyT36A" type="FromRole" element="_9PH-Ado2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR8do2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9PgYgNo2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PgYgto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYg9o2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYgdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9PgYhNo2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PgYhto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYh9o2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYhdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9PaR4do2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9PaR4to2EdqRBPR5WyT36A" points="[12, -24, -94, 162]$[80, -155, -26, 31]"/>
+ </edges>
+ <edges xmi:id="_9-BEUNo2EdqRBPR5WyT36A" element="_99uwcNo2EdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
+ <children xmi:id="_9-BEU9o2EdqRBPR5WyT36A" type="NameLabel" element="_99uwcNo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK8No2EdqRBPR5WyT36A" type="Stereotype" element="_99uwcNo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_9-HK8do2EdqRBPR5WyT36A" type="Name" element="_99uwcNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-BEVNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9-HK8to2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK9No2EdqRBPR5WyT36A" type="ToMultiplicity" element="_99uwcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK89o2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9-HK9do2EdqRBPR5WyT36A" type="ToRoleLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK99o2EdqRBPR5WyT36A" type="ToRole" element="_99uwcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK9to2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9-HK-No2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK-to2EdqRBPR5WyT36A" type="FromMultiplicity" element="_99uwcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK-do2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9-HK-9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK_do2EdqRBPR5WyT36A" type="FromRole" element="_99uwcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_No2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9-HK_to2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HLANo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcto2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLAdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9-HLAto2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HLBNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLBdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HLA9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9-BEUdo2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9-BEUto2EdqRBPR5WyT36A" points="[49, -24, -290, 162]$[404, -163, 65, 23]"/>
+ </edges>
+ </contents>
+ </eAnnotations>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S9NovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S9dovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S9tovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S99ovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S-NovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S-dovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S-tovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S-9ovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S_NovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S_dovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S_tovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S_9ovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
+ <importedProfile href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1TANovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1TAdovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1TAtovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
+ <importedProfile href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
+ </packageImport>
+ <packageImport xmi:id="_al1TA9ovEdqRBPR5WyT36A">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_EfRZoK86EdieaYgxtVWN8Q"/>
+ </packageImport>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_ePDcYNovEdqRBPR5WyT36A" name="Context">
+ <generalization xmi:id="_R5RjwNo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_FdlRYdowEdqRBPR5WyT36A" name="scopecontext" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_FdlRZNowEdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_FdlRY9owEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_fsviYNovEdqRBPR5WyT36A" name="CompositeContext">
+ <generalization xmi:id="_hmIF4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_peM1YdovEdqRBPR5WyT36A" name="context" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A" aggregation="composite">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_peM1ZNovEdqRBPR5WyT36A" value="-1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_peM1Y9ovEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_ikl5QNovEdqRBPR5WyT36A" name="AtomicContext">
+ <generalization xmi:id="_mu9A4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_peM1YNovEdqRBPR5WyT36A" memberEnd="_peM1YdovEdqRBPR5WyT36A _peM1YtovEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_peM1YtovEdqRBPR5WyT36A" visibility="private" type="_fsviYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_tZF9oNovEdqRBPR5WyT36A" name="DeploymentContext">
+ <generalization xmi:id="_xInjYNovEdqRBPR5WyT36A" general="_fsviYNovEdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_Bj8GUdowEdqRBPR5WyT36A" name="modulescopecontext" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Bj8GVNowEdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Bj8GU9owEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_z_g4ANovEdqRBPR5WyT36A" name="ScopeContext">
+ <ownedAttribute xmi:id="_cNskcdo2EdqRBPR5WyT36A" name="instancewrapper" visibility="private" type="_TI7NwNo1EdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cNskdNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cNskc9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Class" xmi:id="_1yyMcNovEdqRBPR5WyT36A" name="ModuleScopeContext" clientDependency="_3IW4QNovEdqRBPR5WyT36A">
+ <implementation xmi:id="_3IW4QNovEdqRBPR5WyT36A" client="_1yyMcNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
+ <mapping xmi:id="_3IW4QdovEdqRBPR5WyT36A"/>
+ </implementation>
+ <ownedAttribute xmi:id="_99uwcdo2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_99uwdNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_99uwc9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Class" xmi:id="_4WMkYNovEdqRBPR5WyT36A" name="HTTPSessionScopeContext" clientDependency="_9XeF4NovEdqRBPR5WyT36A">
+ <implementation xmi:id="_9XeF4NovEdqRBPR5WyT36A" client="_4WMkYNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
+ <mapping xmi:id="_9XeF4dovEdqRBPR5WyT36A"/>
+ </implementation>
+ <ownedAttribute xmi:id="_9PH-Ado2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_9PH-BNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_9PH-A9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_Bj8GUNowEdqRBPR5WyT36A" memberEnd="_Bj8GUdowEdqRBPR5WyT36A _Bj8GUtowEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_Bj8GUtowEdqRBPR5WyT36A" visibility="private" type="_tZF9oNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_FdlRYNowEdqRBPR5WyT36A" memberEnd="_FdlRYdowEdqRBPR5WyT36A _FdlRYtowEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_FdlRYtowEdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_o2gxANo0EdqRBPR5WyT36A" name="ScopeRegistry"/>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_Mz_E8No1EdqRBPR5WyT36A" name="Lifecycle"/>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_TI7NwNo1EdqRBPR5WyT36A" name="InstanceWrapper">
+ <generalization xmi:id="_V7zlENo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_cNskcNo2EdqRBPR5WyT36A" memberEnd="_cNskcdo2EdqRBPR5WyT36A _cNskcto2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_cNskcto2EdqRBPR5WyT36A" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:AssociationClass" xmi:id="_pdHMENo2EdqRBPR5WyT36A" name="AssociationClass1" memberEnd="_pdTZUNo2EdqRBPR5WyT36A _pdTZUdo2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_pdTZUNo2EdqRBPR5WyT36A" visibility="private" type="_cNskcNo2EdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
+ <ownedEnd xmi:id="_pdTZUdo2EdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_9PH-ANo2EdqRBPR5WyT36A" memberEnd="_9PH-Ado2EdqRBPR5WyT36A _9PH-Ato2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_9PH-Ato2EdqRBPR5WyT36A" visibility="private" type="_4WMkYNovEdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_99uwcNo2EdqRBPR5WyT36A" memberEnd="_99uwcdo2EdqRBPR5WyT36A _99uwcto2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_99uwcto2EdqRBPR5WyT36A" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+</uml:Model>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.java
new file mode 100644
index 0000000000..e8597a55fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/AbstractLifecycle.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.spi;
+
+/**
+ * Base class providing a simple implementation of Lifecycle.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractLifecycle implements Lifecycle {
+ protected volatile int lifecycleState = UNINITIALIZED;
+
+ public int getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Set the current state of the Lifecycle.
+ *
+ * @param lifecycleState the new state
+ */
+ protected void setLifecycleState(int lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ public void start() {
+ setLifecycleState(RUNNING);
+ }
+
+ public void stop() {
+ setLifecycleState(STOPPED);
+ }
+
+ /**
+ * Returns the current lifecycle as a String (for example, "RUNNING").
+ *
+ * @return the current lifecycle as a String
+ */
+ public String toString() {
+ switch (lifecycleState) {
+ case Lifecycle.CONFIG_ERROR:
+ return "CONFIG_ERROR";
+ case Lifecycle.ERROR:
+ return "ERROR";
+ case Lifecycle.INITIALIZING:
+ return "INITIALIZING";
+ case Lifecycle.INITIALIZED:
+ return "INITIALIZED";
+ case Lifecycle.RUNNING:
+ return "RUNNING";
+ case Lifecycle.STOPPING:
+ return "STOPPING";
+ case Lifecycle.STOPPED:
+ return "STOPPED";
+ case Lifecycle.UNINITIALIZED:
+ return "UNINITIALIZED";
+ default:
+ return "UNKNOWN";
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.java
new file mode 100644
index 0000000000..641a4e5d21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/CoreRuntimeException.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.spi;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * The root exception for the runtime package. Exceptions occurring in the runtime are generally non-recoverable
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class CoreRuntimeException extends TuscanyRuntimeException {
+
+ public CoreRuntimeException() {
+ super();
+ }
+
+ public CoreRuntimeException(String message) {
+ super(message);
+ }
+
+
+ protected CoreRuntimeException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public CoreRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+ protected CoreRuntimeException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public CoreRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.java
new file mode 100644
index 0000000000..28bc8652b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/InvalidNameException.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.spi;
+
+/**
+ * Denotes an invalid name
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidNameException extends CoreRuntimeException {
+
+ public InvalidNameException() {
+ super();
+ }
+
+ public InvalidNameException(String message) {
+ super(message);
+ }
+
+ public InvalidNameException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidNameException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.java
new file mode 100644
index 0000000000..e8a0448e44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/Lifecycle.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.spi;
+
+/**
+ * Implementations adhere to runtime lifecycle semantics
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Lifecycle {
+ /* A configuration error state */
+ int CONFIG_ERROR = -1;
+ /* Has not been initialized */
+ int UNINITIALIZED = 0;
+ /* In the process of being configured and initialized */
+ int INITIALIZING = 1;
+ /* Instantiated and configured */
+ int INITIALIZED = 2;
+ /* Configured and initialized */
+ int RUNNING = 4;
+ /* In the process of being shutdown */
+ int STOPPING = 5;
+ /* Has been shutdown and removed from the composite */
+ int STOPPED = 6;
+ /* In an error state */
+ int ERROR = 7;
+
+ /**
+ * Returns the lifecycle state
+ *
+ * @see #UNINITIALIZED
+ * @see #INITIALIZING
+ * @see #INITIALIZED
+ * @see #RUNNING
+ * @see #STOPPING
+ * @see #STOPPED
+ */
+ int getLifecycleState();
+
+ /**
+ * Starts the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void start() throws CoreRuntimeException;
+
+ /**
+ * Stops the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void stop() throws CoreRuntimeException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.java
new file mode 100644
index 0000000000..580e928000
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectCreationException.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.spi;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Denotes an error creating a new object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCreationException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = -6423113430265944499L;
+
+ public ObjectCreationException() {
+ super();
+ }
+
+ public ObjectCreationException(String message) {
+ super(message);
+ }
+
+ public ObjectCreationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ObjectCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCreationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ObjectCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.java
new file mode 100644
index 0000000000..d505e14f61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/ObjectFactory.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.spi;
+
+/**
+ * Implementations create new instances of a particular type
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ObjectFactory<T> {
+
+ /**
+ * Return a instance of the type that this factory creates.
+ *
+ * @return a instance from this factory
+ */
+ T getInstance() throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.java
new file mode 100644
index 0000000000..575f69db18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/QualifiedName.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 org.apache.tuscany.spi;
+
+/**
+ * An evaluated name consisting of a part/port pair. In the runtime, a part generally 'contains' or 'provides' ports
+ * such as a component/service point or a component/reference pair.
+ *
+ * @version $Rev$ $Date$
+ */
+public class QualifiedName {
+ public static final String NAME_SEPARATOR = "/";
+
+ private String qName;
+ private String partName;
+ private String portName;
+
+ /**
+ * Constructs a new qualified name in the form of part/port where part is the parent context and port represents a
+ * child, which is either a service in the case of an atomic context or a contained context in the case of a
+ * composite.
+ *
+ * @throws InvalidNameException if the name is in an invalid format
+ */
+ public QualifiedName(String qualifiedName) throws InvalidNameException {
+ if (qualifiedName == null) {
+ return;
+ }
+ int pos = qualifiedName.indexOf(QualifiedName.NAME_SEPARATOR);
+ switch (pos) {
+ case-1:
+ partName = qualifiedName;
+ break;
+ case 0:
+ throw new InvalidNameException(qualifiedName);
+ default:
+ partName = qualifiedName.substring(0, pos);
+ portName = qualifiedName.substring(pos + 1);
+ break;
+ }
+ qName = qualifiedName;
+ }
+
+ /**
+ * Constructs a qualified name using the given part/port combination
+ *
+ * @param partName the part name
+ * @param portName the port name
+ */
+ public QualifiedName(String partName, String portName) {
+ this.partName = partName;
+ this.portName = portName;
+ this.qName = partName + '/' + portName;
+ }
+
+ /**
+ * Returns the parsed part name
+ */
+ public String getPartName() {
+ return partName;
+ }
+
+ /**
+ * Returns the parsed port name if the original is of the compound for part/port
+ */
+ public String getPortName() {
+ return portName;
+ }
+
+ /**
+ * Returns the full part/port name pair
+ */
+ public String getQualifiedName() {
+ return qName;
+ }
+
+ public String toString() {
+ return qName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.java
new file mode 100644
index 0000000000..0e48f1bc1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/annotation/Autowire.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.spi.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * A system annotation to inject an autowired instance
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Autowire {
+ /**
+ * The name of the autowire. If not specified then the name will be derived from the annotated field.
+ */
+ String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ */
+ boolean required() default true;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
new file mode 100644
index 0000000000..fed2898102
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.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.spi.bootstrap;
+
+/**
+ * Class that defines the names of well known component
+ *
+ * @version $Rev$ $Date$
+ */
+public final class ComponentNames {
+ /**
+ * The name of the component that forms the root of the runtime tree.
+ */
+ public static final String TUSCANY_RUNTIME = "tuscany.runtime";
+
+ /**
+ * The name of the component that is the root of the application composite tree.
+ */
+ public static final String TUSCANY_APPLICATION_ROOT = "tuscany.root.application";
+
+ /**
+ * The name of the component that is the root of the system composite tree.
+ */
+ public static final String TUSCANY_SYSTEM_ROOT = "tuscany.root.system";
+
+ /**
+ * The name of the top-level component in the system composite tree.
+ */
+ public static final String TUSCANY_SYSTEM = "tuscany.system";
+
+ /**
+ * The name of the component that contains the deployer.
+ */
+ public static final String TUSCANY_DEPLOYER = "deployer";
+
+ /**
+ * The name of the component that contains the deployer.
+ */
+ public static final String TUSCANY_WIRE_SERVICE = "wireService";
+
+ /**
+ * The name of the component that contains the contribution service.
+ */
+ public static final String TUSCANY_CONTRIBUTION_SERVICE = "contributionService";
+
+ /**
+ * The name of the component that contains the assmebly service.
+ */
+ public static final String TUSCANY_ASSEMBLY_SERVICE = "assemblyService";
+
+ private ComponentNames() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.java
new file mode 100644
index 0000000000..6e0184fbd6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/RuntimeComponent.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.spi.bootstrap;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.deployer.Deployer;
+
+/**
+ * Interface that represents the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponent extends CompositeComponent {
+ /**
+ * Returns the component that forms the root of the user component tree. All user components will be managed by
+ * composites that are children of this root.
+ *
+ * @return the root of the user component tree
+ */
+ CompositeComponent getRootComponent();
+
+ /**
+ * Returns the component that forms the root of the system component tree. All system components, components that
+ * provide system services needed by the Tuscany runtime itself, will be managed by composites that are children of
+ * this root.
+ *
+ * @return the root of the system component tree
+ */
+ CompositeComponent getSystemComponent();
+
+ /**
+ * Returns the deployer for this runtime. This interface can be used to deploy new SCA bundles to the runtime.
+ *
+ * @return the deployer for this runtime
+ * @throws TargetException if there is an error returning the deployer
+ */
+ Deployer getDeployer() throws TargetException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.java
new file mode 100644
index 0000000000..3e2ee38d35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BindingBuilder.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.spi.builder;
+
+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.model.BindingDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Responsible for processing a service or reference in an assembly configured with a particular binding. The builder
+ * will create and return corresponding {@link org.apache.tuscany.spi.component.ServiceBinding} or {@link
+ * org.apache.tuscany.spi.component.ReferenceBinding}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingBuilder<B extends BindingDefinition> {
+
+ /**
+ * Creates a service binding
+ *
+ * @param parent the containing composite component
+ * @param serviceDefinition the service the binding is configured for
+ * @param bindingDefinition the binding definition
+ * @param deploymentContext the current deployment context
+ * @return a service binding
+ * @throws BuilderException
+ */
+ ServiceBinding build(CompositeComponent parent,
+ ServiceDefinition serviceDefinition,
+ B bindingDefinition,
+ DeploymentContext deploymentContext) throws BuilderException;
+
+ ReferenceBinding build(CompositeComponent parent,
+ AbstractReferenceDefinition boundReferenceDefinition,
+ B bindingDefinition,
+ DeploymentContext deploymentContext) throws BuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
new file mode 100644
index 0000000000..0e11c93d8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Builder.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+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.SCAObject;
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Implementations build <code>SCAObject</code> types from model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Builder {
+ /**
+ * Builds a <code>Component</code> from a <code>ComponentDefinition</code>
+ *
+ * @param parent the composite that will be the parent of the newly built component
+ * @param definition the component definition as parsed from an SCA assembly
+ * @param context the current deployment context
+ * @return the newly created component
+ * @throws BuilderException
+ */
+ <I extends Implementation<?>> Component build(CompositeComponent parent,
+ ComponentDefinition<I> definition,
+ DeploymentContext context) throws BuilderException;
+
+ /**
+ * Builds a <code>Service</code> and its bindings from a <code>ServiceDefinition</code>
+ *
+ * @param parent the composite that will be the parent of the newly built service
+ * @param definition the service definition as parsed from an SCA assembly
+ * @param context the current deployment context
+ * @return the newly created service
+ * @throws BuilderException
+ */
+ Service build(CompositeComponent parent, ServiceDefinition definition, DeploymentContext context)
+ throws BuilderException;
+
+ /**
+ * Builds a <code>Reference</code> and its bindings from a <code>ReferenceDefinition</code>
+ *
+ * @param parent the composite that will be the parent of the newly built reference
+ * @param definition the reference definition as parsed from an SCA assembly
+ * @param context the current deployment context
+ * @return the newly created reference
+ * @throws BuilderException
+ */
+ Reference build(CompositeComponent parent, AbstractReferenceDefinition definition, DeploymentContext context)
+ throws BuilderException;
+
+ /**
+ * Builds a <code>SCAObject</code>
+ * @param parent
+ * @param modelObject
+ * @param context
+ * @return
+ * @throws BuilderException
+ */
+ SCAObject build(SCAObject parent, ModelObject modelObject, DeploymentContext context)
+ throws BuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.java
new file mode 100644
index 0000000000..6e9f2ef95d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderConfigException.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.spi.builder;
+
+/**
+ * Represents an error processing an assembly model
+ *
+ * @version $Rev$ $Date$
+ */
+public class BuilderConfigException extends BuilderException {
+
+ public BuilderConfigException() {
+ super();
+ }
+
+ public BuilderConfigException(String message) {
+ super(message);
+ }
+
+ public BuilderConfigException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public BuilderConfigException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BuilderConfigException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.java
new file mode 100644
index 0000000000..846d52492c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderException.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.spi.builder;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * The root exception for the builder package. Builder exceptions denote a non-recoverable failure.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BuilderException extends TuscanyException {
+
+ public BuilderException() {
+ super();
+ }
+
+ public BuilderException(String message) {
+ super(message);
+ }
+
+
+ protected BuilderException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public BuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected BuilderException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public BuilderException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderInstantiationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderInstantiationException.java
new file mode 100644
index 0000000000..30957635db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderInstantiationException.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.spi.builder;
+
+/**
+ * Denotes an error instantiating an <code>SCAObject</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class BuilderInstantiationException extends BuilderException {
+
+ public BuilderInstantiationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public BuilderInstantiationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BuilderInstantiationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.java
new file mode 100644
index 0000000000..8d94ed1ebd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/BuilderRegistry.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.spi.builder;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.model.BindingDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Maintains a registry of builders in the runtime, dispatching to the
+ * appropriate one as an assembly model is processed into runtime artifacts
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BuilderRegistry extends Builder {
+
+ /**
+ * Register a builder for an implementation type.
+ *
+ * @param implClass the type of implementation that this builder can handle
+ * @param builder the builder to be registered
+ */
+ <I extends Implementation<?>> void register(Class<I> implClass, ComponentBuilder<I> builder);
+
+ /**
+ * Unregister a builder for an implementation type.
+ *
+ * @param implClass the implementation whose builder should be unregistered
+ */
+ <I extends Implementation<?>> void unregisterComponentBuilder(Class<I> implClass);
+
+ // FIXME: We need to provide unregister() for other builders
+
+ /**
+ * Register a binding builder for a binding type
+ *
+ * @param implClass the binding type
+ * @param builder the buinder to be registered
+ */
+ <B extends BindingDefinition> void register(Class<B> implClass, BindingBuilder<B> builder);
+
+ /**
+ * Unregister a binding builder
+ *
+ * @param <B>
+ * @param implClass the binding type
+ */
+ <B extends BindingDefinition> void unregisterBindingBuilder(Class<B> implClass);
+
+ /**
+ * Register a generic builder for a model type
+ *
+ * @param <S>
+ * @param <M>
+ * @param modelClass
+ * @param builder
+ */
+ <S extends SCAObject, M extends ModelObject> void register(Class<M> modelClass, GenericBuilder<S, M> builder);
+
+ /**
+ * Unregister a generic builder
+ *
+ * @param <M>
+ * @param modelClass The model type
+ */
+ <M extends ModelObject> void unregisterGenericBuilder(Class<M> modelClass);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.java
new file mode 100644
index 0000000000..668cee77e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ComponentBuilder.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.spi.builder;
+
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Responsible for building a {@link Component} from an atomic or composite component configured in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentBuilder<I extends Implementation<?>> {
+ Component build(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java
new file mode 100644
index 0000000000..b11aacc47e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/Connector.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.spi.builder;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Implementations are responsible for bridging invocation chains as an assembly is converted to runtime artifacts
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Connector {
+
+ /**
+ * Connects the given source's wires to corresponding wires to a target. Wires are connected by bridging invocation
+ * chains.
+ *
+ * @param source the source, i.e. a <code>ServiceBinding</code>, <code>Component</code>, or <code>Reference</code>
+ * @throws WiringException
+ */
+ void connect(SCAObject source) throws WiringException;
+
+ /**
+ * Bridges the invocation chains associated with an inbound and outbound wire.
+ *
+ * @param inbound the wire to bridge from
+ * @param outbound the target wire
+ * @param optimizable if the bridge may be optimized
+ * @throws WiringException
+ */
+ void connect(InboundWire inbound, OutboundWire outbound, boolean optimizable)
+ throws WiringException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/GenericBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/GenericBuilder.java
new file mode 100644
index 0000000000..3cb3940729
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/GenericBuilder.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.spi.builder;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Responsible for building a {@link SCAObject} from an extensibility element in
+ * the SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public interface GenericBuilder<S extends SCAObject, M extends ModelObject> {
+ /**
+ * Build a SCAObject from an extensibility element in the SCDL
+ *
+ * @param parent The parent SCAObject
+ * @param modelObject The model object
+ * @param deploymentContext The deployment context
+ * @return A SCAObject representing the runtime metdata for the extension
+ * @throws BuilderException
+ */
+ S build(SCAObject parent, M modelObject, DeploymentContext deploymentContext) throws BuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.java
new file mode 100644
index 0000000000..78bb5a5cc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/InvalidServiceInterfaceException.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.spi.builder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidServiceInterfaceException extends BuilderConfigException {
+ private final Class<?> interfaceClass;
+
+ public InvalidServiceInterfaceException(String message, Class<?> interfaceClass) {
+ super(message);
+ this.interfaceClass = interfaceClass;
+ }
+
+ public Class<?> getInterfaceClass() {
+ return interfaceClass;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java
new file mode 100644
index 0000000000..5a0b046430
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.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.spi.builder;
+
+/**
+ * Denotes a missing wire target in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingWireTargetException extends WiringException {
+
+ public MissingWireTargetException(String message) {
+ super(message);
+ }
+
+ public MissingWireTargetException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ScopeNotFoundException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ScopeNotFoundException.java
new file mode 100644
index 0000000000..acf8dadda6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/ScopeNotFoundException.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 org.apache.tuscany.spi.builder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeNotFoundException extends BuilderConfigException {
+
+ public ScopeNotFoundException(String scope) {
+ super("Scope not found", scope);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java
new file mode 100644
index 0000000000..d5e17919fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+/**
+ * Denotes a general error raised during wiring
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WiringException extends BuilderException {
+ private String sourceName;
+ private String referenceName;
+ private String targetName;
+ private String targetServiceName;
+
+ protected WiringException(String message) {
+ super(message);
+ }
+
+ protected WiringException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected WiringException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected WiringException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected WiringException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the source name for the wire
+ *
+ * @return the source name the source name for the wire
+ */
+ public String getSourceName() {
+ return sourceName;
+ }
+
+ /**
+ * Sets the source name for the wire
+ *
+ * @param sourceName the source name for the wire
+ */
+ public void setSourceName(String sourceName) {
+ this.sourceName = sourceName;
+ }
+
+ /**
+ * Returns the target name for the wire
+ *
+ * @return the target name the source name for the wire
+ */
+ public String getTargetName() {
+ return targetName;
+ }
+
+ /**
+ * Sets the target name for the wire
+ *
+ * @param targetName the source name for the wire
+ */
+ public void setTargetName(String targetName) {
+ this.targetName = targetName;
+ }
+
+
+ /**
+ * Returns the source reference name for the wire
+ *
+ * @return the source reference name for the wire
+ */
+ public String getReferenceName() {
+ return referenceName;
+ }
+
+ /**
+ * Sets the source reference name for the wire
+ *
+ * @param referenceName the source reference name for the wire
+ */
+ public void setReferenceName(String referenceName) {
+ this.referenceName = referenceName;
+ }
+
+ /**
+ * Returns the target service name for the wire
+ *
+ * @return the target service name for the wire
+ */
+ public String getTargetServiceName() {
+ return targetServiceName;
+ }
+
+ /**
+ * Sets the target service name for the wire
+ *
+ * @param targetServiceName the target service name for the wire
+ */
+ public void setTargetServiceName(String targetServiceName) {
+ this.targetServiceName = targetServiceName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
new file mode 100644
index 0000000000..de98aa4437
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.component;
+
+import java.util.HashMap;
+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.event.Event;
+import org.apache.tuscany.spi.event.EventFilter;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.event.TrueFilter;
+
+/**
+ * Functionality common to all <code>SCAObject<code> implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractSCAObject extends AbstractLifecycle implements SCAObject {
+ protected static final EventFilter TRUE_FILTER = new TrueFilter();
+
+ protected Map<EventFilter, List<RuntimeEventListener>> listeners;
+ protected final CompositeComponent parent;
+ private final String name;
+ private final Map<Object, Object> extensions = new HashMap<Object, Object>();
+ private String canonicalName;
+
+ public AbstractSCAObject(String name, CompositeComponent parent) {
+ this.name = name;
+ this.parent = parent;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCanonicalName() {
+ if (canonicalName == null) {
+ StringBuffer b = new StringBuffer(name);
+ if (parent != null) {
+ b.insert(0, parent.getCanonicalName() + "/");
+ }
+ canonicalName = b.toString();
+ }
+ return canonicalName;
+ }
+
+ public CompositeComponent getParent() {
+ return parent;
+ }
+
+ public void addListener(RuntimeEventListener listener) {
+ addListener(TRUE_FILTER, listener);
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ for (List<RuntimeEventListener> currentList : getListeners().values()) {
+ for (RuntimeEventListener current : currentList) {
+ if (current == listener) {
+ currentList.remove(current);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ List<RuntimeEventListener> list = getListeners().get(filter);
+ if (list == null) {
+ list = new CopyOnWriteArrayList<RuntimeEventListener>();
+ listeners.put(filter, list);
+ }
+ list.add(listener);
+ }
+ }
+
+ public void publish(Event event) {
+ assert event != null : "Event object was null";
+ for (Map.Entry<EventFilter, List<RuntimeEventListener>> entry : getListeners().entrySet()) {
+ if (entry.getKey().match(event)) {
+ for (RuntimeEventListener listener : entry.getValue()) {
+ listener.onEvent(event);
+ }
+ }
+ }
+ }
+
+ protected Map<EventFilter, List<RuntimeEventListener>> getListeners() {
+ if (listeners == null) {
+ listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
+ }
+ return listeners;
+ }
+
+ public void prepare() throws PrepareException {
+
+ }
+
+ public String toString() {
+ return "[" + name + "] in state [" + super.toString() + ']';
+ }
+
+ public Map<Object, Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isSystem() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.java
new file mode 100644
index 0000000000..aa4c41889b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AtomicComponent.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.spi.component;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * The runtime instantiation of an SCA atomic, or leaf-type, component
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AtomicComponent extends Component {
+
+ /**
+ * Returns true if component instances should be eagerly initialized.
+ *
+ * @return true if component instances should be eagerly initialized
+ */
+ boolean isEagerInit();
+
+ /**
+ * Returns true if component instances receive destroy events.
+ *
+ * @return true if component instances receive destroy events
+ */
+ boolean isDestroyable();
+
+ /**
+ * Returns the initialization level for this component.
+ *
+ * @return the initialization level for this component
+ */
+ int getInitLevel();
+
+ /**
+ * Returns the idle time allowed between operations in milliseconds if the implementation is conversational.
+ *
+ * @return the idle time allowed between operations in milliseconds if the implementation is conversational
+ */
+ long getMaxIdleTime();
+
+ /**
+ * Returns the maximum age a conversation may remain active in milliseconds if the implementation is
+ * conversational.
+ *
+ * @return the maximum age a conversation may remain active in milliseconds if the implementation is conversational
+ */
+ long getMaxAge();
+
+ /**
+ * Adds a target-side wire. Target-side wire factories contain the invocation chains associated with the destination
+ * service of a wire
+ */
+ void addInboundWire(InboundWire wire);
+
+ /**
+ * Adds a source-side wire for the given reference. Source-side wires contain the invocation chains for a reference
+ * in the implementation associated with the instance wrapper created by this configuration.
+ */
+ void addOutboundWire(OutboundWire wire);
+
+ /**
+ * Adds a set of source-side multiplicity wires for the given reference. Source-side wires contain the invocation
+ * chains for a reference in the implementation associated with the instance wrapper created by this configuration.
+ */
+ void addOutboundWires(List<OutboundWire> wires);
+
+ /**
+ * Notifies the given instance of an initialization event.
+ *
+ * @throws TargetInitializationException
+ */
+ void init(Object instance) throws TargetInitializationException;
+
+ /**
+ * Notifies the given instance of a destroy event.
+ *
+ * @throws TargetDestructionException
+ */
+ void destroy(Object instance) throws TargetDestructionException;
+
+ /**
+ * Creates a new implementation instance, generally used as a callback by a {@link
+ * org.apache.tuscany.spi.component.ScopeContainer}.
+ *
+ * @return the instance
+ * @throws ObjectCreationException
+ */
+ Object createInstance() throws ObjectCreationException;
+
+ /**
+ * Removes an implementation instance associated with the current invocation context.
+ *
+ * @throws ComponentException
+ */
+ void removeInstance() throws ComponentException;
+
+ /**
+ * Returns the target instance associated with the component. A target instance is the actual object a request is
+ * dispatched to sans wire chain.
+ *
+ * @throws TargetResolutionException
+ */
+ Object getTargetInstance() throws TargetResolutionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.java
new file mode 100644
index 0000000000..ec4eedfe90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Component.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.spi.component;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * The runtime instantiation of an SCA component
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Component extends SCAObject {
+
+ /**
+ * Sets the scope container associated with the component
+ *
+ * @param scopeContainer the scope container associated with the component
+ */
+ void setScopeContainer(ScopeContainer scopeContainer);
+
+ /**
+ * Returns the default property values associated with the component.
+ *
+ * @return default property values associated with the component.
+ */
+ Map<String, PropertyValue<?>> getDefaultPropertyValues();
+
+ /**
+ * Sets the default property values associated with the component.
+ *
+ * @param defaultPropertyValues Default property values associated with the component.
+ */
+ void setDefaultPropertyValues(Map<String, PropertyValue<?>> defaultPropertyValues);
+
+ /**
+ * Returns true if invocation dispatching can be optimized, i.e. invocation chains are not required
+ *
+ * @return true if invocation dispatching can be optimized, i.e. invocation chains are not required
+ */
+ boolean isOptimizable();
+
+ /**
+ * Returns the wire associated with the given service name or null if not found.
+ *
+ * @return the wire associated with the given service name or null if not found.
+ */
+ InboundWire getInboundWire(String serviceName);
+
+ /**
+ * Returns a map of inbound wires.
+ *
+ * @return a map of inbound wires.
+ */
+ Collection<InboundWire> getInboundWires();
+
+ /**
+ * Returns a map of source-side wires for references. There may be 1..n wires per reference.
+ *
+ * @return a map of source-side wires for references.
+ */
+ Map<String, List<OutboundWire>> getOutboundWires();
+
+ /**
+ * Callback to create a {@link org.apache.tuscany.spi.wire.TargetInvoker} which dispatches to a service offered by
+ * the component
+ *
+ * @param targetName the service name
+ * @param operation the operation to invoke
+ * @param callbackWire the callback wire or null if the associated wire is unidirectional
+ * @return the target invoker
+ * @throws TargetInvokerCreationException
+ */
+ TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentException.java
new file mode 100644
index 0000000000..2007cbb6bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentException.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.spi.component;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * An checked exception encountered by an {@link org.apache.tuscany.spi.component.Component}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ComponentException extends TuscanyException {
+
+ protected ComponentException() {
+ }
+
+ protected ComponentException(String message) {
+ super(message);
+ }
+
+ protected ComponentException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected ComponentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected ComponentException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected ComponentException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.java
new file mode 100644
index 0000000000..f34fda47a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRegistrationException.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.spi.component;
+
+/**
+ * Thrown when an error is encountered registering a component
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class ComponentRegistrationException extends ComponentException {
+ public ComponentRegistrationException() {
+ }
+
+ public ComponentRegistrationException(String message) {
+ super(message);
+ }
+
+ public ComponentRegistrationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ComponentRegistrationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ComponentRegistrationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.java
new file mode 100644
index 0000000000..8479681c75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ComponentRuntimeException.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.spi.component;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * An unchecked exception encountered by an {@link org.apache.tuscany.spi.component.Component}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ComponentRuntimeException extends CoreRuntimeException {
+
+ public ComponentRuntimeException() {
+ super();
+ }
+
+ public ComponentRuntimeException(String message) {
+ super(message);
+ }
+
+ public ComponentRuntimeException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ComponentRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ComponentRuntimeException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ComponentRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
new file mode 100644
index 0000000000..0f73fbfac5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.component;
+
+import java.util.List;
+import java.util.Collection;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+/**
+ * The runtime instantiation of an SCA composite component. Composites may contain child components, offer services, and
+ * have references. Children are contained in two namespaces, an application namespace for end-user components deployed
+ * to a runtime, and a system namespace for components that provide system services.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeComponent extends Component, RuntimeEventListener {
+
+ /**
+ * Sets the management service associated with the composite
+ *
+ * @param managementService the management service associated with the composite
+ */
+ void setManagementService(TuscanyManagementService managementService);
+
+ /**
+ * Returns the value of a Property of this composite.
+ *
+ * @param name the name of the Property
+ * @return its value, or null if there is not such property or if it has no defined value
+ */
+ Document getPropertyValue(String name);
+
+ /**
+ * Registers a child of this composite.
+ *
+ * @param object the object to add as a child
+ * @throws ComponentRegistrationException
+ */
+ void register(SCAObject object) throws ComponentRegistrationException;
+
+ /**
+ * Returns the internal system wire associated with the given service name or null if not found
+ *
+ * @param serviceName the service name
+ * @return the system wire or null if not found
+ */
+ InboundWire getInboundSystemWire(String serviceName);
+
+ /**
+ * Returns a map of inbound system wires.
+ *
+ * @return a map of inbound system wires.
+ */
+ Collection<InboundWire> getInboundSystemWires();
+
+
+ /**
+ * Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to
+ * create the initial configuration components.
+ *
+ * @param name the name of the resulting component
+ * @param service the service interface the component should expose
+ * @param instance the Object that will become the component's implementation
+ * @throws ComponentRegistrationException
+ */
+ <S, I extends S> void registerJavaObject(String name, Class<S> service, I instance)
+ throws ComponentRegistrationException;
+
+ /**
+ * Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to
+ * create the initial configuration components.
+ *
+ * @param name the name of the resulting component
+ * @param services the service interfaces the component should expose
+ * @param instance the Object that will become the component's implementation
+ * @throws ComponentRegistrationException
+ */
+ <S, I extends S> void registerJavaObject(String name, List<Class<?>> services, I instance)
+ throws ComponentRegistrationException;
+
+ /**
+ * Returns the child associated with a given name
+ */
+ SCAObject getChild(String name);
+
+ /**
+ * Returns the system child associated with a given name
+ */
+ SCAObject getSystemChild(String name);
+
+ /**
+ * Invoked by child components to return an wire to a target based on matching type. Resolved targets may be
+ * serviceBindings or components in the parent or its ancestors, or references in a sibling component
+ *
+ * @param instanceInterface the type of service being requested
+ * @return a reference to the requested service or null if one is not be found
+ * @throws TargetResolutionException
+ */
+ InboundWire resolveAutowire(Class<?> instanceInterface) throws TargetResolutionException;
+
+ /**
+ * Invoked by system child components to return a wire to a system target based on matching type. Resolved targets
+ * may be system serviceBindings or components in the parent or its ancestors, or references in a sibling component
+ *
+ * @param instanceInterface the type of service being requested
+ * @return a reference to the requested service or null if one is not be found
+ * @throws TargetResolutionException
+ */
+ InboundWire resolveSystemAutowire(Class<?> instanceInterface) throws TargetResolutionException;
+
+ /**
+ * Invoked by a parent component to return an wire to a target in a child based on matching type. Resolved targets
+ * must be serviceBindings. For example, given a parent P and two siblings, A and B, A would request an autowire by
+ * invoking {@link #resolveAutowire(Class<?>)} on P, which in turn could invoke the present method on B in order to
+ * resolve a target.
+ *
+ * @param instanceInterface the type of service being requested
+ * @return a reference to the requested service or null if one is not be found
+ * @throws TargetResolutionException
+ */
+ InboundWire resolveExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException;
+
+ /**
+ * Invoked by a parent component to return a wire to a system target in a child based on matching type. Resolved
+ * targets must be system serviceBindings. For example, given a parent P and two siblings, A and B, A would request
+ * an autowire by invoking {@link #resolveAutowire(Class<?>)} on P, which in turn could invoke the present method on
+ * B in order to resolve a target.
+ *
+ * @param instanceInterface the type of service being requested
+ * @return a reference to the requested service or null if one is not be found
+ * @throws TargetResolutionException
+ */
+ InboundWire resolveSystemExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.java
new file mode 100644
index 0000000000..128f301256
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/DuplicateNameException.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.spi.component;
+
+/**
+ * Denotes an attempt to add an child to a composite component with a name equal to an existing child
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateNameException extends ComponentRegistrationException {
+
+ public DuplicateNameException(String message) {
+ super(message);
+ }
+
+ public DuplicateNameException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.java
new file mode 100644
index 0000000000..7eb37c3639
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/IllegalTargetException.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.spi.component;
+
+/**
+ * Thrown when a target for an operation is not of the required type
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class IllegalTargetException extends TargetResolutionException {
+
+ public IllegalTargetException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidAutowireInterface.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidAutowireInterface.java
new file mode 100644
index 0000000000..ffda730a27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidAutowireInterface.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.spi.component;
+
+/**
+ * Thrown when an invalid interface is specified during autowire registration
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidAutowireInterface extends ComponentRegistrationException {
+
+ public InvalidAutowireInterface(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.java
new file mode 100644
index 0000000000..21a1712e1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/InvalidConversationSequenceException.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.spi.component;
+
+/**
+ * Denotes an unknown operation sequence in a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationSequenceException extends TargetInvocationException {
+
+ public InvalidConversationSequenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PersistenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PersistenceException.java
new file mode 100644
index 0000000000..06940aaff7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PersistenceException.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.spi.component;
+
+/**
+ * Raised when an error persisting a component implementation instance is encountered
+ *
+ * @version $Rev$ $Date$
+ */
+public class PersistenceException extends ComponentException {
+ public PersistenceException() {
+ }
+
+ public PersistenceException(String message) {
+ super(message);
+ }
+
+ public PersistenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PersistenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PrepareException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PrepareException.java
new file mode 100644
index 0000000000..d2be6daadf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/PrepareException.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.spi.component;
+
+/**
+ * Denotes an exception preparing a component
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrepareException extends ComponentException {
+
+ public PrepareException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public PrepareException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.java
new file mode 100644
index 0000000000..4ef0929422
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReactivationException.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.spi.component;
+
+/**
+ * Raised when an error is encountered reactivating a serialized instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReactivationException extends ComponentRuntimeException {
+ private String owner;
+
+ public ReactivationException(String message) {
+ super(message);
+ }
+
+ public ReactivationException(String message, String identifier, String ower) {
+ super(message, identifier);
+ this.owner = ower;
+ }
+
+ public ReactivationException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
new file mode 100644
index 0000000000..2b3ef4be30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
@@ -0,0 +1,34 @@
+package org.apache.tuscany.spi.component;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * The runtime instantiation of an SCA reference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Reference extends SCAObject {
+
+ /**
+ * Returns the contract for the reference.
+ *
+ * @return the contract for the reference.
+ */
+ ServiceContract<?> getServiceContract();
+
+ /**
+ * Returns the collection of bindings configured for the reference.
+ *
+ * @return the collection of bindings configured for the reference.
+ */
+ List<ReferenceBinding> getReferenceBindings();
+
+ /**
+ * Adds a binding the reference is configured with.
+ *
+ * @param binding the binding the reference is configured with.
+ */
+ void addReferenceBinding(ReferenceBinding binding);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.java
new file mode 100644
index 0000000000..82a2105a36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ReferenceBinding.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.spi.component;
+
+import javax.xml.namespace.QName;
+
+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.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Manages an SCA reference configured with a binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBinding extends SCAObject {
+
+ /**
+ * Returns the binding qualified name
+ *
+ * @return the binding qualified name
+ */
+ QName getBindingType();
+
+ /**
+ * Sets the parent reference for the binding
+ *
+ * @param reference the parent reference for the binding
+ */
+ void setReference(Reference reference);
+
+ /**
+ * Returns the inbound wire for flowing a request through the reference
+ */
+ InboundWire getInboundWire();
+
+ /**
+ * Sets the inbound wire for flowing a request through the reference
+ */
+ void setInboundWire(InboundWire wire);
+
+ /**
+ * Returns the outbound wire used by the reference to connect to a target
+ */
+ OutboundWire getOutboundWire();
+
+ /**
+ * Sets the outbound wire used by the reference to connect to a target
+ */
+ void setOutboundWire(OutboundWire wire);
+
+ /**
+ * Callback to create a {@link org.apache.tuscany.spi.wire.TargetInvoker} which dispatches to the target service of
+ * the reference
+ *
+ * @param contract the service contract to invoke on
+ * @param operation the operation to invoke
+ * @throws TargetInvokerCreationException
+ */
+ TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException;
+
+ /**
+ * Returns the service contract for the binding
+ *
+ * @return the service contract for the binding
+ */
+ ServiceContract<?> getBindingServiceContract();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAExternalizable.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAExternalizable.java
new file mode 100644
index 0000000000..6454e66369
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAExternalizable.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.spi.component;
+
+/**
+ * A serialization contract for runtime SCA artifacts. When an instance is deserialized, runtime services defined in
+ * this contract must be set before reactivating the instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCAExternalizable {
+
+ /**
+ * Sets the current work context
+ *
+ * @param context the current work context
+ */
+ void setWorkContext(WorkContext context);
+
+ /**
+ * Callback after all values have been set prior to making the instance available in the runtime
+ *
+ * @throws org.apache.tuscany.spi.component.ReactivationException
+ *
+ */
+ void reactivate() throws ReactivationException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
new file mode 100644
index 0000000000..668eb1f90a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.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.spi.component;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.Lifecycle;
+import org.apache.tuscany.spi.event.EventPublisher;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Represents the base SCA artifact type in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCAObject extends EventPublisher, Lifecycle {
+
+ /**
+ * Returns the artifact name
+ */
+ String getName();
+
+ /**
+ * Returns the canonical artifact name
+ */
+ String getCanonicalName();
+
+ /**
+ * Returns the parent composite, or null if the artifact does not have one
+ */
+ CompositeComponent getParent();
+
+ /**
+ * Returns the artifact scope
+ */
+ Scope getScope();
+
+ /**
+ * Returns true if the artifact is a system artifact
+ *
+ * @return true if the artifact is a system artifact
+ */
+ boolean isSystem();
+
+ /**
+ * The extensions map contains other runtime context such as type systems for various databindings
+ *
+ * @return A live map of extended context
+ */
+ Map<Object, Object> getExtensions();
+
+ /**
+ * Called to signal that the composite should perform any initizalization
+ */
+ void prepare() throws PrepareException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.java
new file mode 100644
index 0000000000..a712b1b0eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStartException.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.spi.component;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an error starting an SCAObject
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectStartException extends CoreRuntimeException {
+
+ public SCAObjectStartException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.java
new file mode 100644
index 0000000000..9f430bc414
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObjectStopException.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.spi.component;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an error stopping an SCAObject
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectStopException extends CoreRuntimeException {
+
+ public SCAObjectStopException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.java
new file mode 100644
index 0000000000..8b67dfa696
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainer.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 org.apache.tuscany.spi.component;
+
+import org.apache.tuscany.spi.Lifecycle;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+import org.apache.tuscany.spi.model.Scope;
+
+
+/**
+ * Manages the lifecycle and visibility of instances associated with a an {@link AtomicComponent}.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopeContainer extends Lifecycle, RuntimeEventListener {
+
+ /**
+ * Returns the scope value representing the scope context
+ */
+ Scope getScope();
+
+ /**
+ * Registers a component with the scope component
+ */
+ void register(AtomicComponent component);
+
+ /**
+ * Returns an implementation instance associated with the current request context, creating one if necessary
+ *
+ * @throws TargetResolutionException
+ */
+ Object getInstance(AtomicComponent component) throws TargetResolutionException;
+
+ /**
+ * Returns an implementation instance associated with the current context. If no instance is found, a {@link
+ * TargetNotFoundException} is thrown
+ *
+ * @throws TargetResolutionException
+ */
+ Object getAssociatedInstance(AtomicComponent component) throws TargetResolutionException;
+
+ /**
+ * Persists a new component implementation instance, equivalent to an insert or append operation
+ *
+ * @param component the owning component
+ * @param id the id associated with the instance
+ * @param instance the instance to persist
+ * @param expiration the expiration in milliseconds
+ * @throws PersistenceException
+ */
+ void persistNew(AtomicComponent component, String id, Object instance, long expiration) throws PersistenceException;
+
+ /**
+ * Persists a component implementation instance, equivalent to an update operation
+ *
+ * @param component the owning component
+ * @param id the id associated with the instance
+ * @param instance the instance to persist
+ * @param expiration the expiration in milliseconds
+ * @throws PersistenceException
+ */
+ void persist(AtomicComponent component, String id, Object instance, long expiration) throws PersistenceException;
+
+ /**
+ * Removes a component implementation instance associated with the current context from persistent storage
+ *
+ * @param component the owning component
+ * @throws PersistenceException
+ */
+ void remove(AtomicComponent component) throws PersistenceException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainerMonitor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainerMonitor.java
new file mode 100644
index 0000000000..3e7649d59e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeContainerMonitor.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.spi.component;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * Defines monitor events for scope containers
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopeContainerMonitor {
+
+ @LogLevel("SEVERE")
+ void eagerInitializationError(Exception e);
+
+ @LogLevel("SEVERE")
+ void destructionError(TargetDestructionException e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.java
new file mode 100644
index 0000000000..181b094403
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ScopeRegistry.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.spi.component;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Scope;
+
+/**
+ * Manages {@link ScopeContainer}s in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface ScopeRegistry {
+
+ /**
+ * Returns the scope container for the given scope or null if one not found
+ *
+ * @param scope the scope
+ * @return the scope container for the given scope or null if one not found
+ */
+ ScopeContainer getScopeContainer(Scope scope);
+
+ <T extends ScopeContainer> void registerFactory(Scope scope, ObjectFactory<T> factory);
+
+ void deregisterFactory(Scope scope);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
new file mode 100644
index 0000000000..714a0a4313
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.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.spi.component;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * The runtime instantiation of an SCA service
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Service extends SCAObject {
+
+ /**
+ * Returns the contract for the service.
+ *
+ * @return the contract for the service.
+ */
+ ServiceContract<?> getServiceContract();
+
+ /**
+ * Returns the collection of bindings configured for the service.
+ *
+ * @return the collection of bindings configured for the service.
+ */
+ List<ServiceBinding> getServiceBindings();
+
+ /**
+ * Adds a binding the service is exposed over.
+ *
+ * @param binding the binding the service is exposed over.
+ */
+ void addServiceBinding(ServiceBinding binding);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java
new file mode 100644
index 0000000000..3912c3bb60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/ServiceBinding.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.component;
+
+import javax.xml.namespace.QName;
+
+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.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * The runtime instantiation of an SCA service binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBinding extends SCAObject {
+
+ /**
+ * Returns the binding qualified name
+ *
+ * @return the binding qualified name
+ */
+ QName getBindingType();
+
+ /**
+ * Sets the parent service for the binding
+ *
+ * @param service the parent service for the binding
+ */
+ void setService(Service service);
+
+ /**
+ * Get the ServiceContract for the binding
+ *
+ * @return the ServiceContract for the binding
+ */
+ ServiceContract<?> getBindingServiceContract();
+
+ /**
+ * Returns the inbound wire for flowing a request through the service
+ *
+ * @return the inbound wire for flowing a request through the service
+ */
+ InboundWire getInboundWire();
+
+ /**
+ * Sets the inbound wire for flowing a request through the service
+ *
+ * @param wire the inbound wire for flowing a request through the service
+ */
+ void setInboundWire(InboundWire wire);
+
+ /**
+ * Returns the outbound wire for flowing a request out of the service
+ *
+ * @return the outbound wire for flowing a request out of the service
+ */
+ OutboundWire getOutboundWire();
+
+ /**
+ * Sets the outbound wire for flowing a request out of the service
+ *
+ * @param wire the outbound wire for flowing a request out of the service
+ */
+ void setOutboundWire(OutboundWire wire);
+
+ /**
+ * Returns the target invoker for dispatching callback invocations
+ *
+ * @param contract the callback contract
+ * @param operation the callback operation the target invoker dispatches to
+ * @throws TargetInvokerCreationException
+ */
+ TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetDestructionException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetDestructionException.java
new file mode 100644
index 0000000000..5f521f9b0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetDestructionException.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.spi.component;
+
+/**
+ * Denotes an error destroying a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetDestructionException extends TargetResolutionException {
+
+ public TargetDestructionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetDestructionException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+
+ public TargetDestructionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.java
new file mode 100644
index 0000000000..6b8278cf8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetException.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.spi.component;
+
+/**
+ * Denotes an error while performing an operation on a target component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TargetException extends ComponentException {
+
+ public TargetException(String message) {
+ super(message);
+ }
+
+
+ public TargetException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+
+ public TargetException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public TargetException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInitializationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInitializationException.java
new file mode 100644
index 0000000000..eaea4c3bc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInitializationException.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.spi.component;
+
+/**
+ * Denotes an error initializing a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInitializationException extends TargetResolutionException {
+
+ public TargetInitializationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetInitializationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public TargetInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.java
new file mode 100644
index 0000000000..1fc2b24f5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvocationException.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.spi.component;
+
+/**
+ * Raised when an error is encountered during a target invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInvocationException extends TargetException {
+
+ public TargetInvocationException(String message) {
+ super(message);
+ }
+
+ public TargetInvocationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvocationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.java
new file mode 100644
index 0000000000..ac914401cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetInvokerCreationException.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.spi.component;
+
+/**
+ * Denotes an error creating a {@link org.apache.tuscany.spi.wire.TargetInvoker}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TargetInvokerCreationException extends ComponentException {
+
+ public TargetInvokerCreationException() {
+ }
+
+ public TargetInvokerCreationException(String message) {
+ super(message);
+ }
+
+ public TargetInvokerCreationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetInvokerCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvokerCreationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public TargetInvokerCreationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.java
new file mode 100644
index 0000000000..cd6996789c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetNotFoundException.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.spi.component;
+
+/**
+ * Thrown when a target of an operation cannot be found
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TargetNotFoundException extends TargetResolutionException {
+
+ public TargetNotFoundException(String message) {
+ super(message);
+ }
+
+ public TargetNotFoundException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetResolutionException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetResolutionException.java
new file mode 100644
index 0000000000..858fa9415d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/TargetResolutionException.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.spi.component;
+
+/**
+ * Denotes an error retrieving a target instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetResolutionException extends TargetException {
+
+ public TargetResolutionException(String message) {
+ super(message);
+ }
+
+ public TargetResolutionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public TargetResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetResolutionException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java
new file mode 100644
index 0000000000..3e244873c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/WorkContext.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.component;
+
+import java.util.LinkedList;
+
+/**
+ * Implementations track information associated with a request as it is processed by the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WorkContext {
+
+ Object getCurrentCorrelationId();
+
+ void setCurrentCorrelationId(Object correlationId);
+
+ /**
+ * Returns the current atomic component as a request is processed or null if it is not being tracked. Note that the
+ * current atomic component is typically only tracked during persistence operations involving implementation
+ * instances
+ *
+ * @return the current atomic component as a request is processed or null
+ */
+ AtomicComponent getCurrentAtomicComponent();
+
+ /**
+ * Sets the current atomic component that is handling processing of a request. Note that in most cases it will not
+ * be necessary to track this in the rumtime
+ *
+ * @param component the current atomic component
+ */
+ void setCurrentAtomicComponent(AtomicComponent component);
+
+ /**
+ * Returns the current chain of SCAObject addresses
+ */
+ LinkedList<Object> getCurrentCallbackRoutingChain();
+
+ /**
+ * Sets the current stack of SCAObject addresses
+ */
+ void setCurrentCallbackRoutingChain(LinkedList<Object> callbackRoutingChain);
+
+ /**
+ * Returns the composite where a remote request came in
+ */
+ CompositeComponent getRemoteComponent();
+
+ /**
+ * Sets the composite where a remote request came in
+ */
+ void setRemoteComponent(CompositeComponent component);
+
+ /**
+ * Returns the unique key for the given identifier associated with the current request
+ */
+ Object getIdentifier(Object type);
+
+ /**
+ * Sets the unique key for the given identifier associated with the current request
+ */
+ void setIdentifier(Object type, Object identifier);
+
+ /**
+ * Clears the unique key for the given identifier associated with the current request
+ */
+ void clearIdentifier(Object type);
+
+ /**
+ * Clears all identifiers associated with the current request
+ */
+ void clearIdentifiers();
+
+ /**
+ * Removes and returns the name of the last remotable service to handle the current request
+ *
+ * @return the name of the last remotable service to handle the current request or null
+ */
+ String popServiceName();
+
+ /**
+ * Returns the name of the last remotable service to handle the current request
+ *
+ * @return the name of the last remotable service to handle the current request or null
+ */
+ String getCurrentServiceName();
+
+ /**
+ * Adds the name of the last remotable service to handle the current request
+ *
+ * @param name the name of the last remotable service to handle the current request or null
+ */
+ void pushServiceName(String name);
+
+ /**
+ * Clears the stack of current service names
+ */
+ void clearServiceNames();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java
new file mode 100644
index 0000000000..6916c62f51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBinding.java
@@ -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.
+ */
+
+package org.apache.tuscany.spi.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * DataBinding represents a data representation, for example, SDO, JAXB and AXIOM
+ */
+public interface DataBinding {
+ /**
+ * A special databinding for input message of an operation
+ */
+ String IDL_INPUT = "idl:input";
+ /**
+ * A special databinding for output message of an operation
+ */
+ String IDL_OUTPUT = "idl:output";
+ /**
+ * A special databinding for fault message of an operation
+ */
+ String IDL_FAULT = "idl:fault";
+ /**
+ * The name of a databinding should be case-insensitive and unique
+ *
+ * @return The name of the databinding
+ */
+ String getName();
+
+ /**
+ * Get the aliases for the databinding
+ *
+ * @return An array of aliases
+ */
+ String[] getAliases();
+
+ /**
+ * Introspect and populate information to a DataType model
+ *
+ * @param javaType The java class or interface to be introspected
+ * @param annotations The java annotations
+ * @return true if the databinding has recognized the given data type
+ */
+ boolean introspect(DataType dataType, Annotation[] annotations);
+
+ /**
+ * Introspect the data to figure out the corresponding data type
+ *
+ * @param value The object to be checked
+ * @return The DataType or null if the java type is not supported by this databinding
+ */
+ DataType introspect(Object value);
+
+ /**
+ * Provide a WrapperHandler for this databinding
+ * @return A wrapper handler which can handle wrapping/wrapping for this databinding
+ */
+ WrapperHandler getWrapperHandler();
+
+ /**
+ * Make a copy of the object for "pass-by-value" semantics
+ * @param source object to copy
+ * @return copy of the object passed in as argument
+ */
+ Object copy(Object object);
+
+ /**
+ * Get the type mapper for simple types
+ * @return The databinding-specific simple type mapper
+ */
+ SimpleTypeMapper getSimpleTypeMapper();
+
+ /**
+ * Get the handler that can handle exceptions/faults in the
+ * databinding-specific way
+ *
+ * @return An instance of the exception handler
+ */
+ ExceptionHandler getExceptionHandler();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.java
new file mode 100644
index 0000000000..09f0347777
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataBindingRegistry.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.spi.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * The registry for data bindings
+ */
+public interface DataBindingRegistry {
+ /**
+ * Register a data binding
+ *
+ * @param dataBinding
+ */
+ void register(DataBinding dataBinding);
+
+ /**
+ * Look up a data binding by id
+ *
+ * @param id The name of the databinding
+ * @return The databinding
+ */
+ DataBinding getDataBinding(String id);
+
+ /**
+ * Unregister a data binding
+ *
+ * @param id
+ * @return The unregistered databinding
+ */
+ DataBinding unregister(String id);
+
+ /**
+ * Introspect the java class to figure out what DataType supports it
+ *
+ * @param DataType The initial data type
+ * @param annotations The java annotations
+ * @return A DataType representing the java type or null if no databinding
+ * recognizes the java type
+ */
+ boolean introspectType(DataType dataType, Annotation[] annotations);
+
+ /**
+ * Introspect the value to figure out the corresponding DataType
+ *
+ * @param value The object value
+ * @return A DataType representing the value or null if no databinding
+ * recognizes the value
+ */
+ DataType introspectType(Object value);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.java
new file mode 100755
index 0000000000..a0eb7ac10d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/DataPipe.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.spi.databinding;
+
+/**
+ * Data pipe allows a data source pushes data into its sink and pipe the data into its result
+ *
+ * @param <S> The data binding type of the sink
+ * @param <R> The data binding type of the result
+ */
+public interface DataPipe<S, R> extends Transformer {
+
+ /**
+ * Returns a sink (for example, java.io.OutputStream, java.io.Writer or org.xml.sax.ContentHandler) to receive data
+ * pushed by the source
+ *
+ * @return The sink to consume data
+ */
+ S getSink();
+
+ /**
+ * Returns the data populated by the sink
+ *
+ * @return
+ */
+ R getResult();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/ExceptionHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/ExceptionHandler.java
new file mode 100644
index 0000000000..5599ae00de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/ExceptionHandler.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.spi.databinding;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * ExceptionHandler provides databinding-specific logic for exception handling
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionHandler {
+ /**
+ * Create an exception to wrap the fault data
+ *
+ * @param exceptionType The DataType for the exception
+ * @param message The error message
+ * @param faultInfo The databinding-specific fault data
+ * @param cause The protocol-specific error
+ * @return An instance of java exception to represent the fault
+ */
+ Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause);
+
+ /**
+ * Retrieve the fault info from a java exception
+ *
+ * @param exception The databinding-specific java exception that represents
+ * the fault data
+ * @return The databinding-specific fault data
+ */
+ Object getFaultInfo(Exception exception);
+
+ /**
+ * Introspect an exception class to figure out the fault data type
+ *
+ * @param exceptionDataType The exception class
+ * @return The data type for the fault
+ */
+ DataType<?> getFaultType(DataType exceptionDataType);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.java
new file mode 100755
index 0000000000..53b8e8d95f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Mediator.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.spi.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * This interface will be used as a Tuscany system service to perform data mediations
+ *
+ * Mediate the data from one type to the other one
+ *
+ */
+public interface Mediator {
+
+ /**
+ * Mediate the data from the source type to the target type
+ * @param source The data to be mediated
+ * @param sourceDataType Data type for the source data
+ * @param targetDataType Data type for the target data
+ * @param context
+ * @return
+ */
+ Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<Class<?>, Object> context);
+ /**
+ * Mediate the source data into the target which is a sink to receive the data
+ * @param source The data to be mediated
+ * @param target The sink to receive data
+ * @param sourceDataType Data type for the source data
+ * @param targetDataType Data type for the target data
+ */
+ void mediate(
+ Object source,
+ Object target,
+ DataType sourceDataType,
+ DataType targetDataType,
+ Map<Class<?>, Object> context);
+
+ /**
+ * Get the DataBinding registry
+ * @return
+ */
+ DataBindingRegistry getDataBindingRegistry();
+
+ /**
+ * Get the Transformer registry
+ * @return
+ */
+ TransformerRegistry getTransformerRegistry();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.java
new file mode 100644
index 0000000000..21e8cc2750
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PullTransformer.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.spi.databinding;
+
+/**
+ * PullTransformer transforms data from one binding format to the other one which can be directly consumed
+ *
+ * @param <S> The source data type
+ * @param <R> the target data type
+ */
+public interface PullTransformer<S, R> extends Transformer {
+ /**
+ * Transform source data into the result type.
+ *
+ * @param source The source data
+ * @param context The context for the transformation
+ * @return The transformed result
+ */
+ R transform(S source, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.java
new file mode 100644
index 0000000000..d68b6aa772
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/PushTransformer.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.spi.databinding;
+
+/**
+ * A transformer that pushes data from its source into the sink
+ *
+ * @param <S>
+ * @param <R>
+ */
+public interface PushTransformer<S, R> extends Transformer {
+ /**
+ * @param source The source data
+ * @param sink The sink to receive the data
+ * @param context
+ */
+ void transform(S source, R sink, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.java
new file mode 100644
index 0000000000..634d489c11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/SimpleTypeMapper.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.spi.databinding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Type Mapper between XML schema simple data types and java objects
+ */
+public interface SimpleTypeMapper {
+ /**
+ * Parse the XML lexical representation into a java object
+ * @param simpleType The XSD simple type
+ * @param value the XML lexical representation
+ * @param context The context of the transformation
+ * @return A java object for the XML value
+ */
+ Object toJavaObject(QName simpleType, String value, TransformationContext context);
+ /**
+ * Create the XML lexical representation for a java object
+ * @param simpleType The XSD simple type
+ * @param obj The java object
+ * @param context The context of the transformation
+ * @return The XML lexical representation
+ */
+ String toXMLLiteral(QName simpleType, Object obj, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.java
new file mode 100755
index 0000000000..8287de1707
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationContext.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.spi.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * Context for data transformation
+ *
+ */
+public interface TransformationContext {
+ /**
+ * Get the source data type
+ *
+ * @return
+ */
+ DataType getSourceDataType();
+
+ /**
+ * Get the target data type
+ *
+ * @return
+ */
+ DataType getTargetDataType();
+
+ /**
+ * Set the source data type
+ *
+ * @param sourceDataType
+ */
+ void setSourceDataType(DataType sourceDataType);
+
+ /**
+ * Set the target data type
+ *
+ * @param targetDataType
+ */
+ void setTargetDataType(DataType targetDataType);
+
+ /**
+ * Get the classloader
+ *
+ * @return
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Get a map of metadata
+ *
+ * @return
+ */
+ Map<Class<?>, Object> getMetadata();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.java
new file mode 100755
index 0000000000..9b57e1cf70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformationException.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.spi.databinding;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Reports problems during data transformation
+ */
+public class TransformationException extends TuscanyRuntimeException {
+
+ private static final long serialVersionUID = 7662385613693006428L;
+
+ public TransformationException() {
+ super();
+ }
+
+ public TransformationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransformationException(String message) {
+ super(message);
+ }
+
+ public TransformationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.java
new file mode 100755
index 0000000000..2f969e979d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/Transformer.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.spi.databinding;
+
+/**
+ * A transformer provides the data transformation from source type to target type. The cost of the transformation is
+ * modeled as weight.
+ */
+public interface Transformer {
+ /**
+ * Get the source type that this transformer transforms data from. The type is used as the key when the transformer
+ * is registered with TransformerRegistry.
+ *
+ * @return A key indentifying the source type
+ */
+ String getSourceDataBinding();
+
+ /**
+ * Get the target type that this transformer transforms data into. The type is used as the key when the transformer
+ * is registered with TransformerRegistry.
+ *
+ * @return A key indentifying the target type
+ */
+ String getTargetDataBinding();
+
+ /**
+ * Get the cost of the transformation. The weight can be used to choose the most efficient path if there are more
+ * than one available from the source to the target.
+ *
+ * @return An integer representing the cost of the transformation
+ */
+ int getWeight();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.java
new file mode 100755
index 0000000000..5381dfa081
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/TransformerRegistry.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.spi.databinding;
+
+import java.util.List;
+
+/**
+ * Registry for data transformers
+ */
+public interface TransformerRegistry {
+ /**
+ * Register a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @param weight
+ * @param transformer
+ */
+ void registerTransformer(String sourceDataBinding,
+ String targetDataBinding,
+ int weight,
+ Transformer transformer);
+
+ /**
+ * Register a transformer
+ *
+ * @param transformer
+ */
+ void registerTransformer(Transformer transformer);
+
+ /**
+ * Unregister a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ boolean unregisterTransformer(String sourceDataBinding, String targetDataBinding);
+
+ /**
+ * Get the direct Transformer which can transform data from source type to
+ * result type
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ Transformer getTransformer(String sourceDataBinding, String targetDataBinding);
+
+ /**
+ * Get the a chain of Transformers which can transform data from source type
+ * to result type
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ List<Transformer> getTransformerChain(String sourceDataBinding, String targetDataBinding);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.java
new file mode 100644
index 0000000000..9643ca280a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/WrapperHandler.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.spi.databinding;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.idl.ElementInfo;
+
+/**
+ * A contract for transformers to deal with wrapping/unwrapping for WSDL wrapper style operations
+ */
+public interface WrapperHandler<T> {
+ /**
+ * Create a wrapper element
+ *
+ * @param element The XSD element
+ * @param context The transformation context
+ * @return An object representing the wrapper element
+ */
+ T create(ElementInfo element, TransformationContext context);
+
+ /**
+ * Set child element for the wrapper
+ *
+ * @param wrapper The wrapper
+ * @param i The index
+ * @param childElement The XSD element
+ * @param value The value of the child
+ */
+ void setChild(T wrapper, int i, ElementInfo childElement, Object value);
+
+ /**
+ * Get a list of child elements from the wrapper
+ * @param wrapper
+ * @return child elements under the wrapper
+ */
+ List getChildren(T wrapper);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.java
new file mode 100644
index 0000000000..2b927b8e55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DOMHelper.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.spi.databinding.extension;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Helper for DOM
+ */
+public final class DOMHelper {
+ private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance();
+ static {
+ FACTORY.setNamespaceAware(true);
+ }
+
+ private DOMHelper() {
+ }
+
+ public static Document newDocument() throws ParserConfigurationException {
+ return newDocumentBuilder().newDocument();
+ }
+
+ public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
+ return FACTORY.newDocumentBuilder();
+ }
+
+ public static QName getQName(Node node) {
+ String ns = node.getNamespaceURI();
+ if (ns == null) {
+ ns = "";
+ }
+ // node.getLocalName() will return null if it is created using DOM Level
+ // 1 method
+ // such as createElement()
+ return new QName(ns, node.getNodeName());
+ }
+
+ public static Element createElement(Document document, QName name) {
+ String prefix = name.getPrefix();
+ String qname =
+ (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name
+ .getLocalPart();
+ return document.createElementNS(name.getNamespaceURI(), qname);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java
new file mode 100644
index 0000000000..1598637d4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtension.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.databinding.extension;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+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.ExceptionHandler;
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.WrapperHandler;
+import org.apache.tuscany.spi.model.DataType;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Base Implementation of DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(DataBinding.class)
+@Scope("COMPOSITE")
+@EagerInit
+public abstract class DataBindingExtension implements DataBinding {
+
+ protected DataBindingRegistry registry;
+
+ protected Class<?> baseType;
+
+ protected String name;
+ protected String[] aliases;
+
+ /**
+ * Create a databinding with the base java type whose name will be used as
+ * the name of the databinding
+ *
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected DataBindingExtension(Class<?> baseType) {
+ this(baseType.getName(), null, baseType);
+ }
+
+ /**
+ * Create a databinding with the name and base java type
+ *
+ * @param name The name of the databinding
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected DataBindingExtension(String name, Class<?> baseType) {
+ this(name, null, baseType);
+ }
+
+ /**
+ * Create a databinding with the name and base java type
+ *
+ * @param name The name of the databinding
+ * @param aliases The aliases of the databinding
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected DataBindingExtension(String name, String[] aliases, Class<?> baseType) {
+ this.name = name;
+ this.baseType = baseType;
+ this.aliases = aliases;
+ }
+
+ @Autowire
+ public void setDataBindingRegistry(DataBindingRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.register(this);
+ }
+
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ assert type != null;
+ Type physical = type.getPhysical();
+ if (physical instanceof ParameterizedType) {
+ physical = ((ParameterizedType)physical).getRawType();
+ }
+ if (physical instanceof Class) {
+ Class cls = (Class)physical;
+ if (baseType != null && baseType.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ type.setLogical(baseType);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected static org.apache.tuscany.api.annotation.DataType getDataTypeAnnotation(Annotation[] annotations) {
+ for (Annotation a : annotations) {
+ if (a.annotationType() == org.apache.tuscany.api.annotation.DataType.class) {
+ return (org.apache.tuscany.api.annotation.DataType) a;
+ }
+ }
+ return null;
+ }
+
+ public DataType introspect(Object value) {
+ if (value == null) {
+ return null;
+ } else {
+ DataType<Class> dataType = new DataType<Class>(value.getClass(), value.getClass());
+ if (introspect(dataType, null)) {
+ return dataType;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.DataBinding#getWrapperHandler()
+ */
+ public WrapperHandler getWrapperHandler() {
+ return null;
+ }
+
+ public ExceptionHandler getExceptionHandler() {
+ return null;
+ }
+
+ public Object copy(Object object) {
+ return object;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SimpleTypeMapperExtension();
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.java
new file mode 100644
index 0000000000..14a4d8f66a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/Java2SimpleTypeTransformer.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.spi.databinding.extension;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.XMLType;
+
+/**
+ * Transformer to convert data from a simple java object to a databinding's representation
+ */
+public abstract class Java2SimpleTypeTransformer<T> extends TransformerExtension<Object, T> implements
+ PullTransformer<Object, T> {
+
+ protected SimpleTypeMapper mapper;
+
+ public Java2SimpleTypeTransformer() {
+ this.mapper = new SimpleTypeMapperExtension();
+ }
+
+ public Java2SimpleTypeTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperExtension();
+ }
+
+ public T transform(Object source, TransformationContext context) {
+ XMLType xmlType = (XMLType) context.getTargetDataType().getLogical();
+ String text = mapper.toXMLLiteral(xmlType.getTypeName(), source, context);
+ return createElement(xmlType.getElementName(), text, context);
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 10000;
+ }
+
+ protected abstract T createElement(QName element, String literal, TransformationContext context);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.java
new file mode 100644
index 0000000000..28b02f596a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleType2JavaTransformer.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.spi.databinding.extension;
+
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.XMLType;
+
+/**
+ * Transformer to convert data from a databinding's representation of simple
+ * types to Java Objects
+ */
+public abstract class SimpleType2JavaTransformer<T> extends TransformerExtension<T, Object> implements
+ PullTransformer<T, Object> {
+
+ protected SimpleTypeMapper mapper;
+
+ public SimpleType2JavaTransformer() {
+ this.mapper = new SimpleTypeMapperExtension();
+ }
+
+ public SimpleType2JavaTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperExtension();
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
+ return mapper.toJavaObject(xmlType.getTypeName(), getText(source), context);
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ // Cannot be used for imtermediate
+ return 10000;
+ }
+
+ /**
+ * Get the string value from the source
+ * @param source
+ * @return A string
+ */
+ protected abstract String getText(T source);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java
new file mode 100644
index 0000000000..e4671f621c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtension.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.spi.databinding.extension;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.TypeInfo;
+
+public class SimpleTypeMapperExtension extends XSDDataTypeConverter implements SimpleTypeMapper {
+
+ public static final Map<Class, String> JAVA2XML = new HashMap<Class, String>();
+
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+
+ public static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
+
+ public static final QName XSD_ANY = new QName(URI_2001_SCHEMA_XSD, "any");
+
+ public static final QName XSD_ANYSIMPLETYPE = new QName(URI_2001_SCHEMA_XSD, "anySimpleType");
+
+ public static final QName XSD_ANYTYPE = new QName(URI_2001_SCHEMA_XSD, "anyType");
+
+ public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
+
+ public static final QName XSD_BASE64 = new QName(URI_2001_SCHEMA_XSD, "base64Binary");
+
+ public static final QName XSD_BOOLEAN = new QName(URI_2001_SCHEMA_XSD, "boolean");
+
+ public static final QName XSD_BYTE = new QName(URI_2001_SCHEMA_XSD, "byte");
+
+ public static final QName XSD_DATE = new QName(URI_2001_SCHEMA_XSD, "date");
+
+ public static final QName XSD_DATETIME = new QName(URI_2001_SCHEMA_XSD, "dateTime");
+
+ public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay");
+
+ public static final QName XSD_DECIMAL = new QName(URI_2001_SCHEMA_XSD, "decimal");
+
+ public static final QName XSD_DOUBLE = new QName(URI_2001_SCHEMA_XSD, "double");
+
+ public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration");
+
+ public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES");
+
+ public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY");
+
+ public static final QName XSD_FLOAT = new QName(URI_2001_SCHEMA_XSD, "float");
+
+ public static final QName XSD_HEXBIN = new QName(URI_2001_SCHEMA_XSD, "hexBinary");
+
+ public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF");
+
+ public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS");
+
+ public static final QName XSD_INT = new QName(URI_2001_SCHEMA_XSD, "int");
+
+ public static final QName XSD_INTEGER = new QName(URI_2001_SCHEMA_XSD, "integer");
+
+ public static final QName XSD_LONG = new QName(URI_2001_SCHEMA_XSD, "long");
+
+ public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth");
+
+ public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay");
+
+ public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name");
+
+ public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
+
+ public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger");
+
+ public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
+
+ public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
+
+ public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
+
+ public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
+
+ public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString");
+
+ public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION");
+
+ public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger");
+
+ public static final QName XSD_QNAME = new QName(URI_2001_SCHEMA_XSD, "QName");
+
+ public static final QName XSD_SHORT = new QName(URI_2001_SCHEMA_XSD, "short");
+
+ public static final Map<String, TypeInfo> XSD_SIMPLE_TYPES = new HashMap<String, TypeInfo>();
+
+ public static final QName XSD_STRING = new QName(URI_2001_SCHEMA_XSD, "string");
+
+ public static final QName XSD_TIME = new QName(URI_2001_SCHEMA_XSD, "time");
+
+ public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token");
+
+ public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte");
+
+ public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt");
+
+ public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong");
+
+ public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort");
+
+ public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear");
+
+ public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth");
+
+ private static final String[] XSD_TYPE_NAMES =
+ {"string", "boolean", "double", "float", "int", "integer", "long", "short", "byte", "decimal", "base64Binary",
+ "hexBinary", "anySimpleType", "anyType", "any", "QName", "dateTime", "date", "time", "normalizedString",
+ "token", "unsignedLong", "unsignedInt", "unsignedShort", "unsignedByte", "positiveInteger", "negativeInteger",
+ "nonNegativeInteger", "nonPositiveInteger", "gYearMonth", "gMonthDay", "gYear", "gMonth", "gDay", "duration",
+ "Name", "NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "ENTITY", "ENTITIES", "IDREF", "IDREFS", "anyURI",
+ "language", "ID"};
+
+ static {
+ for (String type : XSD_TYPE_NAMES) {
+ TypeInfo simpleType = new TypeInfo(new QName(URI_2001_SCHEMA_XSD, type), true, null);
+ XSD_SIMPLE_TYPES.put(type, simpleType);
+ }
+ }
+
+ static {
+ JAVA2XML.put(boolean.class, "boolean");
+ JAVA2XML.put(byte.class, "byte");
+ JAVA2XML.put(short.class, "short");
+ JAVA2XML.put(int.class, "int");
+ JAVA2XML.put(long.class, "long");
+ JAVA2XML.put(float.class, "float");
+ JAVA2XML.put(double.class, "double");
+ JAVA2XML.put(Boolean.class, "boolean");
+ JAVA2XML.put(Byte.class, "byte");
+ JAVA2XML.put(Short.class, "short");
+ JAVA2XML.put(Integer.class, "int");
+ JAVA2XML.put(Long.class, "long");
+ JAVA2XML.put(Float.class, "float");
+ JAVA2XML.put(Double.class, "double");
+ JAVA2XML.put(java.lang.String.class, "string");
+ JAVA2XML.put(java.math.BigInteger.class, "integer");
+ JAVA2XML.put(java.math.BigDecimal.class, "decimal");
+ JAVA2XML.put(java.util.Calendar.class, "dateTime");
+ JAVA2XML.put(java.util.Date.class, "dateTime");
+ JAVA2XML.put(javax.xml.namespace.QName.class, "QName");
+ JAVA2XML.put(java.net.URI.class, "string");
+ JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, "anySimpleType");
+ JAVA2XML.put(javax.xml.datatype.Duration.class, "duration");
+ JAVA2XML.put(java.lang.Object.class, "anyType");
+ JAVA2XML.put(java.awt.Image.class, "base64Binary");
+ JAVA2XML.put(byte[].class, "base64Binary");
+ // java2XSD.put(javax.activation.DataHandler.class, "base64Binary");
+ JAVA2XML.put(javax.xml.transform.Source.class, "base64Binary");
+ JAVA2XML.put(java.util.UUID.class, "string");
+ }
+
+ static {
+ XML2JAVA.put("string", java.lang.String.class);
+ XML2JAVA.put("integer", java.math.BigInteger.class);
+ XML2JAVA.put("int", int.class);
+ XML2JAVA.put("long", long.class);
+ XML2JAVA.put("short", short.class);
+ XML2JAVA.put("decimal", java.math.BigDecimal.class);
+ XML2JAVA.put("float", float.class);
+ XML2JAVA.put("double", double.class);
+ XML2JAVA.put("boolean", boolean.class);
+ XML2JAVA.put("byte", byte.class);
+ XML2JAVA.put("QName", javax.xml.namespace.QName.class);
+ XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("base64Binary", byte[].class);
+ XML2JAVA.put("hexBinary", byte[].class);
+ XML2JAVA.put("unsignedInt", long.class);
+ XML2JAVA.put("unsignedShort", int.class);
+ XML2JAVA.put("unsignedByte", short.class);
+ XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements
+ // XML2JAVA.put("anySimpleType", java.lang.String.class); // For
+ // attributes
+ XML2JAVA.put("duration", javax.xml.datatype.Duration.class);
+ XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class);
+ }
+
+ private DatatypeFactory factory;
+
+ public SimpleTypeMapperExtension() {
+ super();
+ try {
+ this.factory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Class getJavaType(QName xmlType) {
+ if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ public TypeInfo getXMLType(Class javaType) {
+ return XSD_SIMPLE_TYPES.get(JAVA2XML.get(javaType));
+ }
+
+ public Object toJavaObject(QName simpleType, String literal, TransformationContext context) {
+ /**
+ * <ul>
+ * <li>xsd:string --- java.lang.String
+ * <li>xsd:integer --- java.math.BigInteger
+ * <li>xsd:int --- int
+ * <li>xsd:long --- long
+ * <li>xsd:short --- short
+ * <li>xsd:decimal --- java.math.BigDecimal
+ * <li>xsd:float --- float
+ * <li>xsd:double --- double
+ * <li>xsd:boolean --- boolean
+ * <li>xsd:byte --- byte
+ * <li>xsd:QName --- javax.xml.namespace.QName
+ * <li>xsd:dateTime --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:base64Binary --- byte[]
+ * <li>xsd:hexBinary --- byte[]
+ * <li>xsd:unsignedInt --- long
+ * <li>xsd:unsignedShort --- int
+ * <li>xsd:unsignedByte --- short
+ * <li>xsd:time --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:date --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:g* --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:anySimpleType (for xsd:element of this type)a
+ * java.lang.Object
+ * <li>xsd:anySimpleType (for xsd:attribute of this type)
+ * java.lang.String
+ * <li>xsd:duration javax.xml.datatype.Duration
+ * <li>xsd:NOTATION javax.xml.namespace.QName
+ * </ul>
+ */
+
+ if (literal == null) {
+ return null;
+ }
+ String value = literal.trim();
+
+ QName type = simpleType;
+ if (type.equals(XSD_STRING)) {
+ return parseString(value);
+ } else if (type.equals(XSD_INT)) {
+ return parseInt(value);
+ } else if (type.equals(XSD_INTEGER)) {
+ return parseInteger(value);
+ } else if (type.equals(XSD_INT)) {
+ return parseInt(value);
+ } else if (type.equals(XSD_FLOAT)) {
+ return parseFloat(value);
+ } else if (type.equals(XSD_DOUBLE)) {
+ return parseDouble(value);
+ } else if (type.equals(XSD_SHORT)) {
+ return parseShort(value);
+ } else if (type.equals(XSD_DECIMAL)) {
+ return parseDecimal(value);
+ } else if (type.equals(XSD_BOOLEAN)) {
+ return parseBoolean(value);
+ } else if (type.equals(XSD_BYTE)) {
+ return parseByte(value);
+ } else if (type.equals(XSD_LONG)) {
+ return parseLong(value);
+ } else if (type.equals(XSD_UNSIGNEDBYTE)) {
+ return parseUnsignedShort(value);
+ } else if (type.equals(XSD_UNSIGNEDSHORT)) {
+ return parseUnsignedShort(value);
+ } else if (type.equals(XSD_UNSIGNEDINT)) {
+ return parseUnsignedInt(value);
+ } else if (type.equals(XSD_UNSIGNEDLONG)) {
+ return parseUnsignedInt(value);
+ } else if (type.equals(XSD_DATETIME)) {
+ return parseDateTime(value);
+ } else if (type.equals(XSD_DATE)) {
+ return parseDate(value);
+ } else if (type.equals(XSD_TIME)) {
+ return parseTime(value);
+ } else if (type.equals(XSD_DURATION)) {
+ return parseDuration(value);
+ } else if (type.equals(XSD_HEXBIN)) {
+ return parseHexBinary(value);
+ } else if (type.equals(XSD_BASE64)) {
+ return parseBase64Binary(value);
+ } else if (type.equals(XSD_QNAME)) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class) : null);
+ return parseQName(value, namespaceContext);
+ } else if (type.equals(XSD_NOTATION)) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class) : null);
+ return parseQName(value, namespaceContext);
+ } else if (type.equals(XSD_YEAR)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_MONTH)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_DAY)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_YEARMONTH)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_MONTHDAY)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else {
+ return value;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private XMLGregorianCalendar toXMLGregorianCalendar(Date date) {
+ GregorianCalendar c =
+ new GregorianCalendar(date.getYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(),
+ date.getSeconds());
+ return factory.newXMLGregorianCalendar(c);
+ }
+
+ private XMLGregorianCalendar toXMLGregorianCalendar(GregorianCalendar calendar) {
+ return factory.newXMLGregorianCalendar(calendar);
+ }
+
+ public String toXMLLiteral(QName simpleType, Object obj, TransformationContext context) {
+ if (obj instanceof Float || obj instanceof Double) {
+ if (obj instanceof Float) {
+ return printDouble(((Float)obj).floatValue());
+ } else {
+ return printDouble(((Double)obj).doubleValue());
+ }
+ } else if (obj instanceof GregorianCalendar) {
+ GregorianCalendar calendar = (GregorianCalendar)obj;
+ return toXMLGregorianCalendar(calendar).toXMLFormat();
+ } else if (obj instanceof Date) {
+ return toXMLGregorianCalendar((Date)obj).toXMLFormat();
+ } else if (obj instanceof XMLGregorianCalendar) {
+ return ((XMLGregorianCalendar)obj).toXMLFormat();
+ } else if (obj instanceof byte[]) {
+ if (simpleType != null) {
+ if (simpleType.equals(XSD_BASE64)) {
+ return printBase64Binary((byte[])obj);
+ } else if (simpleType.equals(XSD_HEXBIN)) {
+ return printHexBinary((byte[])obj);
+ }
+ }
+ } else if (obj instanceof QName) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class) : null);
+ return printQName((QName)obj, namespaceContext);
+ }
+ return obj.toString();
+ }
+
+ public static boolean isSimpleXSDType(QName typeName) {
+ if (typeName == null) {
+ return false;
+ }
+ return typeName.getNamespaceURI().equals(URI_2001_SCHEMA_XSD)
+ && XSD_SIMPLE_TYPES.get(typeName.getLocalPart()) != null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.java
new file mode 100644
index 0000000000..d54dbca1d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/TransformerExtension.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.spi.databinding.extension;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.TransformerRegistry;
+
+/**
+ * Base Implementation of Transformer which provides the registration to the transformer registry
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+@Scope("COMPOSITE")
+@EagerInit
+public abstract class TransformerExtension<S, T> implements Transformer {
+
+ protected TransformerRegistry registry;
+
+ protected TransformerExtension() {
+ super();
+ }
+
+ @Autowire
+ public void setTransformerRegistry(TransformerRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.registerTransformer(this);
+ }
+
+ protected abstract Class getSourceType();
+
+ protected abstract Class getTargetType();
+
+ public String getSourceDataBinding() {
+ return getSourceType().getName();
+ }
+
+ public String getTargetDataBinding() {
+ return getTargetType().getName();
+ }
+
+ public int getWeight() {
+ // default to 50
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java
new file mode 100644
index 0000000000..a0c75570bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java
@@ -0,0 +1,940 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.spi.databinding.extension;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.util.Calendar;
+import java.util.TimeZone;
+import javax.xml.XMLConstants;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+/**
+ * Utility class for XSD data type conversions
+ */
+public class XSDDataTypeConverter {
+ public static final class Base64Binary {
+ private static final char[] S_BASE64CHAR =
+ {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
+ 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
+ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9', '+', '/'};
+
+ private static final char S_BASE64PAD = '=';
+
+ private static final byte[] S_DECODETABLE = new byte[128];
+
+ static {
+ for (int i = 0; i < S_DECODETABLE.length; i++) {
+ S_DECODETABLE[i] = Byte.MAX_VALUE; // 127
+ }
+ for (int i = 0; i < S_BASE64CHAR.length; i++) {
+ // 0 to 63
+ S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i;
+ }
+ }
+
+ private Base64Binary() {
+ }
+
+ /**
+ *
+ */
+ public static byte[] decode(char[] data, int off, int len) {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[len / 4 * 3 + 3];
+ int obufcount = 0;
+ for (int i = off; i < off + len; i++) {
+ char ch = data[i];
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ obufcount += decode0(ibuf, obuf, obufcount);
+ }
+ }
+ }
+ if (obufcount == obuf.length) {
+ return obuf;
+ }
+ byte[] ret = new byte[obufcount];
+ System.arraycopy(obuf, 0, ret, 0, obufcount);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[3];
+ for (int i = off; i < off + len; i++) {
+ char ch = data[i];
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ int obufcount = decode0(ibuf, obuf, 0);
+ ostream.write(obuf, 0, obufcount);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public static byte[] decode(String data) {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[data.length() / 4 * 3 + 3];
+ int obufcount = 0;
+ for (int i = 0; i < data.length(); i++) {
+ char ch = data.charAt(i);
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ obufcount += decode0(ibuf, obuf, obufcount);
+ }
+ }
+ }
+ if (obufcount == obuf.length) {
+ return obuf;
+ }
+ byte[] ret = new byte[obufcount];
+ System.arraycopy(obuf, 0, ret, 0, obufcount);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public static void decode(String data, OutputStream ostream) throws IOException {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[3];
+ for (int i = 0; i < data.length(); i++) {
+ char ch = data.charAt(i);
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ int obufcount = decode0(ibuf, obuf, 0);
+ ostream.write(obuf, 0, obufcount);
+ }
+ }
+ }
+ }
+
+ private static int decode0(char[] ibuf, byte[] obuf, int index) {
+ int wp = index;
+ int outlen = 3;
+ if (ibuf[3] == S_BASE64PAD) {
+ outlen = 2;
+ }
+ if (ibuf[2] == S_BASE64PAD) {
+ outlen = 1;
+ }
+ int b0 = S_DECODETABLE[ibuf[0]];
+ int b1 = S_DECODETABLE[ibuf[1]];
+ int b2 = S_DECODETABLE[ibuf[2]];
+ int b3 = S_DECODETABLE[ibuf[3]];
+ switch (outlen) {
+ case 1:
+ obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ return 1;
+ case 2:
+ obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+ return 2;
+ case 3:
+ obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+ obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);
+ return 3;
+ default:
+ throw new IllegalArgumentException("The character sequence is not base64 encoded.");
+ }
+ }
+
+ /**
+ * Returns base64 representation of specified byte array.
+ */
+ public static String encode(byte[] data) {
+ return encode(data, 0, data.length);
+ }
+
+ /**
+ * Returns base64 representation of specified byte array.
+ */
+ public static String encode(byte[] data, int off, int len) {
+ if (len <= 0) {
+ return "";
+ }
+ char[] out = new char[len / 3 * 4 + 4];
+ int rindex = off;
+ int windex = 0;
+ int rest = len - off;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[windex++] = S_BASE64CHAR[i >> 18];
+ out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[windex++] = S_BASE64CHAR[i & 0x3f];
+ rindex += 3;
+ rest -= 3;
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[windex++] = S_BASE64CHAR[i >> 2];
+ out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f];
+ out[windex++] = S_BASE64PAD;
+ out[windex++] = S_BASE64PAD;
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[windex++] = S_BASE64CHAR[i >> 10];
+ out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f];
+ out[windex++] = S_BASE64PAD;
+ }
+ return new String(out, 0, windex);
+ }
+
+ /**
+ * Outputs base64 representation of the specified byte array to a byte stream.
+ */
+ public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException {
+ if (len <= 0) {
+ return;
+ }
+ byte[] out = new byte[4];
+ int rindex = off;
+ int rest = len - off;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[0] = (byte) S_BASE64CHAR[i >> 18];
+ out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[3] = (byte) S_BASE64CHAR[i & 0x3f];
+ ostream.write(out, 0, 4);
+ rindex += 3;
+ rest -= 3;
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[0] = (byte) S_BASE64CHAR[i >> 2];
+ out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f];
+ out[2] = (byte) S_BASE64PAD;
+ out[3] = (byte) S_BASE64PAD;
+ ostream.write(out, 0, 4);
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[0] = (byte) S_BASE64CHAR[i >> 10];
+ out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f];
+ out[3] = (byte) S_BASE64PAD;
+ ostream.write(out, 0, 4);
+ }
+ }
+
+ /**
+ * Outputs base64 representation of the specified byte array to a character stream.
+ */
+ public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
+ if (len <= 0) {
+ return;
+ }
+ char[] out = new char[4];
+ int rindex = off;
+ int rest = len - off;
+ int output = 0;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[0] = S_BASE64CHAR[i >> 18];
+ out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[3] = S_BASE64CHAR[i & 0x3f];
+ writer.write(out, 0, 4);
+ rindex += 3;
+ rest -= 3;
+ output += 4;
+ if (output % 76 == 0) {
+ writer.write("\n");
+ }
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[0] = S_BASE64CHAR[i >> 2];
+ out[1] = S_BASE64CHAR[(i << 4) & 0x3f];
+ out[2] = S_BASE64PAD;
+ out[3] = S_BASE64PAD;
+ writer.write(out, 0, 4);
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[0] = S_BASE64CHAR[i >> 10];
+ out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[2] = S_BASE64CHAR[(i << 2) & 0x3f];
+ out[3] = S_BASE64PAD;
+ writer.write(out, 0, 4);
+ }
+ }
+ }
+
+ /**
+ * <p/>
+ * Utility class for xs:hexbinary. </p>
+ */
+ public static final class HexBinary {
+ private HexBinary() {
+ }
+
+ /**
+ * Converts the string <code>pValue</code> into an array of hex bytes.
+ */
+ public static byte[] decode(String pValue) {
+ if ((pValue.length() % 2) != 0) {
+ throw new IllegalArgumentException("A HexBinary string must have even length.");
+ }
+ byte[] result = new byte[pValue.length() / 2];
+ int j = 0;
+ int i = 0;
+ while (i < pValue.length()) {
+ byte b;
+ char c = pValue.charAt(i++);
+ char d = pValue.charAt(i++);
+ if (c >= '0' && c <= '9') {
+ b = (byte) ((c - '0') << 4);
+ } else if (c >= 'A' && c <= 'F') {
+ b = (byte) ((c - 'A' + 10) << 4);
+ } else if (c >= 'a' && c <= 'f') {
+ b = (byte) ((c - 'a' + 10) << 4);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + c);
+ }
+ if (d >= '0' && d <= '9') {
+ b += (byte) (d - '0');
+ } else if (d >= 'A' && d <= 'F') {
+ b += (byte) (d - 'A' + 10);
+ } else if (d >= 'a' && d <= 'f') {
+ b += (byte) (d - 'a' + 10);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + d);
+ }
+ result[j++] = b;
+ }
+ return result;
+ }
+
+ /**
+ * Converts the byte array <code>pHexBinary</code> into a string.
+ */
+ public static String encode(byte[] pHexBinary) {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < pHexBinary.length; i++) {
+ byte b = pHexBinary[i];
+ byte c = (byte) ((b & 0xf0) >> 4);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ c = (byte) (b & 0x0f);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Creates a clone of the given byte array.
+ */
+ public static byte[] getClone(byte[] pHexBinary) {
+ byte[] result = new byte[pHexBinary.length];
+ System.arraycopy(pHexBinary, 0, result, 0, pHexBinary.length);
+ return result;
+ }
+ }
+
+ public class XSDDateFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = -1629412916827246627L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateFormat() {
+ super(true, false);
+ }
+ }
+
+ /**
+ * <p/>
+ * An instance of {@link java.text.Format}, which may be used to parse and format <code>xs:dateTime</code> values.
+ * </p>
+ */
+ public static class XSDDateTimeFormat extends Format {
+ private static final long serialVersionUID = -1148332471737068969L;
+
+ final boolean parseDate;
+
+ final boolean parseTime;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateTimeFormat() {
+ this(true, true);
+ }
+
+ XSDDateTimeFormat(boolean pParseDate, boolean pParseTime) {
+ parseDate = pParseDate;
+ parseTime = pParseTime;
+ }
+
+ private void append(StringBuffer pBuffer, int pNum, int pMinLen) {
+ String s = Integer.toString(pNum);
+ for (int i = s.length(); i < pMinLen; i++) {
+ pBuffer.append('0');
+ }
+ pBuffer.append(s);
+ }
+
+ public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
+ assert pCalendar != null : "The Calendar argument must not be null.";
+ assert pBuffer != null : "The StringBuffer argument must not be null.";
+ assert pPos != null : "The FieldPosition argument must not be null.";
+
+ Calendar cal = (Calendar) pCalendar;
+ if (parseDate) {
+ int year = cal.get(Calendar.YEAR);
+ if (year < 0) {
+ pBuffer.append('-');
+ year = -year;
+ }
+ append(pBuffer, year, 4);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.MONTH) + 1, 2);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2);
+ if (parseTime) {
+ pBuffer.append('T');
+ }
+ }
+ if (parseTime) {
+ append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.MINUTE), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.SECOND), 2);
+ int millis = cal.get(Calendar.MILLISECOND);
+ if (millis > 0) {
+ pBuffer.append('.');
+ append(pBuffer, millis, 3);
+ }
+ }
+ TimeZone tz = cal.getTimeZone();
+ // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
+ int offset = cal.get(Calendar.ZONE_OFFSET);
+ if (tz.inDaylightTime(cal.getTime())) {
+ offset += cal.get(Calendar.DST_OFFSET);
+ }
+ if (offset == 0) {
+ pBuffer.append('Z');
+ } else {
+ if (offset < 0) {
+ pBuffer.append('-');
+ offset = -offset;
+ } else {
+ pBuffer.append('+');
+ }
+ int minutes = offset / (60 * 1000);
+ int hours = minutes / 60;
+ minutes -= hours * 60;
+ append(pBuffer, hours, 2);
+ pBuffer.append(':');
+ append(pBuffer, minutes, 2);
+ }
+ return pBuffer;
+ }
+
+ private int parseInt(String pString, int offset, StringBuffer pDigits) {
+ int length = pString.length();
+ int pOffset = offset;
+ pDigits.setLength(0);
+ while (pOffset < length) {
+ char c = pString.charAt(pOffset);
+ if (Character.isDigit(c)) {
+ pDigits.append(c);
+ ++pOffset;
+ } else {
+ break;
+ }
+ }
+ return pOffset;
+ }
+
+ public Object parseObject(String pString, ParsePosition pParsePosition) {
+ assert pString != null : "The String argument must not be null.";
+ assert pParsePosition != null : "The ParsePosition argument must not be null.";
+ int offset = pParsePosition.getIndex();
+ int length = pString.length();
+
+ boolean isMinus = false;
+ StringBuffer digits = new StringBuffer();
+ int year = 0;
+ int month = 0;
+ int mday = 0;
+ if (parseDate) {
+ // Sign
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == '+') {
+ ++offset;
+ } else if (c == '-') {
+ ++offset;
+ isMinus = true;
+ }
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() < 4) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ year = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ month = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ mday = Integer.parseInt(digits.toString());
+
+ if (parseTime) {
+ if (offset < length && pString.charAt(offset) == 'T') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ }
+ } else {
+ year = month = mday = 0;
+ }
+
+ int hour = 0;
+ int minute = 0;
+ int second = 0;
+ int millis = 0;
+ if (parseTime) {
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ hour = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ minute = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ second = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '.') {
+ ++offset;
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() > 0) {
+ millis = Integer.parseInt(digits.toString());
+ } else {
+ millis = 0;
+ }
+ } else {
+ millis = 0;
+ }
+ } else {
+ hour = minute = second = millis = 0;
+ }
+
+ digits.setLength(0);
+ digits.append("GMT");
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == 'Z') {
+ // Ignore UTC, it is the default
+ ++offset;
+ } else if (c == '+' || c == '-') {
+ digits.append(c);
+ ++offset;
+ for (int i = 0; i < 5; i++) {
+ if (offset >= length) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ c = pString.charAt(offset);
+ if ((i != 2 && Character.isDigit(c)) || (i == 2 && c == ':')) {
+ digits.append(c);
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ ++offset;
+ }
+ }
+ }
+
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
+ cal.set(isMinus ? -year : year, parseDate ? month - 1 : month, mday, hour, minute, second);
+ cal.set(Calendar.MILLISECOND, millis);
+ pParsePosition.setIndex(offset);
+ return cal;
+ }
+ }
+
+ public static class XSDTimeFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = 1346506860724640517L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDTimeFormat() {
+ super(false, true);
+ }
+ }
+
+ private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1;
+
+ private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
+
+ public String parseAnySimpleType(String value) {
+ return value;
+ }
+
+ public byte[] parseBase64Binary(String value) {
+ return Base64Binary.decode(value);
+ }
+
+ public boolean parseBoolean(String value) {
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public byte parseByte(String value) {
+ return Byte.parseByte(value);
+ }
+
+ public Calendar parseDate(String value) {
+ XSDDateFormat format = new XSDDateFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse date " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public Calendar parseDateTime(String value) {
+ XSDDateTimeFormat format = new XSDDateTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse dateTime " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public BigDecimal parseDecimal(String value) {
+ return new BigDecimal(value);
+ }
+
+ public double parseDouble(String value) {
+ if ("INF".equals(value)) {
+ return Double.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Double.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Double.NaN;
+ } else {
+ return Double.parseDouble(value);
+ }
+ }
+
+ public Duration parseDuration(String pDuration) {
+ try {
+ return DatatypeFactory.newInstance().newDuration(pDuration);
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public float parseFloat(String value) {
+ if ("INF".equals(value)) {
+ return Float.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Float.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Float.NaN;
+ } else {
+ return Float.parseFloat(value);
+ }
+ }
+
+ public byte[] parseHexBinary(String value) {
+ return HexBinary.decode(value);
+ }
+
+ public int parseInt(String value) {
+ return Integer.parseInt(value);
+ }
+
+ public BigInteger parseInteger(String value) {
+ return new BigInteger(value);
+ }
+
+ public long parseLong(String value) {
+ return Long.parseLong(value);
+ }
+
+ public QName parseQName(String value, NamespaceContext context) {
+ int offset = value.indexOf(':');
+ String uri;
+ String localName;
+ switch (offset) {
+ case -1:
+ localName = value;
+ uri = context.getNamespaceURI("");
+ if (uri == null) {
+ // Should not happen, indicates an error in the
+ // NamespaceContext
+ // implementation
+ throw new IllegalArgumentException("The default prefix is not bound.");
+ }
+ break;
+ case 0:
+ throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: "
+ + value);
+ default:
+ String prefix = value.substring(0, offset);
+ localName = value.substring(offset + 1);
+ uri = context.getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new IllegalArgumentException("The prefix " + prefix + " is not bound.");
+ }
+ }
+ return new QName(uri, localName);
+ }
+
+ public short parseShort(String value) {
+ return Short.parseShort(value);
+ }
+
+ public String parseString(String value) {
+ return value;
+ }
+
+ public Calendar parseTime(String value) {
+ XSDTimeFormat format = new XSDTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse time " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public long parseUnsignedInt(String value) {
+ long l = Long.parseLong(value);
+ if (l < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result is negative");
+ }
+ if (l > MAX_UNSIGNED_INT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
+ }
+ return l;
+ }
+
+ public int parseUnsignedShort(String value) {
+ int i = Integer.parseInt(value);
+ if (i < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result is negative");
+ }
+ if (i > MAX_UNSIGNED_SHORT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
+ }
+ return i;
+ }
+
+ public String printAnySimpleType(String value) {
+ return value;
+ }
+
+ public String printBase64Binary(byte[] value) {
+ return Base64Binary.encode(value);
+ }
+
+ public String printBoolean(boolean value) {
+ return (value ? Boolean.TRUE : Boolean.FALSE).toString();
+ }
+
+ public String printByte(byte value) {
+ return Byte.toString(value);
+ }
+
+ public String printDate(Calendar value) {
+ return new XSDDateFormat().format(value);
+ }
+
+ public String printDateTime(Calendar value) {
+ return new XSDDateTimeFormat().format(value);
+ }
+
+ public String printDecimal(BigDecimal value) {
+ return value.toString();
+ }
+
+ public String printDouble(double value) {
+ return Double.toString(value);
+ }
+
+ public String printDuration(Duration pDuration) {
+ return pDuration.toString();
+ }
+
+ public String printFloat(float value) {
+ return Float.toString(value);
+ }
+
+ public String printHexBinary(byte[] value) {
+ return HexBinary.encode(value);
+ }
+
+ public String printInt(int value) {
+ return Integer.toString(value);
+ }
+
+ public String printInteger(BigInteger value) {
+ return value.toString();
+ }
+
+ public String printLong(long value) {
+ return Long.toString(value);
+ }
+
+ public String printQName(QName value, NamespaceContext context) {
+ String prefix = context.getPrefix(value.getNamespaceURI());
+ if (prefix == null) {
+ throw new IllegalArgumentException("The namespace URI " + value.getNamespaceURI()
+ + " is not bound.");
+ } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
+ return value.getLocalPart();
+ } else {
+ return prefix + ":" + value.getLocalPart();
+ }
+ }
+
+ public String printShort(short value) {
+ return Short.toString(value);
+ }
+
+ public String printString(String value) {
+ return value;
+ }
+
+ public String printTime(Calendar value) {
+ return new XSDTimeFormat().format(value);
+ }
+
+ public String printUnsignedInt(long value) {
+ return Long.toString(value);
+ }
+
+ public String printUnsignedShort(int value) {
+ return Integer.toString(value);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolver.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolver.java
new file mode 100644
index 0000000000..bd4c29e48b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolver.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 org.apache.tuscany.spi.deployer;
+
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Contribution;
+
+
+/**
+ * SCA Assemblies reference many artifacts of a wide variety of types. These
+ * include:
+ * <ul>
+ * <li> Reference from one SCA composite to another SCA composite
+ * <li> Reference to PolicySet files
+ * <li> Reference to interface definition files, either WSDL or Java interfaces
+ * <li> Reference to XSD files
+ * <li> Reference to any of a wide variety of implementation artifact files,
+ * including Java classes, BPEL scripts, C++ DLLs and classes, PHP scripts
+ * </ul>
+ * In the SCA assemblies, these various artifacts are referenced using either
+ * QNames or URIs that do not point to a specific entity. Resolution of these
+ * references to concrete artifacts is necessary as part of the operation of the
+ * SCA domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactResolver {
+ /**
+ * Resolve an artifact by the qualified name
+ *
+ * @param contribution the model of the contribution
+ * @param modelClass The java type of the artifact
+ * @param namespace The namespace of the artifact
+ * @param name The name of the artifact
+ * @param attributes Additional attributes that can be used to constrain the
+ * resolution
+ * @param context The deployment context
+ * @return The resolved artifact
+ */
+ <T> T resolve(Contribution contribution,
+ Class<T> modelClass,
+ String namespace,
+ String name,
+ Map attributes,
+ DeploymentContext context);
+
+ /**
+ * Resolve an artifact by the URI. Some typical use cases are:
+ * <ul>
+ * <li>Reference a XML schema using
+ * {http://www.w3.org/2001/XMLSchema-instance}schemaLocation or
+ * <li>Reference a list of WSDLs using
+ * {http://www.w3.org/2004/08/wsdl-instance}wsdlLocation
+ * </ul>
+ * @param targetNamespace The target namespace of the referenced artifact,
+ * if the targetNamespace is null, then it's not specified
+ * @param location The URI of the referenced artifact, it can be absolute or
+ * relative
+ * @param baseURI The URI of the owning artifact
+ *
+ * @return The URI of the resolved artifact
+ */
+ URL resolve(Contribution contribution, String targetNamespace, String location, String baseURI);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolverRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolverRegistry.java
new file mode 100644
index 0000000000..f24fb7269a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ArtifactResolverRegistry.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.spi.deployer;
+
+
+/**
+ * Registry for artifact resolvers
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactResolverRegistry extends ArtifactResolver {
+ /**
+ * Register a resolver by the type of artifacts. For example, you can
+ * register a resolver to resolve WSDL model objects and other resolver
+ * for java classes
+ *
+ * @param modelClass The java type of the model object
+ * @param resolver The resolver
+ */
+ void registerResolver(Class<?> modelClass, ArtifactResolver resolver);
+
+ /**
+ * Unregister all resolvers for the given model class
+ *
+ * @param modelClass
+ */
+ void unregisterResolver(Class<?> modelClass);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandler.java
new file mode 100644
index 0000000000..fead0453be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandler.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.spi.deployer;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Interface implemented by services that process assembly change sets.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ChangeSetHandler {
+ /**
+ * Returns the content type that this implementation can handle.
+ *
+ * @return the content type that this implementation can handle
+ */
+ String getContentType();
+
+ /**
+ * Apply the changes in the supplied changeSet stream to an Assembly.
+ * The content on the stream must match the content type this implementation can handle.
+ *
+ * @param changeSet the set of changes to apply represented as the supported content type
+ * @throws DeploymentException if there was a problem applying the changes
+ * @throws IOException if there was a problem reading the stream
+ */
+ void applyChanges(InputStream changeSet) throws DeploymentException, IOException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandlerRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandlerRegistry.java
new file mode 100644
index 0000000000..df0bf4109b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ChangeSetHandlerRegistry.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.spi.deployer;
+
+/**
+ * Registry for ChangeSetHandler implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ChangeSetHandlerRegistry {
+ void register(ChangeSetHandler handler);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.java
new file mode 100644
index 0000000000..63db5b9e24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/CompositeClassLoader.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.spi.deployer;
+
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
+
+/**
+ * ClassLoader associated with a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeClassLoader extends URLClassLoader {
+ private static final URL[] NOURLS = {};
+
+ public CompositeClassLoader(ClassLoader classLoader) {
+ super(NOURLS, classLoader);
+ }
+
+ public CompositeClassLoader(URL[] urls, ClassLoader classLoader) {
+ super(urls, classLoader);
+ }
+
+ public CompositeClassLoader(URL[] urls) {
+ super(urls);
+ }
+
+ public CompositeClassLoader(URL[] urls, ClassLoader classLoader, URLStreamHandlerFactory urlStreamHandlerFactory) {
+ super(urls, classLoader, urlStreamHandlerFactory);
+ }
+
+ public void addURL(URL url) {
+ super.addURL(url);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentType.java
new file mode 100644
index 0000000000..d29f935dc4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentType.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.spi.deployer;
+
+public interface ContentType {
+ /**
+ * Archive specific content types
+ */
+ public static final String JAR = "application/x-compressed";
+ public static final String FOLDER = "application/vnd.tuscany.folder";
+
+ /**
+ * Artifact/File specific content types
+ */
+ public static final String CONTRIBUTION_METADATA = "application/vnd.tuscany.contribution.metadata";
+ public static final String COMPOSITE = "application/vnd.tuscany.composite";
+ public static final String WSDL = "application/vnd.tuscany.wsdl";
+ public static final String JAVA = "application/java-vm";
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentTypeDescriber.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentTypeDescriber.java
new file mode 100644
index 0000000000..667b3dec69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContentTypeDescriber.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.spi.deployer;
+
+import java.net.URL;
+
+/**
+ * Provide content type for a given resource
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContentTypeDescriber {
+ /**
+ * @param resourceURL
+ * @param defaultContentType
+ * @return
+ */
+ String getContentType(URL resourceURL, String defaultContentType);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessor.java
new file mode 100644
index 0000000000..a1cf4d7c9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessor.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.spi.deployer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.model.Contribution;
+
+/**
+ * Interface for services that can process contributions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionProcessor {
+ /**
+ * Process a contribution or an artifact in the contribution from the input
+ * stream. The processor might add artifacts or model objects to the
+ * contribution object.
+ *
+ * @param contribution The contribution model that will be used to hold the
+ * results from the processing
+ * @param source The URI for the contribution/artifact
+ * @param inputStream The input stream for the contribution. The stream will
+ * not be closed but the read position after the call is
+ * undefined
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ void processContent(Contribution contribution, URI source, InputStream inputStream) throws DeploymentException,
+ IOException;
+
+ /**
+ * Process a contribution from another model object. It will be used for the
+ * case that one artifact has other inline artifacts, for example, the WSDL
+ * with inline schemas. The schema contribution processor should be able to
+ * load the schema model from the WSDL definition.
+ *
+ * @param contribution The contribution model that will be used to hold the
+ * results from the processing
+ * @param source The URI for the contribution/artifact.
+ * @param modelObject A model object for further processing by the processor
+ * @throws DeploymentException
+ * @throws IOException
+ */
+ void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessorRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessorRegistry.java
new file mode 100644
index 0000000000..c1b6e93cb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionProcessorRegistry.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.spi.deployer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ContributionProcessorRegistry extends ContributionProcessor {
+ /**
+ * Register a ContributionProcessor using the content type as the key
+ * @param processor
+ */
+ void register(String contentType, ContributionProcessor processor);
+
+ /**
+ * Unregister a ContributionProcessor by content type
+ * @param contentType
+ */
+ void unregister(String contentType);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionRepository.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionRepository.java
new file mode 100644
index 0000000000..4721511cdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/ContributionRepository.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.spi.deployer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+public interface ContributionRepository {
+ /**
+ * Get the URI of the SCA domain
+ *
+ * @return
+ */
+ URI getDomain();
+
+ /**
+ * Copy a contribution to the repository.
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param contributionStream InputStream with the content of the
+ * distribution
+ */
+ URL store(URI contribution, InputStream contributionStream) throws IOException;
+
+ /**
+ * Copy a contribution from the source URL to the repository
+ * @param contribution
+ * @param sourceURL
+ * @return
+ * @throws IOException
+ */
+ URL store(URI contribution, URL sourceURL) throws IOException;
+
+ /**
+ * Look up the contribution by URI
+ *
+ * @param contribution The URI of the contribution
+ * @return A URL pointing to the content of the contribution in the
+ * repository, it will be null if the contribution cannot be found
+ * in the repository
+ */
+ URL find(URI contribution);
+
+ /**
+ * Remove a contribution from the repository
+ *
+ * @param contribution The URI of the contribution to be removed
+ */
+ void remove(URI contribution);
+
+ /**
+ * Get list of URIs for all the contributions in the repository
+ *
+ * @return A list of contribution URIs
+ */
+ List<URI> list();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
new file mode 100644
index 0000000000..0e39a6fcf2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.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.spi.deployer;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Interface that can be used to deploy SCA bundles to a runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Deployer {
+ /**
+ * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to represent the supplied component
+ * definition. The type of component created will depend on the component definition implementation; for example, if the implementation of the
+ * component definition is a composite then typically a CompositeComponent would be returned.
+ *
+ * @param parent
+ * the parent context
+ * @param componentDefinition
+ * the component definition as parsed from an assembly
+ * @return the newly deployed component
+ */
+ <I extends Implementation<?>> Component deploy(CompositeComponent parent, ComponentDefinition<I> componentDefinition)
+ throws LoaderException, BuilderException, ComponentException;
+
+ /**
+ * Deploy a component as a child of the supplied parent. This operation creates a new component in the runtime to represent the supplied component
+ * definition. The type of component created will depend on the component definition implementation; for example, if the implementation of the
+ * component definition is a composite then typically a CompositeComponent would be returned.
+ *
+ * @param parent
+ * the parent context
+ * @param componentDefinition
+ * the component definition as parsed from an assembly
+ * @return the newly deployed component
+ */
+ <I extends Implementation<?>> Component deployFromContribution(CompositeComponent parent,
+ ComponentDefinition<I> componentDefinition) throws BuilderException, ComponentException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
new file mode 100644
index 0000000000..921781c484
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.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 org.apache.tuscany.spi.deployer;
+
+import java.net.URL;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+/**
+ * A holder that can be used during the load process to store information that is not part of the logical assembly
+ * model. This should be regarded as transient and references to this context should not be stored inside the model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DeploymentContext {
+ /**
+ * Returns the parent of this deployment context.
+ * Will be null for the context created at the root of a deployment.
+ *
+ * @return the parent of this deployment context; may be null
+ */
+ DeploymentContext getParent();
+
+ /**
+ * Returns a class loader that can be used to load application resources.
+ *
+ * @return a class loader that can be used to load application resources
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Returns a factory that can be used to obtain an StAX XMLStreamReader.
+ *
+ * @return a factory that can be used to obtain an StAX XMLStreamReader
+ */
+ XMLInputFactory getXmlFactory();
+
+ /**
+ * Returns the ScopeContainer for the COMPOSITE scope that will be associated with this deployment unit.
+ *
+ * @return the ScopeContainer for the COMPOSITE scope that will be associated with this deployment unit
+ */
+ ScopeContainer getCompositeScope();
+
+ /**
+ * Returns the location of the SCDL definition being deployed.
+ *
+ * @return the location of the SCDL definition being deployed
+ */
+ URL getScdlLocation();
+
+ /**
+ * Return the extension property with the supplied name.
+ *
+ * @param name the name of the property
+ * @return the property value; if null indicates that no property is present
+ */
+ Object getExtension(String name);
+
+ /**
+ * Set the value of an extension property.
+ *
+ * @param name the name of the property
+ * @param value the property value; if null then the extension property is removed
+ */
+ void putExtension(String name, Object value);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java
new file mode 100644
index 0000000000..156f57c2e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentMonitor.java
@@ -0,0 +1,20 @@
+package org.apache.tuscany.spi.deployer;
+
+import org.apache.tuscany.api.TuscanyException;
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface DeploymentMonitor {
+
+ @LogLevel("FINER")
+ void startDeployment();
+
+ @LogLevel("FINER")
+ void endDeployment();
+
+ @LogLevel("SEVERE")
+ void deploymentError(TuscanyException e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/AbstractEventPublisher.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/AbstractEventPublisher.java
new file mode 100644
index 0000000000..cc20866cbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/AbstractEventPublisher.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.spi.event;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * Base implementation of an <code>EventPublisher</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractEventPublisher implements EventPublisher {
+ protected static final EventFilter TRUE_FILTER = new TrueFilter();
+ protected Map<EventFilter, List<RuntimeEventListener>> listeners;
+
+ public void addListener(RuntimeEventListener listener) {
+ addListener(TRUE_FILTER, listener);
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ for (List<RuntimeEventListener> currentList : getListeners().values()) {
+ for (RuntimeEventListener current : currentList) {
+ if (current == listener) {
+ currentList.remove(current);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ List<RuntimeEventListener> list = getListeners().get(filter);
+ if (list == null) {
+ list = new CopyOnWriteArrayList<RuntimeEventListener>();
+ listeners.put(filter, list);
+ }
+ list.add(listener);
+ }
+ }
+
+ public void publish(Event event) {
+ assert event != null : "Event object was null";
+ for (Map.Entry<EventFilter, List<RuntimeEventListener>> entry : getListeners().entrySet()) {
+ if (entry.getKey().match(event)) {
+ for (RuntimeEventListener listener : entry.getValue()) {
+ listener.onEvent(event);
+ }
+ }
+ }
+ }
+
+ protected Map<EventFilter, List<RuntimeEventListener>> getListeners() {
+ if (listeners == null) {
+ listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
+ }
+ return listeners;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.java
new file mode 100644
index 0000000000..b874ca43c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/Event.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.spi.event;
+
+/**
+ * Represents an event that is propagated in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Event {
+
+ /**
+ * Returns the source of the event
+ */
+ Object getSource();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.java
new file mode 100644
index 0000000000..d61d04cdc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventFilter.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.spi.event;
+
+/**
+ * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event
+ */
+ boolean match(Event event);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.java
new file mode 100644
index 0000000000..35df22fb9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/EventPublisher.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.spi.event;
+
+/**
+ * Publishes events in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventPublisher {
+
+ /**
+ * Publish an event
+ */
+ void publish(Event object);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ */
+ void addListener(RuntimeEventListener listener);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ */
+ void addListener(EventFilter filter, RuntimeEventListener listener);
+
+
+ /**
+ * Removes a previously registered listener
+ */
+ void removeListener(RuntimeEventListener listener);
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.java
new file mode 100644
index 0000000000..5146559098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/RuntimeEventListener.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.spi.event;
+
+import java.util.EventListener;
+
+/**
+ * Listeners observe events fired in the SCA runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeEventListener extends EventListener {
+
+ void onEvent(Event event);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.java
new file mode 100644
index 0000000000..81382b86ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/event/TrueFilter.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.spi.event;
+
+/**
+ * An event filter that always returns a true condition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TrueFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java
new file mode 100644
index 0000000000..a6c1ff086f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.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.spi.extension;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+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.model.PropertyValue;
+
+/**
+ * @version Provides support for property accessors.
+ */
+public abstract class AbstractComponentExtension extends AbstractSCAObject implements Component {
+ protected ScopeContainer scopeContainer;
+
+ /**
+ * Default property values.
+ */
+ private Map<String, PropertyValue<?>> defaultPropertyValues;
+
+ /**
+ * Initializes component name and parent.
+ *
+ * @param name Name of the component.
+ * @param parent Parent of the component.
+ */
+ public AbstractComponentExtension(String name, CompositeComponent parent) {
+ super(name, parent);
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ this.scopeContainer = scopeContainer;
+ }
+
+ public Map<String, PropertyValue<?>> getDefaultPropertyValues() {
+ return defaultPropertyValues;
+ }
+
+ public void setDefaultPropertyValues(Map<String, PropertyValue<?>> defaultPropertyValues) {
+ this.defaultPropertyValues = defaultPropertyValues;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ArtifactResolverExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ArtifactResolverExtension.java
new file mode 100644
index 0000000000..307dc52656
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ArtifactResolverExtension.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.spi.extension;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ArtifactResolver;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The base class for ContributionProcessor implementations
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+@Service(ArtifactResolver.class)
+public abstract class ArtifactResolverExtension implements ArtifactResolver {
+ /**
+ * The ArtifactResolverRegistry that this resolver should register with; usually set by injection.
+ */
+ protected final ArtifactResolverRegistry registry;
+
+ /**
+ * @param registry the registry to set
+ */
+ @Constructor
+ public ArtifactResolverExtension(@Autowire ArtifactResolverRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Initialize the resolver. It registers itself to the registry by model type it supports.
+ */
+ @Init
+ public void start() {
+ this.registry.registerResolver(this.getType(), this);
+ }
+
+ /**
+ * Destroy the resolver. It unregisters itself from the registry.
+ */
+ @Destroy
+ public void stop() {
+ registry.unregisterResolver(this.getType());
+ }
+
+ /**
+ * Returns the model type that this resolver can handle.
+ *
+ * @return the model type that this resolver can handle
+ */
+ public abstract Class<?> getType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
new file mode 100644
index 0000000000..3124b770fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.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.spi.extension;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.PrepareException;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetInitializationException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+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.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * An extension point for atomic component type, which new implementation types may extend
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class AtomicComponentExtension extends AbstractComponentExtension implements AtomicComponent {
+ protected ScopeContainer scopeContainer;
+ protected Scope scope;
+ protected Map<String, InboundWire> serviceWires = new HashMap<String, InboundWire>();
+ protected Map<String, List<OutboundWire>> referenceWires = new HashMap<String, List<OutboundWire>>();
+ protected WireService wireService;
+ protected WorkContext workContext;
+ protected WorkScheduler workScheduler;
+ protected ExecutionMonitor monitor;
+ private final int initLevel;
+ private final long maxIdleTime;
+ private final long maxAge;
+ private boolean allowsPassByReference;
+ private List<String> passByReferenceMethods;
+
+ protected AtomicComponentExtension(String name,
+ CompositeComponent parent,
+ WireService wireService,
+ WorkContext workContext,
+ WorkScheduler workScheduler,
+ ExecutionMonitor monitor,
+ int initLevel) {
+ this(name, parent, wireService, workContext, workScheduler, monitor, initLevel, -1, -1);
+
+ }
+
+ protected AtomicComponentExtension(String name,
+ CompositeComponent parent,
+ WireService wireService,
+ WorkContext workContext,
+ WorkScheduler workScheduler,
+ ExecutionMonitor monitor,
+ int initLevel,
+ long maxIdleTime,
+ long maxAge) {
+ super(name, parent);
+ assert !(maxIdleTime > 0 && maxAge > 0);
+ this.wireService = wireService;
+ this.workContext = workContext;
+ this.workScheduler = workScheduler;
+ this.monitor = monitor;
+ this.initLevel = initLevel;
+ this.maxIdleTime = maxIdleTime;
+ this.maxAge = maxAge;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ public boolean isEagerInit() {
+ return initLevel > 0;
+ }
+
+ public boolean isDestroyable() {
+ return false;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ this.scopeContainer = scopeContainer;
+ scope = scopeContainer.getScope();
+ }
+
+ public void start() throws CoreRuntimeException {
+ super.start();
+ scopeContainer.register(this);
+ }
+
+ public void init(Object instance) throws TargetInitializationException {
+
+ }
+
+ public void destroy(Object instance) throws TargetDestructionException {
+
+ }
+
+ public void addInboundWire(InboundWire wire) {
+ serviceWires.put(wire.getServiceName(), wire);
+ onServiceWire(wire);
+ }
+
+ public InboundWire getInboundWire(String serviceName) {
+ if (serviceName == null) {
+ if (serviceWires.size() < 1) {
+ return null;
+ }
+ return serviceWires.values().iterator().next();
+ } else {
+ return serviceWires.get(serviceName);
+ }
+ }
+
+ public Collection<InboundWire> getInboundWires() {
+ return Collections.unmodifiableCollection(serviceWires.values());
+ }
+
+ public void addOutboundWire(OutboundWire wire) {
+ List<OutboundWire> list = new ArrayList<OutboundWire>();
+ list.add(wire);
+ referenceWires.put(wire.getReferenceName(), list);
+ onReferenceWire(wire);
+ }
+
+ public Map<String, List<OutboundWire>> getOutboundWires() {
+ return Collections.unmodifiableMap(referenceWires);
+ }
+
+ public void addOutboundWires(List<OutboundWire> wires) {
+ assert wires != null && wires.size() > 0;
+ referenceWires.put(wires.get(0).getReferenceName(), wires);
+ onReferenceWires(wires);
+ }
+
+ public void removeInstance() throws ComponentException {
+ scopeContainer.remove(this);
+ }
+
+ protected void onReferenceWire(OutboundWire wire) {
+ }
+
+ protected void onReferenceWires(List<OutboundWire> wires) {
+ }
+
+ protected void onServiceWire(InboundWire wire) {
+ }
+
+
+ public void prepare() throws PrepareException {
+ // connect inbound wires for atomic components
+ for (InboundWire inboundWire : getInboundWires()) {
+ for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
+ Operation<?> operation = chain.getOperation();
+ String serviceName = inboundWire.getServiceName();
+ TargetInvoker invoker;
+ try {
+ invoker = createTargetInvoker(serviceName, operation, null);
+ } catch (TargetInvokerCreationException e) {
+ throw new PrepareException("Error processing inbound wire", serviceName, e);
+ }
+ chain.setTargetInvoker(invoker);
+ chain.prepare();
+ }
+ }
+ }
+
+ public List<String> getPassByReferenceMethods() {
+ return passByReferenceMethods;
+ }
+
+ public void setPassByReferenceMethods(List<String> passByReferenceMethods) {
+ this.passByReferenceMethods = passByReferenceMethods;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.java
new file mode 100644
index 0000000000..b5bf570de0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/BindingBuilderExtension.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.spi.extension;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+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.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.model.BindingDefinition;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * An extension point for binding builders. When adding support for new serviceBindings, implementations may extend this
+ * class as a convenience.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@EagerInit
+public abstract class BindingBuilderExtension<B extends BindingDefinition> implements BindingBuilder<B> {
+
+ protected BuilderRegistry builderRegistry;
+ protected WireService wireService;
+
+ @Autowire
+ public void setBuilderRegistry(BuilderRegistry registry) {
+ this.builderRegistry = registry;
+ }
+
+ @Autowire
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ @Init
+ public void init() {
+ builderRegistry.register(getBindingType(), this);
+ }
+
+ public ServiceBinding build(CompositeComponent parent,
+ ServiceDefinition serviceDefinition,
+ B bindingDefinition,
+ DeploymentContext deploymentContext) throws BuilderException {
+ return null;
+ }
+
+ public ReferenceBinding build(CompositeComponent parent,
+ AbstractReferenceDefinition boundReferenceDefinition,
+ B bindingDefinition,
+ DeploymentContext deploymentContext) throws BuilderException {
+ return null;
+ }
+
+ protected abstract Class<B> getBindingType();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.java
new file mode 100644
index 0000000000..d58cb55131
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentBuilderExtension.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.spi.extension;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.ComponentBuilder;
+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.model.Implementation;
+import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.WireService;
+
+import org.apache.tuscany.api.annotation.Monitor;
+
+/**
+ * An extension point for component builders. When adding support for new component types, implementations may extend
+ * this class as a convenience.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@EagerInit
+public abstract class ComponentBuilderExtension<I extends Implementation<?>> implements ComponentBuilder<I> {
+ protected BuilderRegistry builderRegistry;
+ protected ScopeRegistry scopeRegistry;
+ protected WireService wireService;
+ protected WorkScheduler workScheduler;
+ protected WorkContext workContext;
+ protected PolicyBuilderRegistry policyBuilderRegistry;
+ protected Connector connector;
+ protected ExecutionMonitor monitor;
+
+ @Autowire
+ public void setBuilderRegistry(BuilderRegistry registry) {
+ this.builderRegistry = registry;
+ }
+
+ @Autowire
+ public void setScopeRegistry(ScopeRegistry scopeRegistry) {
+ this.scopeRegistry = scopeRegistry;
+ }
+
+ @Autowire
+ public void setWireService(WireService wireService) {
+ this.wireService = wireService;
+ }
+
+ @Autowire
+ public void setWorkScheduler(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ @Autowire
+ public void setWorkContext(WorkContext workContext) {
+ this.workContext = workContext;
+ }
+
+ @Autowire
+ public void setPolicyBuilderRegistry(PolicyBuilderRegistry registry) {
+ policyBuilderRegistry = registry;
+ }
+
+ @Autowire
+ public void setConnector(Connector connector) {
+ this.connector = connector;
+ }
+
+ @Monitor
+ public void setMonitor(ExecutionMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ @Init
+ public void init() {
+ builderRegistry.register(getImplementationType(), this);
+ }
+
+ protected abstract Class<I> getImplementationType();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.java
new file mode 100644
index 0000000000..ceebcbc490
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtension.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.spi.extension;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.loader.ComponentTypeLoader;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public abstract class ComponentTypeLoaderExtension<I extends Implementation> implements ComponentTypeLoader<I> {
+ protected LoaderRegistry loaderRegistry;
+
+ protected ComponentTypeLoaderExtension() {
+ }
+
+ protected ComponentTypeLoaderExtension(LoaderRegistry loaderRegistry) {
+ this.loaderRegistry = loaderRegistry;
+ }
+
+ @Autowire
+ public void setLoaderRegistry(LoaderRegistry loaderRegistry) {
+ this.loaderRegistry = loaderRegistry;
+ }
+
+ @Init
+ public void start() {
+ loaderRegistry.registerLoader(getImplementationClass(), this);
+ }
+
+ @Destroy
+ public void stop() {
+ loaderRegistry.unregisterLoader(getImplementationClass());
+ }
+
+ protected abstract Class<I> getImplementationClass();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
new file mode 100644
index 0000000000..e5358643e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
@@ -0,0 +1,564 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.w3c.dom.Document;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.builder.WiringException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.DuplicateNameException;
+import org.apache.tuscany.spi.component.InvalidAutowireInterface;
+import org.apache.tuscany.spi.component.PrepareException;
+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.TargetResolutionException;
+import org.apache.tuscany.spi.event.Event;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.services.management.TuscanyManagementService;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.Wire;
+
+/**
+ * An extension point for composite components, which new types may extend
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public abstract class CompositeComponentExtension extends AbstractComponentExtension implements CompositeComponent {
+ protected final Map<String, SCAObject> children = new ConcurrentHashMap<String, SCAObject>();
+ protected final List<Service> services = new ArrayList<Service>();
+ protected final List<Reference> references = new ArrayList<Reference>();
+
+ protected final Map<String, Document> propertyValues;
+ protected final Connector connector;
+
+ protected final Map<String, SCAObject> systemChildren = new ConcurrentHashMap<String, SCAObject>();
+ protected final List<Service> systemServices = new ArrayList<Service>();
+ protected final List<Reference> systemReferenceBindings = new ArrayList<Reference>();
+
+ // autowire mappings
+ protected final Map<Class, InboundWire> autowireInternal = new ConcurrentHashMap<Class, InboundWire>();
+ protected final Map<Class, InboundWire> autowireExternal = new ConcurrentHashMap<Class, InboundWire>();
+ protected final Map<Class, InboundWire> systemAutowireInternal = new ConcurrentHashMap<Class, InboundWire>();
+ protected final Map<Class, InboundWire> systemAutowireExternal = new ConcurrentHashMap<Class, InboundWire>();
+
+ /**
+ * Management service to use.
+ */
+ private TuscanyManagementService managementService;
+
+ protected CompositeComponentExtension(String name,
+ CompositeComponent parent,
+ Connector connector,
+ Map<String, Document> propertyValues) {
+ super(name, parent);
+ this.propertyValues = propertyValues;
+ this.connector = connector;
+ }
+
+ /**
+ * Autowires the management service.
+ *
+ * @param managementService Management service used for registering components.
+ */
+ @Autowire
+ public final void setManagementService(TuscanyManagementService managementService) {
+ this.managementService = managementService;
+ }
+
+ public Scope getScope() {
+ return Scope.SYSTEM;
+ }
+
+ public void onEvent(Event event) {
+ publish(event);
+ }
+
+ public <S, I extends S> void registerJavaObject(String name, Class<S> service, I instance)
+ throws ComponentRegistrationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <S, I extends S> void registerJavaObject(String name, List<Class<?>> services, I instance)
+ throws ComponentRegistrationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Document getPropertyValue(String name) {
+ return propertyValues.get(name);
+ }
+
+ public SCAObject getChild(String name) {
+ assert name != null;
+ return children.get(name);
+ }
+
+ public SCAObject getSystemChild(String name) {
+ assert name != null;
+ return systemChildren.get(name);
+ }
+
+ public void register(SCAObject child) throws ComponentRegistrationException {
+ assert child instanceof Service || child instanceof Reference || child instanceof Component;
+ if (child.isSystem()) {
+ if (systemChildren.get(child.getName()) != null) {
+ throw new DuplicateNameException("A system child is already registered with the name", child.getName());
+ }
+ systemChildren.put(child.getName(), child);
+ } else {
+ if (children.get(child.getName()) != null) {
+ throw new DuplicateNameException("A child is already registered with the name", child.getName());
+ }
+ children.put(child.getName(), child);
+ }
+ if (child instanceof Service) {
+ Service service = (Service) child;
+ synchronized (services) {
+ if (service.isSystem()) {
+ systemServices.add(service);
+ } else {
+ services.add(service);
+ }
+ }
+ registerAutowire(service);
+ } else if (child instanceof Reference) {
+ Reference reference = (Reference) child;
+ synchronized (references) {
+ if (reference.isSystem()) {
+ systemReferenceBindings.add(reference);
+ } else {
+ references.add(reference);
+ }
+ }
+ registerAutowire(reference);
+ } else if (child instanceof AtomicComponent) {
+ AtomicComponent atomic = (AtomicComponent) child;
+ registerAutowire(atomic);
+ if (managementService != null) {
+ managementService.registerComponent(atomic.getName(), atomic);
+ }
+ } else if (child instanceof CompositeComponent) {
+ CompositeComponent component = (CompositeComponent) child;
+ if (lifecycleState == RUNNING && component.getLifecycleState() == UNINITIALIZED) {
+ component.start();
+ }
+ registerAutowire(component);
+ addListener(component);
+ }
+ }
+
+ public Map<String, List<OutboundWire>> getOutboundWires() {
+ synchronized (references) {
+ Map<String, List<OutboundWire>> map = new HashMap<String, List<OutboundWire>>();
+ for (Reference reference : references) {
+ List<OutboundWire> wires = new ArrayList<OutboundWire>();
+ map.put(reference.getName(), wires);
+ for (ReferenceBinding binding : reference.getReferenceBindings()) {
+ OutboundWire wire = binding.getOutboundWire();
+ if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+ wires.add(wire);
+ }
+ }
+ }
+ return map;
+ }
+ }
+
+ public InboundWire getInboundWire(String serviceName) {
+ Service service;
+ if (serviceName == null) {
+ if (services.size() != 1) {
+ return null;
+ }
+ service = services.get(0);
+ } else {
+ SCAObject object = children.get(serviceName);
+ if (!(object instanceof Service)) {
+ return null;
+ }
+ service = (Service) object;
+ }
+ for (ServiceBinding binding : service.getServiceBindings()) {
+ InboundWire wire = binding.getInboundWire();
+ if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public InboundWire getInboundSystemWire(String serviceName) {
+ Service service;
+ if (serviceName == null) {
+ if (systemServices.size() != 1) {
+ return null;
+ }
+ service = systemServices.get(0);
+ } else {
+ SCAObject object = systemChildren.get(serviceName);
+ if (!(object instanceof Service)) {
+ return null;
+ }
+ service = (Service) object;
+ }
+ for (ServiceBinding binding : service.getServiceBindings()) {
+ InboundWire wire = binding.getInboundWire();
+ if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public Collection<InboundWire> getInboundWires() {
+ synchronized (services) {
+ List<InboundWire> map = new ArrayList<InboundWire>();
+ for (Service service : services) {
+ for (ServiceBinding binding : service.getServiceBindings()) {
+ InboundWire wire = binding.getInboundWire();
+ if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+ map.add(wire);
+ }
+ }
+ }
+ return map;
+ }
+ }
+
+ public Collection<InboundWire> getInboundSystemWires() {
+ synchronized (systemServices) {
+ List<InboundWire> map = new ArrayList<InboundWire>();
+ for (Service service : systemServices) {
+ for (ServiceBinding binding : service.getServiceBindings()) {
+ InboundWire wire = binding.getInboundWire();
+ if (Wire.LOCAL_BINDING.equals(wire.getBindingType())) {
+ map.add(wire);
+ }
+ }
+ }
+ return map;
+ }
+ }
+
+ public InboundWire resolveAutowire(Class<?> instanceInterface) throws TargetResolutionException {
+ // FIXME JNB make this faster and thread safe
+ for (Map.Entry<Class, InboundWire> service : autowireInternal.entrySet()) {
+ if (instanceInterface.isAssignableFrom(service.getKey())) {
+ return service.getValue();
+ }
+ }
+
+ // FIXME: [rfeng] Try to lookup from system. Is it reasonable?
+ InboundWire inboundWire = resolveSystemAutowire(instanceInterface);
+
+ if (inboundWire != null) {
+ return inboundWire;
+ }
+ if (getParent() != null) {
+ return getParent().resolveAutowire(instanceInterface);
+ }
+ return null;
+ }
+
+ public InboundWire resolveSystemAutowire(Class<?> instanceInterface) throws TargetResolutionException {
+ // FIXME JNB make this faster and thread safe
+ for (Map.Entry<Class, InboundWire> service : systemAutowireInternal.entrySet()) {
+ if (instanceInterface.isAssignableFrom(service.getKey())) {
+ return service.getValue();
+ }
+ }
+ if (getParent() != null) {
+ return getParent().resolveSystemAutowire(instanceInterface);
+ }
+ return null;
+ }
+
+ public InboundWire resolveExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException {
+ // FIXME JNB make this faster and thread safe
+ for (Map.Entry<Class, InboundWire> service : autowireExternal.entrySet()) {
+ if (instanceInterface.isAssignableFrom(service.getKey())) {
+ return service.getValue();
+ }
+ }
+ if (getParent() != null) {
+ return getParent().resolveAutowire(instanceInterface);
+ }
+ return null;
+ }
+
+ public InboundWire resolveSystemExternalAutowire(Class<?> instanceInterface) throws TargetResolutionException {
+ // FIXME JNB make this faster and thread safe
+ for (Map.Entry<Class, InboundWire> service : systemAutowireExternal.entrySet()) {
+ if (instanceInterface.isAssignableFrom(service.getKey())) {
+ return service.getValue();
+ }
+ }
+ if (getParent() != null) {
+ return getParent().resolveAutowire(instanceInterface);
+ }
+ return null;
+ }
+
+ public void prepare() throws PrepareException {
+ // Connect services and references first so that their wires are linked first
+ List<SCAObject> childList = new ArrayList<SCAObject>();
+ for (SCAObject child : systemChildren.values()) {
+ if (child instanceof Component) {
+ childList.add(child);
+ } else {
+ childList.add(0, child);
+ }
+ }
+ // connect system artifacts
+ for (SCAObject child : childList) {
+ // connect all children
+ // TODO for composite wires, should delegate down
+ try {
+ connector.connect(child);
+ child.prepare();
+ } catch (PrepareException e) {
+ e.addContextName(getName());
+ } catch (WiringException e) {
+ throw new PrepareException("Error preparing composite", getName(), e);
+ }
+ }
+
+ // connect application artifacts
+ childList.clear();
+ for (SCAObject child : children.values()) {
+ if (child instanceof Component) {
+ childList.add(child);
+ } else {
+ childList.add(0, child);
+ }
+ }
+ for (SCAObject child : childList) {
+ // connect all children
+ // TODO for composite wires, should delegate down
+ try {
+ connector.connect(child);
+ child.prepare();
+ } catch (PrepareException e) {
+ e.addContextName(getName());
+ throw e;
+ } catch (WiringException e) {
+ throw new PrepareException("Error preparing composite", getName(), e);
+ }
+ }
+ }
+
+ protected void registerAutowireExternal(Class<?> interfaze, Service service) throws InvalidAutowireInterface {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (service.isSystem()) {
+ if (systemAutowireExternal.containsKey(interfaze)) {
+ return;
+ }
+ // TODO autowire should allow multiple interfaces
+ List<ServiceBinding> bindings = service.getServiceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface",
+ interfaze.getName());
+ }
+ systemAutowireExternal.put(interfaze, wire);
+ } else {
+ if (autowireExternal.containsKey(interfaze)) {
+ return;
+ }
+ // TODO autowire should allow multiple interfaces
+ List<ServiceBinding> bindings = service.getServiceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ String iName = interfaze.getName();
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
+ }
+ autowireExternal.put(interfaze, wire);
+ }
+ }
+
+ protected void registerAutowireInternal(Class<?> interfaze, InboundWire wire, boolean system)
+ throws InvalidAutowireInterface {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (system) {
+ if (systemAutowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ systemAutowireInternal.put(interfaze, wire);
+ } else {
+ if (autowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ String iName = interfaze.getName();
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
+ }
+ autowireInternal.put(interfaze, wire);
+ }
+ }
+
+ protected void registerAutowireInternal(Class<?> interfaze, Reference reference) throws InvalidAutowireInterface {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (reference.isSystem()) {
+ if (systemAutowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ List<ReferenceBinding> bindings = reference.getReferenceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface",
+ interfaze.getName());
+ }
+ systemAutowireInternal.put(interfaze, wire);
+ } else {
+ if (autowireInternal.containsKey(interfaze)) {
+ return;
+ }
+ List<ReferenceBinding> bindings = reference.getReferenceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ if (!interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ String iName = interfaze.getName();
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface", iName);
+ }
+ autowireInternal.put(interfaze, wire);
+ }
+ }
+
+ protected void registerAutowireInternal(Class<?> interfaze, AtomicComponent component)
+ throws InvalidAutowireInterface {
+ if (interfaze == null) {
+ // The ServiceContract is not from Java
+ return;
+ }
+ if (component.isSystem()) {
+ if (systemAutowireInternal.containsKey(interfaze) || component.getInboundWires().size() == 0) {
+ return;
+ }
+ for (InboundWire wire : component.getInboundWires()) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ if (clazz.isAssignableFrom(interfaze)) {
+ systemAutowireInternal.put(interfaze, wire);
+ return;
+ }
+ }
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface", interfaze.getName());
+ } else {
+ if (autowireInternal.containsKey(interfaze) || component.getInboundWires().size() == 0) {
+ return;
+ }
+ for (InboundWire wire : component.getInboundWires()) {
+ if (interfaze.isAssignableFrom(wire.getServiceContract().getInterfaceClass())) {
+ autowireInternal.put(interfaze, wire);
+ return;
+ }
+ }
+ throw new InvalidAutowireInterface("Matching inbound wire not found for interface", interfaze.getName());
+ }
+ }
+
+ protected void registerAutowire(CompositeComponent component) throws InvalidAutowireInterface {
+ if (component.isSystem()) {
+ // the composite is under the system hierarchy so only register its system services
+ Collection<InboundWire> wires = component.getInboundSystemWires();
+ for (InboundWire wire : wires) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ registerAutowireInternal(clazz, wire, true);
+ }
+
+ } else {
+ // the composite is under the application hierarchy so only register its non-system services
+ Collection<InboundWire> wires = component.getInboundWires();
+ for (InboundWire wire : wires) {
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ registerAutowireInternal(clazz, wire, false);
+ }
+ }
+ }
+
+ protected void registerAutowire(AtomicComponent component) throws InvalidAutowireInterface {
+ for (InboundWire wire : component.getInboundWires()) {
+ registerAutowireInternal(wire.getServiceContract().getInterfaceClass(), component);
+ }
+ }
+
+ protected void registerAutowire(Reference reference) throws InvalidAutowireInterface {
+ // TODO autowire should allow multiple interfaces
+ List<ReferenceBinding> bindings = reference.getReferenceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ registerAutowireInternal(clazz, reference);
+
+
+ }
+
+ protected void registerAutowire(Service service) throws InvalidAutowireInterface {
+ // TODO autowire should allow multiple interfaces
+ List<ServiceBinding> bindings = service.getServiceBindings();
+ if (bindings.size() == 0) {
+ return;
+ }
+ // pick the first binding until autowire allows multiple interfaces
+ InboundWire wire = bindings.get(0).getInboundWire();
+ Class<?> clazz = wire.getServiceContract().getInterfaceClass();
+ registerAutowireExternal(clazz, service);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ContributionProcessorExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ContributionProcessorExtension.java
new file mode 100644
index 0000000000..a732b86184
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ContributionProcessorExtension.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.spi.extension;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ContributionProcessor;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The base class for ContributionProcessor implementations
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+@Service(ContributionProcessor.class)
+public abstract class ContributionProcessorExtension implements ContributionProcessor {
+ /**
+ * The ContributionProcessorRegistry that this processor should register with; usually set by injection. This registry may also be used to process
+ * other sub-artifacts.
+ */
+ protected ContributionProcessorRegistry registry;
+
+ /**
+ * @param registry the registry to set
+ */
+ @Autowire
+ public void setContributionProcessorRegistry(ContributionProcessorRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Initialize the processor. It registers itself to the registry by content type it supports.
+ */
+ @Init
+ public void start() {
+ registry.register(this.getContentType(), this);
+ }
+
+ /**
+ * Destroy the processor. It unregisters itself from the registry.
+ */
+ @Destroy
+ public void stop() {
+ registry.unregister(this.getContentType());
+ }
+
+ /**
+ * Returns the content type that this implementation can handle.
+ *
+ * @return the content type that this implementation can handle
+ */
+ public abstract String getContentType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ExecutionMonitor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ExecutionMonitor.java
new file mode 100644
index 0000000000..fc6e5b7a14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ExecutionMonitor.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.spi.extension;
+
+/**
+ * A monitor used to log events during an invocation
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface ExecutionMonitor {
+
+ /**
+ * Logs an exception thrown during an invocation
+ */
+ void executionError(Throwable e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/GenericBuilderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/GenericBuilderExtension.java
new file mode 100644
index 0000000000..42893682e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/GenericBuilderExtension.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.spi.extension;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.GenericBuilder;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * An extension point for generic builders which can deal with SCDL
+ * extensibility elements
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+@EagerInit
+public abstract class GenericBuilderExtension<S extends SCAObject, M extends ModelObject> implements
+ GenericBuilder<S, M> {
+
+ protected BuilderRegistry builderRegistry;
+
+ @Autowire
+ public void setBuilderRegistry(BuilderRegistry registry) {
+ this.builderRegistry = registry;
+ }
+
+ @Init
+ public void init() {
+ builderRegistry.register(getModelType(), this);
+ }
+
+ protected abstract Class<M> getModelType();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.java
new file mode 100644
index 0000000000..d256ef1fdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/LoaderExtension.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.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.EagerInit;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.StAXElementLoader;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Support class for extending the Loader mechanism.
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class LoaderExtension<T extends ModelObject> implements StAXElementLoader<T> {
+ /**
+ * The LoaderRegistry that this loader should register with; usually set by injection. This registry may also be
+ * used to load sub-elements.
+ */
+ protected LoaderRegistry registry;
+
+ /**
+ * Constructor specifies the registry to register with.
+ *
+ * @param registry the LoaderRegistry this loader should register with
+ */
+ protected LoaderExtension(@Autowire LoaderRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Initialize the loader. The base implementation registers this loader with the registry as a handler for the XML
+ * type returned by {@link #getXMLType()}. Implementations may override this to register the loader as a handler for
+ * multiple XML types.
+ */
+ @Init
+ public void start() {
+ registry.registerLoader(getXMLType(), this);
+ }
+
+ /**
+ * Destroy the loader. The base implementation unregisters the loader from the regsitry based on the type returned
+ * by {@link #getXMLType()}.
+ */
+ @Destroy
+ public void stop() {
+ registry.unregisterLoader(getXMLType(), this);
+ }
+
+ /**
+ * Returns the QName of the element that this implementation handles.
+ *
+ * @return the QName of the element that this implementation handles
+ */
+ public abstract QName getXMLType();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java
new file mode 100644
index 0000000000..1653e87dc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.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.spi.extension;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+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.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * The default implementation of an SCA reference
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ReferenceBindingExtension extends AbstractSCAObject implements ReferenceBinding {
+ protected Reference reference;
+ protected InboundWire inboundWire;
+ protected OutboundWire outboundWire;
+ protected ServiceContract<?> bindingServiceContract;
+
+ protected ReferenceBindingExtension(String name, CompositeComponent parent) {
+ super(name, parent);
+ }
+
+ public Scope getScope() {
+ return Scope.SYSTEM;
+ }
+
+ public void setReference(Reference reference) {
+ this.reference = reference;
+ }
+
+ public void setInboundWire(InboundWire wire) {
+ this.inboundWire = wire;
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ @Override
+ public boolean isSystem() {
+ return reference != null && reference.isSystem();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java
new file mode 100644
index 0000000000..9e4be85406
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.CompositeComponent;
+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.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * The default implementation of an SCA service
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ServiceBindingExtension extends AbstractSCAObject implements ServiceBinding {
+ protected Service service;
+ protected InboundWire inboundWire;
+ protected OutboundWire outboundWire;
+ protected ServiceContract<?> bindingServiceContract;
+
+ public ServiceBindingExtension(String name, CompositeComponent parent) throws CoreRuntimeException {
+ super(name, parent);
+ }
+
+ public Scope getScope() {
+ return Scope.SYSTEM;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public InboundWire getInboundWire() {
+ return inboundWire;
+ }
+
+ public void setInboundWire(InboundWire wire) {
+ inboundWire = wire;
+ }
+
+ public OutboundWire getOutboundWire() {
+ return outboundWire;
+ }
+
+ public void setOutboundWire(OutboundWire outboundWire) {
+ this.outboundWire = outboundWire;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServiceContract<?> getBindingServiceContract() {
+ return bindingServiceContract;
+ }
+
+ @Override
+ public boolean isSystem() {
+ return service != null && service.isSystem();
+ }
+
+ public boolean allowsPassByReference() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
new file mode 100644
index 0000000000..6c502702e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.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.spi.extension;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class SystemAtomicComponentExtension extends AtomicComponentExtension {
+
+ public SystemAtomicComponentExtension(String name,
+ CompositeComponent parent,
+ int initLevel) {
+ super(name, parent, null, null, null, null, initLevel);
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSystem() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
new file mode 100644
index 0000000000..88949646ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.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 org.apache.tuscany.spi.extension;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import org.apache.tuscany.spi.component.WorkContext;
+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;
+
+/**
+ * The default implementation of a TargetInvoker
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TargetInvokerExtension implements TargetInvoker {
+
+ protected InboundWire wire;
+ protected WorkContext workContext;
+ protected ExecutionMonitor monitor;
+ protected boolean cacheable;
+
+ /**
+ * Creates a new invoker
+ *
+ * @param wire the callback wire
+ * @param workContext the work context to use for setting correlation information
+ * @param monitor the event monitor
+ */
+ public TargetInvokerExtension(InboundWire wire, WorkContext workContext, ExecutionMonitor monitor) {
+ this.wire = wire;
+ this.workContext = workContext;
+ this.monitor = monitor;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ try {
+ Object messageId = msg.getMessageId();
+ if (messageId != null) {
+ workContext.setCurrentCorrelationId(messageId);
+ }
+ if (wire != null) {
+ LinkedList<Object> callbackRoutingChain = msg.getCallbackRoutingChain();
+ if (callbackRoutingChain != null) {
+ workContext.setCurrentCallbackRoutingChain(callbackRoutingChain);
+ }
+ }
+ Object resp = invokeTarget(msg.getBody(), msg.getConversationSequence());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setBodyWithFault(e.getCause());
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return isCacheable();
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ // TargetInvoker extends Cloneable so this should not have been thrown
+ throw new AssertionError(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHost.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHost.java
new file mode 100644
index 0000000000..b273ec6729
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHost.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.spi.host;
+
+/**
+ * Interface implemented by host environments that allow for resolution of component implementation resources, e.g.
+ * items bound in a JNDI tree.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceHost {
+
+ /**
+ * Resolve a resource matching the given type
+ *
+ * @param type the type of the resources
+ * @throws ResourceResolutionException if an error is encountered during resolution
+ */
+ <T> T resolveResource(Class<T> type) throws ResourceResolutionException;
+
+ /**
+ * Resolve a resource matching the given type and name
+ *
+ * @param type the type of the resources
+ * @param mappedName the mapped name of the resource
+ * @throws ResourceResolutionException if an error is encountered during resolution
+ */
+ <T> T resolveResource(Class<T> type, String mappedName) throws ResourceResolutionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHostRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHostRegistry.java
new file mode 100644
index 0000000000..b4964cce3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceHostRegistry.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.spi.host;
+
+/**
+ * Implementations manage a registry of resources and resource hosts in the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceHostRegistry {
+ /**
+ * Registers a resource host for the given uri prefix
+ *
+ * @param uri the uri prefix the host resolves resources for
+ * @param host the resource host
+ */
+ void registerResourceHost(String uri, ResourceHost host);
+
+ /**
+ * Removes a resource host registered for the given uri prefix
+ */
+ void unregisterResourceHost(String uri);
+
+ /**
+ * Register a resource by type
+ *
+ * @param type the type of the resource
+ * @param resource the resource
+ */
+ void registerResource(Class<?> type, Object resource);
+
+ /**
+ * Register a resource by type and name
+ *
+ * @param type the type of the resource
+ * @param name the mapped resource name
+ * @param resource the resource
+ */
+ void registerResource(Class<?> type, String name, Object resource);
+
+ /**
+ * Unregister a resource
+ *
+ * @param type the type the resource was registered with
+ * @param name the mapped name the resource was registered with
+ */
+ void unregisterResource(Class<?> type, String name);
+
+ /**
+ * Unregister a resource
+ *
+ * @param type the type the resource was registered with
+ */
+ void unregisterResource(Class<?> type);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceResolutionException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceResolutionException.java
new file mode 100644
index 0000000000..23c18f5115
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ResourceResolutionException.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.spi.host;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceResolutionException extends TuscanyException {
+
+ public ResourceResolutionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.java
new file mode 100644
index 0000000000..37937808d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/host/ServletHost.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.spi.host;
+
+import javax.servlet.Servlet;
+
+/**
+ * Interface implemented by host environments that allow Servlets to be registered.
+ * <p/>
+ * This interface allows an SCA system service to register a servlet to handle inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHost {
+ /**
+ * Register a mapping for an instance of a Servlet. This requests that the servlet container direct all requests to
+ * the designated mapping to the supplied Servlet instance.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ * @param servlet the Servlet that should be invoked
+ */
+ void registerMapping(String mapping, Servlet servlet);
+
+ /**
+ * Unregister a servlet mapping. This directs the servlet contain not to direct any more requests to a previously
+ * registered Servlet.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ * @return the servlet that was registered to the mapping, null if nothing was registered to the mapping
+ */
+ Servlet unregisterMapping(String mapping);
+
+ /**
+ * Check to see if a mapping exists.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ * @return true if mapping is registered, false otherwise
+ */
+ boolean isMappingRegistered(String mapping);
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.java
new file mode 100644
index 0000000000..5a0bd3bb5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ElementInfo.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.spi.idl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema elements
+ */
+public class ElementInfo {
+ private QName name;
+ private TypeInfo type;
+
+ /**
+ * @param name
+ * @param type
+ */
+ public ElementInfo(QName name, TypeInfo type) {
+ super();
+ this.name = name;
+ this.type = type;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the type
+ */
+ public TypeInfo getType() {
+ return type;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidConversationalOperationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidConversationalOperationException.java
new file mode 100644
index 0000000000..e2b4acec24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidConversationalOperationException.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.spi.idl;
+
+import java.lang.reflect.Method;
+
+/**
+ * Denotes an invalid conversational interface definition
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationalOperationException extends InvalidServiceContractException {
+ private final Method operation;
+
+ public InvalidConversationalOperationException(String message, String identifier, Method operation) {
+ super(message, identifier);
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.java
new file mode 100644
index 0000000000..e977592df0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/InvalidServiceContractException.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.spi.idl;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class InvalidServiceContractException extends TuscanyException {
+
+ public InvalidServiceContractException() {
+ }
+
+ public InvalidServiceContractException(String message) {
+ super(message);
+ }
+
+ protected InvalidServiceContractException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvalidServiceContractException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidServiceContractException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public InvalidServiceContractException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.java
new file mode 100644
index 0000000000..b1d4cb4e7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/OverloadedOperationException.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.spi.idl;
+
+import java.lang.reflect.Method;
+
+/**
+ * Exception thrown to indicate that a service contract specification contains an overloaded method.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OverloadedOperationException extends InvalidServiceContractException {
+ private static final long serialVersionUID = -4658711318608885638L;
+ private final Method operation;
+
+ public OverloadedOperationException(Method operation) {
+ super(null, operation.getDeclaringClass().getName());
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ServiceFaultException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ServiceFaultException.java
new file mode 100644
index 0000000000..1c8a8c81e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/ServiceFaultException.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.spi.idl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * The generic java exception to wrap service faults
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceFaultException extends TuscanyException {
+ private static final long serialVersionUID = -8002583655240625792L;
+ private Object faultInfo;
+ private QName logical;
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public ServiceFaultException(String message, Object faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ * @param cause
+ */
+ public ServiceFaultException(String message, Object faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return the faultInfo
+ */
+ public Object getFaultInfo() {
+ return faultInfo;
+ }
+
+ public QName getLogical() {
+ return logical;
+ }
+
+ public void setLogical(QName logical) {
+ this.logical = logical;
+ }
+
+ public boolean isMatchingType(Object type) {
+ if (logical == null)
+ return false;
+
+ if ((type instanceof QName) && logical.equals(type)) {
+ return true;
+ }
+ if (type instanceof XMLType && logical.equals(((XMLType)type).getElementName()))
+ return true;
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.java
new file mode 100644
index 0000000000..9bb107812c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/TypeInfo.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.spi.idl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema types
+ */
+public class TypeInfo {
+ private QName name;
+
+ private boolean isSimpleType;
+
+ private TypeInfo baseType;
+
+ /**
+ * @param name
+ * @param isSimpleType
+ */
+ public TypeInfo(QName name, boolean isSimpleType, TypeInfo baseType) {
+ super();
+ this.name = name;
+ this.isSimpleType = isSimpleType;
+ this.baseType = baseType;
+ }
+
+ /**
+ * @return the isSimpleType
+ */
+ public boolean isSimpleType() {
+ return isSimpleType;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the baseType
+ */
+ public TypeInfo getBaseType() {
+ return baseType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/XMLType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/XMLType.java
new file mode 100644
index 0000000000..1d626516b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/XMLType.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.spi.idl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The metadata for an XML element or type
+ */
+public class XMLType {
+ public static final XMLType UNKNOWN = new XMLType(null, null);
+ private QName element;
+ private QName type;
+
+ /**
+ * @param element
+ */
+ public XMLType(ElementInfo element) {
+ super();
+ this.element = element.getQName();
+ if (element.getType() != null) {
+ this.type = element.getType().getQName();
+ }
+ }
+
+ /**
+ * @param element
+ */
+ public XMLType(TypeInfo type) {
+ this.element = null;
+ this.type = type.getQName();
+ }
+
+ public XMLType(QName element, QName type) {
+ this.element = element;
+ this.type = type;
+ }
+
+ /**
+ * @return the type
+ */
+ public QName getTypeName() {
+ return type;
+ }
+
+ public boolean isElement() {
+ return element != null;
+ }
+
+ public QName getElementName() {
+ return element;
+ }
+
+ public static XMLType getType(QName type) {
+ return new XMLType(null, type);
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((element == null) ? 0 : element.hashCode());
+ result = PRIME * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final XMLType other = (XMLType)obj;
+ if (element == null) {
+ if (other.element != null) {
+ return false;
+ }
+ } else if (!element.equals(other.element)) {
+ return false;
+ }
+ if (type == null) {
+ if (other.type != null) {
+ return false;
+ }
+ } else if (!type.equals(other.type)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Element: " + element + " Type: " + type;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.java
new file mode 100644
index 0000000000..9701b08df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/InterfaceJavaIntrospector.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.spi.idl.java;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * Processor for creating JavaServiceContract definitions from Java Classes.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceJavaIntrospector {
+
+ /**
+ * Introspect a Java interface and return a service contract definition.
+ *
+ * @param type the interface to inspect
+ * @return a JavaServiceContract corresponding to the Java interface
+ */
+ <I> JavaServiceContract introspect(Class<I> type) throws InvalidServiceContractException;
+
+ /**
+ * Introspect a Java interface and return a service contract definition.
+ *
+ * @param type the interface to inspect
+ * @param deep Indicate if deep introspection is required
+ * @return a JavaServiceContract corresponding to the Java interface
+ */
+ <I> JavaServiceContract introspect(Class<I> type, boolean deep) throws InvalidServiceContractException;
+
+ /**
+ * Introspect a Java interface and return a service contract definition.
+ *
+ * @param type the interface to inspect
+ * @param callback the callback interface to inspec
+ * @param deep Indicate if deep introspection is required
+ * @return a JavaServiceContract corresponding to the Java interface
+ */
+ <I, C> JavaServiceContract introspect(Class<I> type, Class<C> callback, boolean deep)
+ throws InvalidServiceContractException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java
new file mode 100644
index 0000000000..17fcd8d4a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.idl.java;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Contains methods for mapping between an operation in a {@link org.apache.tuscany.spi.model.ServiceContract} and a
+ * method defined by a Java interface
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaIDLUtils {
+
+ private JavaIDLUtils() {
+ }
+
+ /**
+ * Searches an array of methods for a match against the given operation
+ *
+ * @param operation the operation to match
+ * @param methods the methods to match against
+ * @return a matching method or null
+ */
+ public static Method findMethod(Operation<?> operation, Method[] methods) {
+ for (Method method : methods) {
+ if (match(operation, method)) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Searches a collection of operations for a match against the given method
+ *
+ * @param method the method to match
+ * @param operations the operations to match against
+ * @return a matching operation or null
+ */
+ public static Operation findOperation(Method method, Collection<Operation<?>> operations) {
+ for (Operation<?> operation : operations) {
+ if (match(operation, method)) {
+ return operation;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Determines if the given operation matches the given method
+ *
+ * @return true if the operation matches, false if does not
+ */
+ private static <T> boolean match(Operation<T> operation, Method method) {
+ // TODO: TUSCANY-1111, comparing different IDLs fail so use simple name
+ // matching
+ ServiceContract<T> contract = operation.getServiceContract();
+ if (contract != null && contract.isRemotable()) {
+ // No method overloading for remotable interfaces
+ return operation.getName().equals(method.getName());
+ }
+ Class<?>[] params = method.getParameterTypes();
+ DataType<List<DataType<T>>> inputType = operation.getInputType();
+ List<DataType<T>> types = inputType.getLogical();
+ boolean found = true;
+ if (types.size() == params.length && method.getName().equals(operation.getName())) {
+ for (int i = 0; i < params.length; i++) {
+ Class<?> clazz = params[i];
+ if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
+ found = false;
+ }
+ }
+ } else {
+ found = false;
+ }
+ return found;
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java
new file mode 100644
index 0000000000..afe98f0773
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.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.spi.idl.java;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * Implementations introspect metadata on a Java interface, populating the
+ * corresponding {@link JavaServiceContract}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceProcessor {
+
+ void visitInterface(Class<?> clazz, Class<?> callbackClass, JavaServiceContract contract)
+ throws InvalidServiceContractException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.java
new file mode 100644
index 0000000000..950ce1858c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorExtension.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.spi.idl.java;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+/**
+ * A convenience class for <code>JavaInterfaceProcessor</code> extensions that performs autowiring
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class JavaInterfaceProcessorExtension implements JavaInterfaceProcessor {
+
+ protected JavaInterfaceProcessorRegistry registry;
+
+ @Autowire
+ public void setRegistry(JavaInterfaceProcessorRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.registerProcessor(this);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.java
new file mode 100644
index 0000000000..38c64e6f88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessorRegistry.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.spi.idl.java;
+
+/**
+ * A registry of {@link JavaInterfaceProcessor}s. Interface processors update a service contract definition based on a
+ * Java interface
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceProcessorRegistry extends InterfaceJavaIntrospector {
+
+ /**
+ * Registers the given processor
+ */
+ void registerProcessor(JavaInterfaceProcessor processor);
+
+ /**
+ * Deregisters the given processor
+ */
+ void unregisterProcessor(JavaInterfaceProcessor processor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.java
new file mode 100644
index 0000000000..ee29846e26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaServiceContract.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.spi.idl.java;
+
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Represents a service contract specified using a Java interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaServiceContract extends ServiceContract<Type> {
+
+ public JavaServiceContract() {
+ }
+
+ public JavaServiceContract(Class<?> interfaceClass) {
+ super(interfaceClass);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java
new file mode 100644
index 0000000000..b0682bc778
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.implementation.java;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * Base class for ImplementationProcessors that handle annotations that add Properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractPropertyProcessor<A extends Annotation> extends ImplementationProcessorExtension {
+ private final Class<A> annotationClass;
+ private ImplementationProcessorService service;
+
+ protected AbstractPropertyProcessor(Class<A> annotationClass, ImplementationProcessorService service) {
+ this.annotationClass = annotationClass;
+ this.service = service;
+ }
+
+ public void visitMethod(CompositeComponent parent,
+ Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ A annotation = method.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ if (!Void.TYPE.equals(method.getReturnType())) {
+ throw new IllegalPropertyException("Method does not have void return type", method.toString());
+ }
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length != 1) {
+ throw new IllegalPropertyException("Method must have a single parameter", method.toString());
+ }
+ Class<?> javaType = paramTypes[0];
+
+ String name = getName(annotation);
+ if (name == null || name.length() == 0) {
+ name = method.getName();
+ if (name.startsWith("set")) {
+ name = toPropertyName(method.getName());
+ }
+ }
+
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ if (properties.containsKey(name)) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ Class<?> baseType = getBaseType(javaType, method.getGenericParameterTypes()[0]);
+ JavaMappedProperty<?> property = createProperty(name, baseType, method);
+ if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
+ property.setMany(true);
+ }
+
+ //add databinding available as annotations, as extensions
+ DataType propertyDataBinding = method.getAnnotation(DataType.class);
+ if (propertyDataBinding != null) {
+ property.getExtensions().put(DataBinding.class.getName(), propertyDataBinding.name());
+ }
+ initProperty(property, annotation, parent, context);
+ properties.put(name, property);
+ }
+
+ public void visitField(CompositeComponent parent,
+ Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ A annotation = field.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ Class<?> javaType = field.getType();
+
+ String name = getName(annotation);
+ if (name == null || name.length() == 0) {
+ name = field.getName();
+ }
+
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ if (properties.containsKey(name)) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ Class<?> baseType = getBaseType(javaType, field.getGenericType());
+ JavaMappedProperty<?> property = createProperty(name, baseType, field);
+ if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
+ property.setMany(true);
+ }
+
+ //add databinding available as annotations, as extensions
+ DataType propertyDataBinding = field.getAnnotation(DataType.class);
+ if (propertyDataBinding != null) {
+ property.getExtensions().put(DataBinding.class.getName(), propertyDataBinding.name());
+ }
+
+ initProperty(property, annotation, parent, context);
+ properties.put(name, property);
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent, Constructor<T> constructor,
+ PojoComponentType<JavaMappedService,
+ JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ Class[] params = constructor.getParameterTypes();
+ Map<String, JavaMappedProperty<?>> properties = type.getProperties();
+ Annotation[][] annotations = constructor.getParameterAnnotations();
+
+ for (int i = 0; i < params.length; i++) {
+ Class<?> param = params[i];
+ Annotation[] paramAnnotations = annotations[i];
+ JavaMappedProperty<?> property = null;
+ DataType propertyDataBinding = null;
+ A monitorAnnot = null;
+ String name = null;
+ for (Annotation annotation : paramAnnotations) {
+ if (annotation.annotationType().equals(annotationClass)) {
+ if (definition == null) {
+ definition = new ConstructorDefinition<T>(constructor);
+ type.setConstructorDefinition(definition);
+ }
+ monitorAnnot = annotationClass.cast(annotation);
+ name = getName(monitorAnnot);
+ if (name == null || name.length() == 0) {
+ name = param.getName();
+ }
+
+ Class<?> baseType = getBaseType(param, constructor.getGenericParameterTypes()[i]);
+ //JavaMappedProperty<?> property = createProperty(name, baseType, constructor);
+ property = createProperty(name, baseType, constructor);
+ if (param.isArray() || Collection.class.isAssignableFrom(param)) {
+ property.setMany(true);
+ }
+ } else if (annotation.annotationType().equals(DataType.class)) {
+ //if there is databinding information capture it
+ propertyDataBinding = DataType.class.cast(annotation);
+ }
+ }
+ //if there has been a property annotation then a property would have been created
+ if (property != null) {
+ initProperty(property, monitorAnnot, parent, context);
+ properties.put(name, property);
+ service.addName(definition.getInjectionNames(), i, name);
+ if (propertyDataBinding != null) {
+ property.getExtensions().put(DataBinding.class.getName(), propertyDataBinding.name());
+ }
+ }
+ }
+ }
+
+ protected abstract String getName(A annotation);
+
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ A annotation,
+ CompositeComponent parent,
+ DeploymentContext context) throws ProcessingException {
+ }
+
+ protected <T> JavaMappedProperty<T> createProperty(String name, Class<T> javaType, Member member)
+ throws ProcessingException {
+ return new JavaMappedProperty<T>(name, null, javaType, member);
+ }
+
+
+ public static String toPropertyName(String name) {
+ if (!name.startsWith("set")) {
+ return name;
+ }
+ return Character.toLowerCase(name.charAt(3)) + name.substring(4);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.java
new file mode 100644
index 0000000000..94c185966f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ConstructorDefinition.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.spi.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Hold injection information for the constructor used to instantiate a component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstructorDefinition<T> {
+
+ private Constructor<T> constructor;
+ private List<String> injectionNames;
+
+ public ConstructorDefinition(Constructor<T> constructor) {
+ this.constructor = constructor;
+ injectionNames = new ArrayList<String>();
+ }
+
+ public Constructor<T> getConstructor() {
+ return constructor;
+ }
+
+ public List<String> getInjectionNames() {
+ return injectionNames;
+ }
+
+ public void setInjectionNames(List<String> injectionNames) {
+ this.injectionNames = injectionNames;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.java
new file mode 100644
index 0000000000..87c4074fe7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/DuplicatePropertyException.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.spi.implementation.java;
+
+/**
+ * Thrown when an implementation has more than one property injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicatePropertyException extends ProcessingException {
+
+ public DuplicatePropertyException(String message) {
+ super(message);
+ }
+
+ public DuplicatePropertyException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.java
new file mode 100644
index 0000000000..f251f60630
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IllegalPropertyException.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.spi.implementation.java;
+
+/**
+ * Denotes an illegal property definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalPropertyException extends ProcessingException {
+
+ public IllegalPropertyException(String message) {
+ super(message);
+ }
+
+
+ public IllegalPropertyException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java
new file mode 100644
index 0000000000..fb9beca53c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessor.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * Implementations process class-level metadata, typically parsing annotations and updating the corresponding
+ * <code>ComponentType</code>. A processor may, for example, create a {@link JavaMappedProperty} which is responsible
+ * for injecting a complex type on a component implementation instance when it is instantiated.
+ * <p/>
+ * Processors will receive callbacks as the implementation class is walked while evalauting an assembly. It is the
+ * responsibility of the parser to determine whether to perform an action during the callback.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProcessor {
+
+ /**
+ * A callback received when the component implementation class is first loaded
+ *
+ * @param parent the parent composite
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ <T> void visitClass(CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException;
+
+ /**
+ * A callback received as the component implementation class hierarchy is evaluated
+ *
+ * @param parent the parent composite
+ * @param clazz the superclass in the component implmentation's class hierarchy
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ <T> void visitSuperClass(CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException;
+
+ /**
+ * A callback received as the component implementation's public and protected methods are evaluated
+ *
+ * @param parent the parent composite
+ * @param method the current public or protected method being evaluated
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ void visitMethod(CompositeComponent parent,
+ Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException;
+
+ /**
+ * A callback received as the component implementation's constructor used for instantiation by the runtime is
+ * evaluated. If an implementation contains more than one constructor, the constructor passed to the callback will
+ * be chosen according to the algorithm described in the SCA Java Client and Implementation Model Specification.
+ *
+ * @param parent the parent composite
+ * @param constructor the constructor used for instantiating component implementation instances
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ <T> void visitConstructor(CompositeComponent parent,
+ Constructor<T> constructor,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException;
+
+ /**
+ * A callback received as the component implementation's public and protected fields are evaluated
+ *
+ * @param parent the parent composite
+ * @param field the current public or protected field being evaluated
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ void visitField(CompositeComponent parent,
+ Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException;
+
+ /**
+ * The final callback received when all other callbacks during evaluation of the component implementation have been
+ * issued
+ *
+ * @param parent the parent composite
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the implementation class
+ * @param context the current deployment context
+ * @throws ProcessingException if an error is encountered while processing metadata
+ */
+ <T> void visitEnd(CompositeComponent parent,
+ Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java
new file mode 100644
index 0000000000..fc1b6cd4fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorExtension.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * A convenience class for annotation processors which alleviates the need to implement unused callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class ImplementationProcessorExtension implements ImplementationProcessor {
+ private IntrospectionRegistry registry;
+
+ @Autowire
+ public void setRegistry(IntrospectionRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.registerProcessor(this);
+ }
+
+ @Destroy
+ public void destroy() {
+ registry.unregisterProcessor(this);
+ }
+
+ public <T> void visitClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ }
+
+ public <T> void visitSuperClass(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService,
+ JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ }
+
+ public void visitMethod(CompositeComponent parent, Method method,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ }
+
+ public <T> void visitConstructor(CompositeComponent parent, Constructor<T> constructor,
+ PojoComponentType<JavaMappedService,
+ JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException {
+ }
+
+ public void visitField(CompositeComponent parent, Field field,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+ }
+
+ public <T> void visitEnd(CompositeComponent parent, Class<T> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context) throws ProcessingException {
+
+ }
+
+ protected static Class<?> getBaseType(Class<?> cls, Type genericType) {
+ if (cls.isArray()) {
+ return cls.getComponentType();
+ } else if (Collection.class.isAssignableFrom(cls)) {
+ if (genericType == cls) {
+ return Object.class;
+ } else {
+ ParameterizedType parameterizedType = (ParameterizedType)genericType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof Class) {
+ return (Class<?>)baseType;
+ } else if (baseType instanceof ParameterizedType) {
+ return (Class<?>)((ParameterizedType)baseType).getRawType();
+ } else {
+ return null;
+ }
+ }
+ } else {
+ return cls;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.java
new file mode 100644
index 0000000000..d37a39011f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ImplementationProcessorService.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.spi.implementation.java;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Provides utility methods for Java implementation processing
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProcessorService {
+
+ /**
+ * Introspects the given interface to produce a mapped service
+ */
+ JavaMappedService createService(Class<?> interfaze) throws InvalidServiceContractException;
+
+ JavaMappedReference createReference(String name, Member member, Class<?> paramType) throws ProcessingException;
+
+ /**
+ * Processes the callback contract for a given interface type
+ *
+ * @param interfaze the interface type to examine
+ * @param contract the service contract the callback is associated wth
+ * @throws InvalidServiceContractException
+ *
+ */
+ void processCallback(Class<?> interfaze, ServiceContract<?> contract) throws InvalidServiceContractException;
+
+ /**
+ * Determines if all the members of a collection have unique types
+ *
+ * @param collection the collection to analyze
+ * @return true if the types are unique
+ */
+ boolean areUnique(Class[] collection);
+
+ /**
+ * Inserts a name at the specified position, paddiling the list if its size is less than the position
+ */
+ void addName(List<String> names, int pos, String name);
+
+ /**
+ * Processes a constructor parameter by introspecting its annotations
+ *
+ * @param param the parameter to process
+ * @param genericParam the generic type of the parameter
+ * @param paramAnnotations the parameter annotations
+ * @param constructorNames the array of constructorNames specified by
+ * @param pos the declaration position of the constructor parameter
+ * @param type the component type associated with implementation being reflected
+ * @param injectionNames the list of parameter constructorNames specified on parameter annotations
+ * @throws ProcessingException
+ */
+ boolean processParam(Class<?> param,
+ Type genericParam,
+ Annotation[] paramAnnotations,
+ String[] constructorNames,
+ int pos,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ List<String> injectionNames) throws ProcessingException;
+
+ /**
+ * Returns true if {@link @Autowire}, {@link @Property}, or {@link @Reference} are present in the given array
+ */
+ boolean injectionAnnotationsPresent(Annotation[][] annots);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.java
new file mode 100644
index 0000000000..a6122a6ff1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/IntrospectionRegistry.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.spi.implementation.java;
+
+/**
+ * A system service which tracks {@link ImplementationProcessor}s
+ *
+ * @version $Rev$ $Date$
+ */
+public interface IntrospectionRegistry extends Introspector {
+
+ /**
+ * Registers the given processor and makes it available during assembly evaluation (i.e. build)
+ */
+ void registerProcessor(ImplementationProcessor processor);
+
+ /**
+ * Deregisters the given processor
+ */
+ void unregisterProcessor(ImplementationProcessor processor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.java
new file mode 100644
index 0000000000..66abc1f686
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Introspector.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.spi.implementation.java;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * Implementations are responsible for walking a component implementation class, adding additional component type
+ * information as appropriate
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Introspector {
+
+ /**
+ * Walks the given component implementation class
+ *
+ * @param parent the parent composite
+ * @param clazz the component implementation class
+ * @param type the component type associated with the implementation class
+ * @return the updated component type
+ * @throws ProcessingException if an error is encountered evaluating the implementation class
+ */
+ PojoComponentType introspect(CompositeComponent parent,
+ Class<?> clazz,
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type,
+ DeploymentContext context)
+ throws ProcessingException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.java
new file mode 100644
index 0000000000..34ac8f53f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedComponentType.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.spi.implementation.java;
+
+import org.apache.tuscany.spi.model.ComponentType;
+
+/**
+ * A specialized component type definition whose services, references and properties can be mapped to the Java
+ * programming model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaMappedComponentType<
+ S extends JavaMappedService,
+ R extends JavaMappedReference,
+ P extends JavaMappedProperty<?>
+ > extends ComponentType<S, R, P> {
+
+ private Class<?> implClass;
+
+ public JavaMappedComponentType() {
+ }
+
+ public JavaMappedComponentType(Class<?> implClass) {
+ this.implClass = implClass;
+ }
+
+ /**
+ * Returns the implementation class associated with this component type.
+ *
+ * @return the implementation class associated with this component type
+ */
+ public Class<?> getImplClass() {
+ return implClass;
+ }
+
+ /**
+ * Sets the implementation class associated with this component type.
+ *
+ * @param implClass the implementation class associated with this component type
+ */
+ public void setImplClass(Class<?> implClass) {
+ this.implClass = implClass;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.java
new file mode 100644
index 0000000000..6d1715a035
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedProperty.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.spi.implementation.java;
+
+import java.lang.reflect.Member;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Property;
+
+/**
+ * A Property definition that is mapped to a specific location in the implementation class. This location will typically
+ * be used to inject property values.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaMappedProperty<T> extends Property<T> {
+ private Member member;
+
+ public JavaMappedProperty() {
+ }
+
+ public JavaMappedProperty(String name, QName xmlType, Class<T> javaType) {
+ super(name, xmlType, javaType);
+ }
+
+ public JavaMappedProperty(String name, QName xmlType, Class<T> javaType, Member member) {
+ super(name, xmlType, javaType);
+ this.member = member;
+ }
+
+ /**
+ * Returns the Member that this property is mapped to.
+ *
+ * @return the Member that this property is mapped to
+ */
+ public Member getMember() {
+ return member;
+ }
+
+ /**
+ * Sets the Member that this property is mapped to
+ *
+ * @param member the Member that this property is mapped to
+ */
+ public void setMember(Member member) {
+ this.member = member;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java
new file mode 100644
index 0000000000..edcbf9a281
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.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.spi.implementation.java;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * A ReferenceDefinition definition that is mapped to a specific location in the implementation class. This location
+ * will typically be used to inject reference values.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaMappedReference extends ComponentTypeReferenceDefinition {
+ private Member member;
+
+ public JavaMappedReference() {
+ }
+
+ public JavaMappedReference(String name, ServiceContract serviceContract, Member member) {
+ super(name, serviceContract);
+ this.member = member;
+ }
+
+ /**
+ * Returns the Member that this reference is mapped to.
+ *
+ * @return the Member that this reference is mapped to
+ */
+ public Member getMember() {
+ return member;
+ }
+
+ /**
+ * Sets the Member that this reference is mapped to
+ *
+ * @param member the Member that this reference is mapped to
+ */
+ public void setMember(Member member) {
+ this.member = member;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java
new file mode 100644
index 0000000000..ee5e0bb2a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.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.spi.implementation.java;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * A ServiceDefinition definition that is mapped to a Java interface. The mapped interface is not required to be the
+ * same as the interface specified in the service contract. This is to allow the service contract to be specified using
+ * different interface definition languages or, in the case were the IDL is Java, to allow the service definition to be
+ * loaded from a different classloader.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaMappedService extends ServiceDefinition {
+ private Class<?> serviceInterface;
+ private Member callbackMember;
+
+ public JavaMappedService() {
+ }
+
+ public JavaMappedService(Class<?> serviceInterface) {
+ this.serviceInterface = serviceInterface;
+ }
+
+ public JavaMappedService(String name, ServiceContract contract, boolean remotable) {
+ super(name, contract, remotable);
+ }
+
+ public JavaMappedService(String name,
+ ServiceContract contract,
+ boolean remotable,
+ String callbackRefName,
+ Member callbackMember) {
+ super(name, contract, remotable, callbackRefName);
+ this.callbackMember = callbackMember;
+ }
+
+ public JavaMappedService(String name, ServiceContract contract, Class<?> serviceInterface, boolean remotable) {
+ super(name, contract, remotable);
+ this.serviceInterface = serviceInterface;
+ }
+
+ /**
+ * Returns the Java interface for this service. This may be different from the interface that defines the service
+ * contract.
+ *
+ * @return the Java interface for this service
+ */
+ public Class<?> getServiceInterface() {
+ return serviceInterface;
+ }
+
+ /**
+ * Sets the Java interface for this service. This may be different from the interface used to define the service
+ * contract.
+ *
+ * @param serviceInterface the Java interface for this service
+ */
+ public void setServiceInterface(Class<?> serviceInterface) {
+ this.serviceInterface = serviceInterface;
+ }
+
+ public Member getCallbackMember() {
+ return callbackMember;
+ }
+
+ public void setCallbackMember(Member callbackMember) {
+ this.callbackMember = callbackMember;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
new file mode 100644
index 0000000000..2c0ff57b7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.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.spi.implementation.java;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ComponentTypeReferenceDefinition;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * A component type specialization for POJO implementations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class PojoComponentType<S extends ServiceDefinition, R extends ComponentTypeReferenceDefinition, P extends Property<?>>
+ extends ComponentType<S, R, P> {
+ private boolean allowsPassByReference;
+ private ConstructorDefinition<?> constructorDefinition;
+ private Method initMethod;
+ private Method destroyMethod;
+ private final Map<String, Resource> resources = new HashMap<String, Resource>();
+ private Member conversationIDMember;
+ private List<String> passByReferenceMethods = new ArrayList<String>();
+
+ /**
+ * Returns the constructor used to instantiate implementation instances
+ */
+ public ConstructorDefinition<?> getConstructorDefinition() {
+ return constructorDefinition;
+ }
+
+ /**
+ * Sets the constructor used to instantiate implementation instances
+ */
+ public void setConstructorDefinition(ConstructorDefinition<?> definition) {
+ this.constructorDefinition = definition;
+ }
+
+ /**
+ * Returns the component initializer method
+ */
+ public Method getInitMethod() {
+ return initMethod;
+ }
+
+ /**
+ * Sets the component initializer method
+ */
+ public void setInitMethod(Method initMethod) {
+ this.initMethod = initMethod;
+ }
+
+ /**
+ * Returns the component destructor method
+ */
+ public Method getDestroyMethod() {
+ return destroyMethod;
+ }
+
+ /**
+ * Sets the component destructor method
+ */
+ public void setDestroyMethod(Method destroyMethod) {
+ this.destroyMethod = destroyMethod;
+ }
+
+ public Map<String, Resource> getResources() {
+ return resources;
+ }
+
+ public void add(Resource resource) {
+ resources.put(resource.getName(), resource);
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+ public Member getConversationIDMember() {
+ return this.conversationIDMember;
+ }
+
+ public void setConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember = conversationIDMember;
+ }
+
+ public List<String> getPassByReferenceMethods() {
+ return passByReferenceMethods;
+ }
+
+ public void setPassByReferenceMethods(List<String> passByReferenceMethods) {
+ this.passByReferenceMethods = passByReferenceMethods;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.java
new file mode 100644
index 0000000000..40fd1dfd15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/ProcessingException.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.spi.implementation.java;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.spi.loader.LoaderException;
+
+/**
+ * Denotes a problem processing annotations on a POJO implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessingException extends LoaderException {
+ private Member member;
+
+ public ProcessingException() {
+ }
+
+ public ProcessingException(String message) {
+ super(message);
+ }
+
+ public ProcessingException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ProcessingException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ProcessingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ProcessingException(Throwable cause) {
+ super(cause);
+ }
+
+
+ public Member getMemberName() {
+ return member;
+ }
+
+ public void setMember(Member member) {
+ this.member = member;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Resource.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Resource.java
new file mode 100644
index 0000000000..5df4c3716d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/Resource.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.implementation.java;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * A resource dependency declared by a Java component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class Resource {
+
+ private String name;
+ private String mappedName;
+ private boolean optional;
+ private Member member;
+ private Class<?> type;
+ private ObjectFactory<?> objectFactory;
+
+ /**
+ * The name of the resource
+ *
+ * @return the name of the resource
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the resource
+ *
+ * @param name the name of the resource
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the URI of the resource
+ *
+ * @return the URI of the resource
+ */
+ public String getMappedName() {
+ return mappedName;
+ }
+
+ /**
+ * Sets the resource URI
+ */
+ public void setMappedName(String mappedName) {
+ this.mappedName = mappedName;
+ }
+
+ /**
+ * If true, the resource is optional
+ *
+ * @return true if the resource is optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * Sets whether the resource is optional
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ /**
+ * Returns the Member that this resource is mapped to.
+ *
+ * @return the Member that this resource is mapped to
+ */
+ public Member getMember() {
+ return member;
+ }
+
+ /**
+ * Sets the Member that this resource is mapped to
+ *
+ * @param member the Member that this resource is mapped to
+ */
+ public void setMember(Member member) {
+ this.member = member;
+ }
+
+ /**
+ * Returns the resource type
+ *
+ * @return the resource type
+ */
+ public Class<?> getType() {
+ return type;
+ }
+
+ /**
+ * Sets the resource type
+ */
+ public void setType(Class<?> type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns the obeject factory
+ *
+ * @return the object factory
+ */
+ public ObjectFactory<?> getObjectFactory() {
+ return objectFactory;
+ }
+
+ /**
+ * Sets the object factory
+ */
+ public void setObjectFactory(ObjectFactory<?> objectFactory) {
+ this.objectFactory = objectFactory;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.java
new file mode 100644
index 0000000000..8ad01d8197
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ComponentTypeLoader.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.spi.loader;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.model.Implementation;
+
+/**
+ * Loader that will load the ComponentType definition for the supplied implementation. The actual mechanism used to load
+ * that definition is determined by the Client and Implementation Specification for the implementaion type. In some
+ * cases the definition may be contained in a XML file related to the implementation artifact in some well defined
+ * manner; other implementations may obtain this information from introspection of the artifact itself (for example, by
+ * examining Java annotations).
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentTypeLoader<I extends Implementation> {
+ /**
+ * Load the component type definition for the supplied implementation.
+ *
+ * @param parent the parent composite
+ * @param implementation the implementation whose component type information should be loaded
+ * @param deploymentContext the current deployment context
+ * @throws LoaderException if there was a problem loading the configuration type
+ */
+ void load(CompositeComponent parent, I implementation, DeploymentContext deploymentContext)
+ throws LoaderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.java
new file mode 100644
index 0000000000..34212a164b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/DuplicateReferenceNameException.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.spi.loader;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes a duplicate reference name
+ *
+ * @version $Rev: 487877 $ $Date: 2006-12-17 02:02:16 +0530 (Sun, 17 Dec 2006) $
+ */
+public class DuplicateReferenceNameException extends LoaderException {
+ public static final String COMPOSITE = "Composite";
+ public static final String COMPONENT_TYPE = "ComponentType";
+ public static final String MESSAGE = "Duplicat reference name ";
+
+ private static final long serialVersionUID = -9127740669182714792L;
+ private String duplicateName;
+ private String container;
+ private String containerName;
+
+ public DuplicateReferenceNameException(String dupName, String container, String containerName) {
+ super(MESSAGE, (String) null);
+ this.duplicateName = dupName;
+ this.container = container;
+ this.containerName = containerName;
+ }
+
+ public String getMessage() {
+ return MESSAGE + duplicateName + " in " + containerName + " " + container;
+ }
+
+ public String getContainer() {
+ return container;
+ }
+
+
+ public void setContainer(String container) {
+ this.container = container;
+ }
+
+
+ public String getContainerName() {
+ return containerName;
+ }
+
+
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+
+ public String getDuplicateName() {
+ return duplicateName;
+ }
+
+
+ public void setDuplicateName(String duplicateName) {
+ this.duplicateName = duplicateName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.java
new file mode 100644
index 0000000000..caa4ffdc81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IncompatibleOverridingServiceContractException.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.spi.loader;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes imcompatible service contracts for a wire
+ *
+ * @version $Rev: 487877 $ $Date: 2006-12-17 02:02:16 +0530 (Sun, 17 Dec 2006) $
+ */
+public class IncompatibleOverridingServiceContractException extends LoaderException {
+ private static final long serialVersionUID = 5127478601823295587L;
+ private final ServiceContract<?> source;
+ private final ServiceContract<?> target;
+ private final Operation<?> sourceOperation;
+ private final Operation<?> targetOperation;
+
+ public IncompatibleOverridingServiceContractException(String message, ServiceContract<?> source, ServiceContract<?> target) {
+ super(message, (String) null);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = null;
+ this.targetOperation = null;
+ }
+
+
+ public IncompatibleOverridingServiceContractException(String message,
+ ServiceContract<?> source,
+ ServiceContract<?> target,
+ Operation<?> sourceOperation, Operation<?> targetOperation) {
+ super(message, (String) null);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ }
+
+ public ServiceContract<?> getTarget() {
+ return target;
+ }
+
+ public ServiceContract<?> getSource() {
+ return source;
+ }
+
+ public Operation<?> getSourceOperation() {
+ return sourceOperation;
+ }
+
+ public Operation<?> getTargetOperation() {
+ return targetOperation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidConfigurationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidConfigurationException.java
new file mode 100644
index 0000000000..1c7f3e073d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidConfigurationException.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.spi.loader;
+
+/**
+ * Denotes an invalid configuration artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConfigurationException extends LoaderException {
+
+ public InvalidConfigurationException(String message) {
+ super(message);
+ }
+
+ public InvalidConfigurationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.java
new file mode 100644
index 0000000000..0a83bc2815
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidPromotedReferenceException.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.spi.loader;
+
+/**
+ * Used when a reference promoted by a composite is not found in any of the components defined within
+ * the composite
+ */
+public class InvalidPromotedReferenceException extends LoaderException {
+ private static final long serialVersionUID = -2056138384524620064L;
+
+ public InvalidPromotedReferenceException(String message) {
+ super(message);
+ }
+
+ public InvalidPromotedReferenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvalidPromotedReferenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java
new file mode 100644
index 0000000000..40ae50bfe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidReferenceException extends LoaderException {
+ private static final long serialVersionUID = -4346666572527197558L;
+
+ public InvalidReferenceException(String message) {
+ super(message);
+ }
+
+ public InvalidReferenceException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvalidReferenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidServiceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidServiceException.java
new file mode 100644
index 0000000000..1717cae0c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidServiceException.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.spi.loader;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-12 06:47:56 +0530 (Sat, 12 Aug 2006) $
+ */
+public class InvalidServiceException extends LoaderException {
+
+ public InvalidServiceException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.java
new file mode 100644
index 0000000000..b0ad8594ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidValueException.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.spi.loader;
+
+/**
+ * Exception that indicates the loader encountered an invalid value.
+ * The message should be set to the invalid value.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidValueException extends LoaderException {
+
+ public InvalidValueException(String message) {
+ super(message);
+ }
+
+ public InvalidValueException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidValueException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidWireException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidWireException.java
new file mode 100644
index 0000000000..b26c81168f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidWireException.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.spi.loader;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-12 06:47:56 +0530 (Sat, 12 Aug 2006) $
+ */
+public class InvalidWireException extends LoaderException {
+
+ public InvalidWireException() {
+ }
+
+ public InvalidWireException(String message) {
+ super(message);
+ }
+
+
+ public InvalidWireException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public InvalidWireException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidWireException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.java
new file mode 100644
index 0000000000..e890d470a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/Loader.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.spi.loader;
+
+import java.net.URL;
+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.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * System service for loading physical artifacts that represent SCDL configurations and creating the model objects that
+ * represent them.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Loader {
+ /**
+ * Parse the supplied XML stream, dispatching to the appropriate registered loader for each element encountered in
+ * the stream.
+ * <p/>
+ * This method must be called with the XML cursor positioned on a START_ELEMENT event. When this method returns, the
+ * stream will be positioned on the corresponding END_ELEMENT event.
+ *
+ * @param parent the composite in which the model object is contained
+ * @param object the model object to load configuration data into. If null, the loader dispatched to is
+ * responsible for creating a model object itself
+ * @param reader the XML stream to parse
+ * @param deploymentContext the current deployment context
+ * @return the model object obtained by parsing the current element on the stream
+ * @throws XMLStreamException if there was a problem reading the stream
+ */
+ ModelObject load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException;
+
+ /**
+ * Load a model object from a specified location.
+ *
+ * @param parent the composite in which the model object is contained
+ * @param object the model object to load configuration data into. If null, the loader dispatched to is
+ * responsible for creating a model object itself
+ * @param url the location of an XML document to be loaded
+ * @param type the type of ModelObject that is expected to be in the document
+ * @param deploymentContext the current deployment context
+ * @return the model ojbect loaded from the document
+ * @throws LoaderException if there was a problem loading the document
+ */
+ <MO extends ModelObject> MO load(CompositeComponent parent,
+ ModelObject object,
+ URL url,
+ Class<MO> type,
+ DeploymentContext deploymentContext)
+ throws LoaderException;
+
+ /**
+ * Load the component type definition for a given implementation. How the component type information is located is
+ * defined by the implementation specification. It may include loading from an XML sidefile, introspection of some
+ * artifact related to the implementation, some combination of those techniques or any other implementation-defined
+ * mechanism.
+ *
+ * @param parent the parent composite
+ * @param implementation the implementation whose component type should be loaded
+ * @param deploymentContext the current deployment context
+ * @throws LoaderException if there was a problem loading the component type definition
+ */
+ <I extends Implementation<?>> void loadComponentType(CompositeComponent parent,
+ I implementation,
+ DeploymentContext deploymentContext)
+ throws LoaderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.java
new file mode 100644
index 0000000000..defc6b06c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderException.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.spi.loader;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * 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 LoaderException extends TuscanyException {
+ public static final int UNDEFINED = -1;
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+ private int line = UNDEFINED;
+ private int column = UNDEFINED;
+
+ public LoaderException() {
+ }
+
+ public LoaderException(String message) {
+ super(message);
+ }
+
+ public LoaderException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public LoaderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public LoaderException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public LoaderException(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;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public void setLine(int line) {
+ this.line = line;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void setColumn(int column) {
+ this.column = column;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.java
new file mode 100644
index 0000000000..ea88b99b22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderRegistry.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.spi.loader;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Implementation;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Registry for XML loaders that can parse a StAX input stream and return model objects.
+ * <p/>
+ * Loaders will typically be contributed to the system by any extension that needs to handle extension specific
+ * information contained in some XML configuration file. The loader can be contributed as a system component with an
+ * autowire reference to this builderRegistry which is used during initialization to actually register. </p> This
+ * builderRegistry can also be used to parse an input stream, dispatching to the appropriate loader for each element
+ * accepted. Loaders can call back to the builderRegistry to load sub-elements that they are not able to handle
+ * directly.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface LoaderRegistry extends Loader {
+ /**
+ * Register a loader. This operation will typically be called by a loader during its initialization.
+ *
+ * @param element the element that should be delegated to the contibuted loader
+ * @param loader a loader that is being contributed to the system
+ */
+ <T extends ModelObject> void registerLoader(QName element, StAXElementLoader<T> loader);
+
+ /**
+ * Unregister a loader. This will typically be called by a loader as it is being destroyed.
+ *
+ * @param element the element that was being delegated to the contibuted loader
+ * @param loader a loader that should no longer be used
+ */
+ <T extends ModelObject> void unregisterLoader(QName element, StAXElementLoader<T> loader);
+
+ /**
+ * Regsiter a component type loader.
+ *
+ * @param key a type of implementation this loader can load component types for
+ * @param loader the loader that is being contributed to the system
+ */
+ <I extends Implementation<?>> void registerLoader(Class<I> key, ComponentTypeLoader<I> loader);
+
+ /**
+ * Unregister a component type loader form the system.
+ *
+ * @param key a type of implementation whose loader should be unregistered
+ */
+ <I extends Implementation<?>> void unregisterLoader(Class<I> key);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.java
new file mode 100644
index 0000000000..bf48f91a74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/LoaderUtil.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.spi.loader;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamConstants;
+
+/**
+ * Utility functions to support loader implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class LoaderUtil {
+ private LoaderUtil() {
+ }
+
+ /**
+ * Advance the stream to the next END_ELEMENT event skipping any nested content.
+ *
+ * @param reader the reader to advance
+ * @throws XMLStreamException if there was a problem reading the stream
+ */
+ public static void skipToEndElement(XMLStreamReader reader) throws XMLStreamException {
+ int depth = 0;
+ while (true) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+ } else if (event == XMLStreamConstants.END_ELEMENT) {
+ if (depth == 0) {
+ return;
+ }
+ depth--;
+ }
+ }
+ }
+
+ /**
+ * Load the class using the supplied ClassLoader.
+ * The class will be defined so any initializers present will be fired.
+ * As the class is being loaded, the Thread context ClassLoader will be
+ * set to the supplied classloader.
+ *
+ * @param name the name of the class to load
+ * @param cl the classloader to use to load it
+ * @return the class
+ * @throws MissingResourceException if the class could not be found
+ */
+ public static Class<?> loadClass(String name, ClassLoader cl) throws MissingResourceException {
+ final Thread thread = Thread.currentThread();
+ final ClassLoader oldCL = thread.getContextClassLoader();
+ try {
+ thread.setContextClassLoader(cl);
+ return Class.forName(name, true, cl);
+ } catch (ClassNotFoundException e) {
+ throw new MissingResourceException(name, e);
+ } finally {
+ thread.setContextClassLoader(oldCL);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.java
new file mode 100644
index 0000000000..89a44083cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingImplementationException.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.spi.loader;
+
+/**
+ * Exception that indicates that an implementation was not provided.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingImplementationException extends LoaderException {
+ private static final long serialVersionUID = -2917278473974880124L;
+
+ /**
+ * Default constructor.
+ */
+ public MissingImplementationException() {
+ super();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.java
new file mode 100644
index 0000000000..10e40f9288
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingIncludeException.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.spi.loader;
+
+/**
+ * Exception that indicates that an include was not provided.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingIncludeException extends LoaderException {
+ private static final long serialVersionUID = -2917278473974880124L;
+
+ public MissingIncludeException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.java
new file mode 100644
index 0000000000..78856784e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingMustOverridePropertyException.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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MissingMustOverridePropertyException extends LoaderException {
+
+ public MissingMustOverridePropertyException(String name) {
+ super(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java
new file mode 100644
index 0000000000..c84169148d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.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.spi.loader;
+
+/**
+ * @version $Rev: 486986 $ $Date: 2006-12-14 11:48:28 +0530 (Thu, 14 Dec 2006) $
+ */
+public class MissingPropertyValueException extends LoaderException {
+
+ public MissingPropertyValueException(String name) {
+ super(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingReferenceException.java
new file mode 100644
index 0000000000..7bc206de34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingReferenceException.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.spi.loader;
+
+/**
+ * Indicates a required reference was not configured
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingReferenceException extends LoaderException {
+
+ public MissingReferenceException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.java
new file mode 100644
index 0000000000..3b6a21aa74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingResourceException.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.spi.loader;
+
+/**
+ * Exception that indicates an expected resource could not be found. The message should be set to the name of the
+ * resource.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MissingResourceException extends LoaderException {
+ private static final long serialVersionUID = 3775013318397916445L;
+
+ /**
+ * Constructor that indicates which resource could not be found. The supplied parameter is also returned as the
+ * message.
+ *
+ * @param resource the resource that could not be found
+ */
+ public MissingResourceException(String resource) {
+ super("Missing resource", resource);
+ }
+
+ public MissingResourceException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ /**
+ * Constructor that indicates which resource could not be found. The supplied parameter is also returned as the
+ * message.
+ *
+ * @param resource the resource that could not be found
+ * @param cause the error thrown resolving the resource
+ */
+ public MissingResourceException(String resource, Throwable cause) {
+ super("Missing resource", resource, cause);
+ }
+
+
+ /**
+ * Constructor that indicates which resource could not be found. The supplied parameter is also returned as the
+ * message.
+ *
+ * @param message the message set on the exception
+ * @param identifier the resource that could not be found
+ * @param cause the error thrown resolving the resource
+ */
+ public MissingResourceException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingSideFileException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingSideFileException.java
new file mode 100644
index 0000000000..67bcc6d7a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingSideFileException.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.spi.loader;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MissingSideFileException extends LoaderException {
+
+ public MissingSideFileException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.java
new file mode 100644
index 0000000000..4672f22a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/NotOverridablePropertyException.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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotOverridablePropertyException extends LoaderException {
+ private static final long serialVersionUID = 1483304023970967982L;
+
+ public NotOverridablePropertyException(String name) {
+ super(name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.java
new file mode 100644
index 0000000000..3fbeb6064f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/PropertyObjectFactory.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.spi.loader;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.PropertyValue;
+
+/**
+ * A factory that will create an ObjectFactory for a property
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PropertyObjectFactory {
+ /**
+ * Return an ObjectFactory for instances of a property defined in an XML. The ObjectFactory must return instances
+ * that can safely be supplied to component implementations. If the instance is mutable and isolation between
+ * components is required, then the factory must clone or otherwise protect the implementation from unexpected
+ * modifications by other implementation instances.
+ *
+ * @param property the Property definition that the resulting ObjectFactory must be able to assign to
+ * @param propertyValue The component configuration of the property
+ * @return an ObjectFactory that can produce instances that can be assigned to the supplied Property
+ * @throws LoaderException if there is a problem creating the ObjectFactory
+ */
+ <T> ObjectFactory<T> createObjectFactory(Property<T> property, PropertyValue<T> propertyValue)
+ throws LoaderException;
+
+ <T> ObjectFactory<List<T>> createListObjectFactory(Property<T> property, PropertyValue<T> propertyValue)
+ throws LoaderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.java
new file mode 100644
index 0000000000..37a4b594c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityOverridingException.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.spi.loader;
+
+import org.apache.tuscany.spi.model.Multiplicity;
+
+/**
+ * Denote the violation in overriding of multiplicity declaration for a reference either when a
+ * Component is overriding what is original in the underlying ComponentType or when a Composite is
+ * overriding while promoting a Component reference definition.
+ *
+ * @version $Rev $Date
+ */
+public class ReferenceMultiplicityOverridingException extends LoaderException {
+ private static final long serialVersionUID = -5827228144446207988L;
+ private final Multiplicity originalMultiplicity;
+ private final Multiplicity overridenMultiplicity;
+
+ /**
+ * @param message
+ * @param identifier
+ * @param multiplicity
+ * @param numberOfTargets
+ */
+ public ReferenceMultiplicityOverridingException(String message,
+ String identifier,
+ Multiplicity original,
+ Multiplicity overriden) {
+ super(message, identifier);
+ this.originalMultiplicity = original;
+ this.overridenMultiplicity = overriden;
+ }
+
+ /**
+ * @param identifier
+ * @param multiplicity
+ * @param numberOfTargets
+ */
+ public ReferenceMultiplicityOverridingException(String identifier, Multiplicity original, Multiplicity overriden) {
+ this("Multiplicity Overriding is violated", identifier, original, overriden);
+ }
+
+
+ /**
+ * Get the original multiplicity for the reference definition
+ *
+ * @return multiplicity of the reference definition
+ */
+ public Multiplicity getoriginalMultiplicity() {
+ return originalMultiplicity;
+ }
+
+ /**
+ * Get the overriden multiplicity for the reference definition
+ *
+ * @return multiplicity of the reference definition
+ */
+ public Multiplicity getOverridenMultiplicity() {
+ return overridenMultiplicity;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityViolationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityViolationException.java
new file mode 100644
index 0000000000..ce9acb8750
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/ReferenceMultiplicityViolationException.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.spi.loader;
+
+import org.apache.tuscany.spi.model.Multiplicity;
+
+/**
+ * Denote the violation of multiplicity declaration for a reference
+ *
+ * @version $Rev $Date
+ */
+public class ReferenceMultiplicityViolationException extends LoaderException {
+ private static final long serialVersionUID = -4049116356211578827L;
+
+ private final Multiplicity multiplicity;
+ private final int numberOfTargets;
+
+ /**
+ * @param message
+ * @param identifier
+ * @param multiplicity
+ * @param numberOfTargets
+ */
+ public ReferenceMultiplicityViolationException(String message,
+ String identifier,
+ Multiplicity multiplicity,
+ int numberOfTargets) {
+ super(message, identifier);
+ this.multiplicity = multiplicity;
+ this.numberOfTargets = numberOfTargets;
+ }
+
+ /**
+ * @param identifier
+ * @param multiplicity
+ * @param numberOfTargets
+ */
+ public ReferenceMultiplicityViolationException(String identifier, Multiplicity multiplicity, int numberOfTargets) {
+ this("Multiplicity is violated", identifier, multiplicity, numberOfTargets);
+ }
+
+ /**
+ * Get the multiplicity for the reference definition
+ *
+ * @return multiplicity of the reference definition
+ */
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ /**
+ * Get the number of targets defined for this reference
+ * @return number of targets for this reference
+ */
+ public int getNumberOfTargets() {
+ return numberOfTargets;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.java
new file mode 100644
index 0000000000..401e34cb71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/StAXElementLoader.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.spi.loader;
+
+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.model.ModelObject;
+
+/**
+ * A loader that creates a model object from a StAX input stream.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXElementLoader<T extends ModelObject> {
+ /**
+ * Create the model object for an element in an XML stream. When this method returns the stream will be positioned
+ * on the corresponding END_ELEMENT.
+ *
+ * @param parent the composite the model object being loaded is contained within
+ * @param object the model object to load configuration data into. An implementation may choose to return
+ * a different model object than the one passed in, in which case it is responsible for
+ * copying data. If null, the loader is responsible for creating a model object itself
+ * @param reader the XML stream reader positioned on the applicable START_ELEMENT
+ * @param deploymentContext the context for the load operation
+ * @return the model object for that element
+ */
+ T load(CompositeComponent parent, ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.java
new file mode 100644
index 0000000000..bf3aa205d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedPropertyException.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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UndefinedPropertyException extends LoaderException {
+ public UndefinedPropertyException(String name) {
+ super("Property not found on implementation", name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedReferenceException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedReferenceException.java
new file mode 100644
index 0000000000..f9aa8812ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UndefinedReferenceException.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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UndefinedReferenceException extends LoaderException {
+ private static final long serialVersionUID = -2897448857974015706L;
+
+ public UndefinedReferenceException(String name) {
+ super("Reference not found on implementation", name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedComponentTypeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedComponentTypeException.java
new file mode 100644
index 0000000000..750762d839
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedComponentTypeException.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.spi.loader;
+
+/**
+ * Exception that indicates an component type was encountered that could not be handled.
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnrecognizedComponentTypeException extends LoaderException {
+ private final Class<?> type;
+
+ /**
+ * Constructor that indicates which component type loader could not be found.
+ *
+ * @param type the component type type that could not be handled
+ */
+ public UnrecognizedComponentTypeException(Class<?> type) {
+ super("Unrecognized element", type.getName());
+ this.type = type;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.java
new file mode 100644
index 0000000000..7991105da8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/UnrecognizedElementException.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.spi.loader;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Exception that indicates an element was encountered that could not be handled.
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnrecognizedElementException extends LoaderException {
+ private static final long serialVersionUID = 2549543622209829032L;
+ private final QName element;
+
+ /**
+ * Constructor that indicates which resource could not be found. The supplied parameter is also returned as the
+ * message.
+ *
+ * @param element the element that could not be handled
+ */
+ public UnrecognizedElementException(QName element) {
+ super("Unrecognized element", element.toString());
+ this.element = element;
+ }
+
+ public QName getElement() {
+ return element;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/MarshalException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/MarshalException.java
new file mode 100644
index 0000000000..5693ee08e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/MarshalException.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.spi.marshaller;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Super class for all marshalling/unmarshalling exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class MarshalException extends TuscanyException {
+
+ /**
+ * Initializes the exception message.
+ * @param message Message for the exception.
+ */
+ public MarshalException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initializes the root cause.
+ * @param cause Root cause for the exception.
+ */
+ public MarshalException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.java
new file mode 100644
index 0000000000..da1ec90c8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/marshaller/ModelMarshaller.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.spi.marshaller;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Interface for marshalling/unmarshalling internal model objects.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface ModelMarshaller<MD extends ModelObject> {
+
+ /**
+ * Marshalls the model object to the specified stream writer.
+ *
+ * @param modelObject Model object to be serialized.
+ * @param writer Stream writer to which the infoset is serialized.
+ * @throws MarshalException In case of any marshalling error.
+ */
+ void marshall(MD modelObject, XMLStreamWriter writer) throws MarshalException;
+
+ /**
+ * Unmarshalls an XML stream to a model object.
+ *
+ * @param reader XML stream from where the marshalled XML is read.
+ * @param upconvert Whether to upconvert the object is the current runtime
+ * supports a higher version of the model object.
+ * @return Hydrated model object.
+ * @throws MarshalException In case of any unmarshalling error.
+ */
+ MD unmarshall(XMLStreamReader reader, boolean upconvert) throws MarshalException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java
new file mode 100644
index 0000000000..3e38abf103
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AbstractReferenceDefinition.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a component reference
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractReferenceDefinition extends ModelObject {
+ private String name;
+ private ServiceContract serviceContract;
+ private Multiplicity multiplicity;
+ private boolean autowire;
+ private List<BindingDefinition> bindings;
+ private List<URI> targets = new ArrayList<URI>();
+ private boolean wiredByImpl;
+ private List requiredIntents = new ArrayList<QName>();
+ private List policySets = new ArrayList<QName>();
+
+ public AbstractReferenceDefinition() {
+ autowire = false;
+ multiplicity = Multiplicity.ONE_ONE;
+ bindings = new ArrayList<BindingDefinition>();
+ }
+
+ public AbstractReferenceDefinition(String name, ServiceContract serviceContract) {
+ this.name = name;
+ this.serviceContract = serviceContract;
+ bindings = new ArrayList<BindingDefinition>();
+ autowire = false;
+ multiplicity = Multiplicity.ONE_ONE;
+ }
+
+ public AbstractReferenceDefinition(String name, ServiceContract serviceContract, Multiplicity multiplicity) {
+ this.name = name;
+ this.serviceContract = serviceContract;
+ this.multiplicity = multiplicity;
+ bindings = new ArrayList<BindingDefinition>();
+ autowire = false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ServiceContract<?> getServiceContract() {
+ return serviceContract;
+ }
+
+ public void setServiceContract(ServiceContract serviceContract) {
+ this.serviceContract = serviceContract;
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public List<BindingDefinition> getBindings() {
+ return Collections.unmodifiableList(bindings);
+ }
+
+ public void addBinding(BindingDefinition binding) {
+ this.bindings.add(binding);
+ }
+
+ public List<URI> getTargets() {
+ return Collections.unmodifiableList(targets);
+ }
+
+ public void addTarget(URI targetURI) {
+ this.targets.add(targetURI);
+ }
+
+ public boolean isWiredByImpl() {
+ return wiredByImpl;
+ }
+
+ public void setWiredByImpl(boolean wiredByImpl) {
+ this.wiredByImpl = wiredByImpl;
+ }
+
+ public List getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List policySets) {
+ this.policySets = policySets;
+ }
+
+ public List getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public void setRequiredIntents(List requiredIntents) {
+ this.requiredIntents = requiredIntents;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.java
new file mode 100644
index 0000000000..8e12e970ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/AtomicImplementation.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.spi.model;
+
+/**
+ * The base representation of an atomic component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AtomicImplementation<T extends ComponentType> extends Implementation<T> {
+ protected AtomicImplementation() {
+ }
+
+ protected AtomicImplementation(T componentType) {
+ super(componentType);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.java
new file mode 100644
index 0000000000..85af2a7985
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/BindingDefinition.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.spi.model;
+
+import java.net.URI;
+
+/**
+ * The base representation of a binding specified in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BindingDefinition extends ModelObject implements Cloneable {
+ private URI targetUri;
+
+ protected BindingDefinition() {
+ }
+
+ public BindingDefinition(URI targetUri) {
+ this.targetUri = targetUri;
+ }
+
+ public URI getTargetUri() {
+ return targetUri;
+ }
+
+ public void setTargetUri(URI targetUri) {
+ this.targetUri = targetUri;
+ }
+
+ abstract public Object clone();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java
new file mode 100644
index 0000000000..f9ef20add9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.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.spi.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents a component.
+ * <p>A component is a configured instance of an implementation. The services provided and consumed
+ * and the available configuration properties are defined by the implementation (represented by
+ * its componentType).</p>
+ * <p>Every component has a name which uniquely identifies it within the scope of the composite
+ * that contains it; the name must be different from the names of all other components, services and references
+ * immediately contained in the composite (directly or through an &lt;include&gt; element).</p>
+ * <p>A component may define a {@link PropertyValue} that overrides the default value of a {@link Property}
+ * defined in the componentType.</p>
+ * <p>It may also define a {@link ReferenceTarget} for a {@link AbstractReferenceDefinition} defined in the componentType.
+ * The ReferenceTarget must resolve to another component or a reference in the enclosing composite.</p>
+ * <p>Components may specify an initialization level that will determine the order in which it will be eagerly
+ * initialized relative to other components from the enclosing composite that are in the same scope. This can be
+ * used to define a startup sequence for components that are otherwise independent. Any initialization required
+ * to resolve references between components will override this initialization order.</p>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentDefinition<I extends Implementation<?>> extends ModelObject {
+ private String name;
+ private Integer initLevel;
+ private final I implementation;
+ private final Map<String, ComponentReferenceDefinition> references = new HashMap<String, ComponentReferenceDefinition>();
+ private final Map<String, PropertyValue<?>> propertyValues = new HashMap<String, PropertyValue<?>>();
+ private boolean autowire;
+
+ /**
+ * Constructor specifying the component's name and implementation.
+ *
+ * @param name the name of this component
+ * @param implementation the implementation of this component
+ */
+ public ComponentDefinition(String name, I implementation) {
+ this.name = name;
+ this.implementation = implementation;
+ }
+
+ /**
+ * Constructor specifying the implementation of this component.
+ *
+ * @param implementation the implementation of this component
+ */
+ public ComponentDefinition(I implementation) {
+ this.implementation = implementation;
+ }
+
+ /**
+ * Returns the {@link Implementation} of this component.
+ *
+ * @return the implementation of this component
+ */
+ public I getImplementation() {
+ return implementation;
+ }
+
+ /**
+ * Returns the name of this component.
+ *
+ * @return the name of this component
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of this component.
+ *
+ * @param name the name of this component
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the initialization level of this component.
+ *
+ * @return the initialization level of this component
+ */
+ public Integer getInitLevel() {
+ return initLevel;
+ }
+
+ /**
+ * Sets the initialization level of this component.
+ * If set to null then the level from the componentType is used.
+ * If set to zero or a negative value then the component will not be eagerly initialized.
+ *
+ * @param initLevel the initialization level of this component
+ */
+ public void setInitLevel(Integer initLevel) {
+ this.initLevel = initLevel;
+ }
+
+ /**
+ * Returns a live Map of {@link PropertyValue property values} configured by this component definition.
+ *
+ * @return the property values configured by this component
+ */
+ public Map<String, PropertyValue<?>> getPropertyValues() {
+ return propertyValues;
+ }
+
+ /**
+ * Add a property value configuration to this component.
+ * Any existing configuration for the property names in the property value is replaced.
+ *
+ * @param value the property value to add
+ */
+ public void add(PropertyValue<?> value) {
+ propertyValues.put(value.getName(), value);
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Map<String, ComponentReferenceDefinition> getReferences() {
+ return references;
+ }
+
+ public void add(ComponentReferenceDefinition ref) {
+ references.put(ref.getName(), ref);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java
new file mode 100644
index 0000000000..0f8e162c62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentReferenceDefinition.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * Represents reference defintion that is part of a Component definition
+ *
+ */
+public class ComponentReferenceDefinition extends AbstractReferenceDefinition {
+ private ComponentTypeReferenceDefinition associatedCompTypeRefDefn;
+
+ public ComponentReferenceDefinition(ComponentTypeReferenceDefinition ctRefDefn) {
+ super();
+ setMultiplicity(null);
+ this.associatedCompTypeRefDefn = ctRefDefn;
+ }
+
+ public ComponentReferenceDefinition(String name, ServiceContract serviceContract, ComponentTypeReferenceDefinition ctRefDefn) {
+ super(name, serviceContract, null);
+ this.associatedCompTypeRefDefn = ctRefDefn;
+ }
+
+ public ComponentReferenceDefinition(String name, ServiceContract serviceContract, Multiplicity multiplicity, ComponentTypeReferenceDefinition ctRefDefn) {
+ super(name, serviceContract, multiplicity);
+ this.associatedCompTypeRefDefn = ctRefDefn;
+ }
+
+ @Override
+ public String getName() {
+ return associatedCompTypeRefDefn.getName();
+ }
+
+ public ComponentTypeReferenceDefinition getAssociatedCompTypeRefDefn() {
+ return associatedCompTypeRefDefn;
+ }
+
+ public void setAssociatedCompTypeRefDefn(ComponentTypeReferenceDefinition associatedCompTypeRefDefn) {
+ this.associatedCompTypeRefDefn = associatedCompTypeRefDefn;
+ }
+
+ @Override
+ public Multiplicity getMultiplicity() {
+ if (super.getMultiplicity() != null) {
+ return super.getMultiplicity();
+ } else {
+ return associatedCompTypeRefDefn.getMultiplicity();
+ }
+ }
+
+ @Override
+ public List<URI> getTargets() {
+ if (super.getTargets() == null || super.getTargets().isEmpty()) {
+ return associatedCompTypeRefDefn.getTargets();
+ } else {
+ return super.getTargets();
+ }
+ }
+
+ @Override
+ public ServiceContract<?> getServiceContract() {
+ if (super.getServiceContract() == null) {
+ return associatedCompTypeRefDefn.getServiceContract();
+ } else {
+ return super.getServiceContract();
+ }
+ }
+
+ @Override
+ public List<BindingDefinition> getBindings() {
+ if (super.getBindings() == null || super.getBindings().size() == 0) {
+ return associatedCompTypeRefDefn.getBindings();
+ } else {
+ return super.getBindings();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
new file mode 100644
index 0000000000..af3fcc6f48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.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.spi.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>The definition of the configurable aspects of an implementation in terms of the services it exposes, the services
+ * it references, and properties that can be used to configure it.</p> <p>A service represents an addressable interface
+ * provided by the implementation. Such a service may be the target of a wire from another component.</p> <p>A reference
+ * represents a requirement that an implementation has on a service provided by another component or by a resource
+ * outside the SCA system. Such a reference may be the source of a wire to another component.</p> <p>A property allows
+ * the behaviour of the implementation to be configured through externally set values.</p> <p>A component type may also
+ * declare that it wishes to be initialized upon activation of the scope that contains it and may specify an order
+ * relative to other eagerly initializing components. For example, an implementation that pre-loads some form of cache
+ * could declare that it should be eagerly initialized at the start of the scope so that the cache load occured on
+ * startup rather than first use.</p>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentType<S extends ServiceDefinition, R extends ComponentTypeReferenceDefinition, P extends Property<?>>
+ extends ModelObject {
+ protected Scope implementationScope = Scope.UNDEFINED;
+ private int initLevel;
+ private long maxAge = -1;
+ private long maxIdleTime = -1;
+ private final Map<String, S> services = new HashMap<String, S>();
+ private final Map<String, R> references = new HashMap<String, R>();
+ private final Map<String, P> properties = new HashMap<String, P>();
+
+ /**
+ * Returns the component implementation scope
+ */
+ public Scope getImplementationScope() {
+ return implementationScope;
+ }
+
+ /**
+ * Sets the component implementation scope
+ */
+ public void setImplementationScope(Scope implementationScope) {
+ this.implementationScope = implementationScope;
+ }
+
+ /**
+ * Returns the default initialization level for components of this type. A value greater than zero indicates that
+ * components should be eagerly initialized.
+ *
+ * @return the default initialization level
+ */
+ public int getInitLevel() {
+ return initLevel;
+ }
+
+ /**
+ * Sets the default initialization level for components of this type. A value greater than zero indicates that
+ * components should be eagerly initialized.
+ *
+ * @param initLevel default initialization level for components of this type
+ */
+ public void setInitLevel(int initLevel) {
+ this.initLevel = initLevel;
+ }
+
+ /**
+ * Returns true if this component should be eagerly initialized.
+ *
+ * @return true if this component should be eagerly initialized
+ */
+ public boolean isEagerInit() {
+ return initLevel > 0;
+ }
+
+ /**
+ * Returns the idle time allowed between operations in milliseconds if the implementation is conversational
+ *
+ * @return the idle time allowed between operations in milliseconds if the implementation is conversational
+ */
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ /**
+ * Sets the idle time allowed between operations in milliseconds if the implementation is conversational
+ */
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+
+ /**
+ * Returns the maximum age a conversation may remain active in milliseconds if the implementation is conversational
+ *
+ * @return the maximum age a conversation may remain active in milliseconds if the implementation is conversational
+ */
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ /**
+ * Sets the maximum age a conversation may remain active in milliseconds if the implementation is conversational
+ */
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ /**
+ * Returns a live Map of the services provided by the implementation.
+ *
+ * @return a live Map of the services provided by the implementation
+ */
+ public Map<String, S> getServices() {
+ return services;
+ }
+
+ /**
+ * Add a service to those provided by the implementation. Any existing service with the same name is replaced.
+ *
+ * @param service a service provided by the implementation
+ */
+ public void add(S service) {
+ services.put(service.getName(), service);
+ }
+
+ /**
+ * Returns a live Map of references to services consumed by the implementation.
+ *
+ * @return a live Map of references to services consumed by the implementation
+ */
+ public Map<String, R> getReferences() {
+ return references;
+ }
+
+ /**
+ * Add a reference to a service consumed by the implementation. Any existing reference with the same name is
+ * replaced.
+ *
+ * @param reference a reference to a service consumed by the implementation
+ */
+ public void add(R reference) {
+ references.put(reference.getName(), reference);
+ }
+
+ /**
+ * Returns a live Map of properties that can be used to configure the implementation.
+ *
+ * @return a live Map of properties that can be used to configure the implementation
+ */
+ public Map<String, P> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Add a property that can be used to configure the implementation. Any existing property with the same name is
+ * replaced.
+ *
+ * @param property a property that can be used to configure the implementation
+ */
+ public void add(P property) {
+ properties.put(property.getName(), property);
+ }
+
+ /**
+ * Get a specific property that can be used to configure the implementation.
+ *
+ * @param name the name of the property
+ * @return the property that can be used to configure the implementation or null if no such property exists
+ */
+ public Property getProperty(String name) {
+ return properties.get(name);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.java
new file mode 100644
index 0000000000..688d09b7df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentTypeReferenceDefinition.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.spi.model;
+
+
+
+/**
+ * Represents reference defintion that is part of a ComponentType definition
+ *
+ */
+public class ComponentTypeReferenceDefinition extends AbstractReferenceDefinition {
+ public ComponentTypeReferenceDefinition() {
+ super();
+ }
+
+ public ComponentTypeReferenceDefinition(String name, ServiceContract serviceContract) {
+ super(name, serviceContract);
+ }
+
+ public ComponentTypeReferenceDefinition(String name, ServiceContract serviceContract, Multiplicity multiplicity) {
+ super(name, serviceContract, multiplicity);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
new file mode 100644
index 0000000000..d9355d89c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A specialization of component type for composite components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentType<S extends ServiceDefinition,
+ R extends CompositeReferenceDefinition,
+ P extends Property<?>> extends ComponentType<S, R, P> {
+
+ private String name;
+ private final Map<String, ComponentDefinition<? extends Implementation<?>>> components =
+ new HashMap<String, ComponentDefinition<? extends Implementation<?>>>();
+ private final Map<String, Include> includes = new HashMap<String, Include>();
+ private final List<WireDefinition> wires = new ArrayList<WireDefinition>();
+ private boolean autowire;
+
+ public CompositeComponentType() {
+ implementationScope = Scope.SYSTEM;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ /**
+ * Get all properties including the ones are from included composites
+ * @return
+ */
+ public Map<String, P> getProperties() {
+ Map<String, P> view = new HashMap<String, P>(super.getProperties());
+ for (Include i : includes.values()) {
+ view.putAll(i.getIncluded().getProperties());
+ }
+ return Collections.unmodifiableMap(view);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ /**
+ * Get all references including the ones are from included composites
+ * @return
+ */
+ public Map<String, R> getReferences() {
+ Map<String, R> view = new HashMap<String, R>(super.getReferences());
+ for (Include i : includes.values()) {
+ view.putAll(i.getIncluded().getReferences());
+ }
+ return Collections.unmodifiableMap(view);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ /**
+ * Get all services including the ones are from included composites
+ * @return
+ */
+ public Map<String, S> getServices() {
+ Map<String, S> view = new HashMap<String, S>(super.getServices());
+ for (Include i : includes.values()) {
+ view.putAll(i.getIncluded().getServices());
+ }
+ return Collections.unmodifiableMap(view);
+ }
+
+ /**
+ * Get all components including the ones are from included composites
+ */
+ @SuppressWarnings("unchecked")
+ public Map<String, ComponentDefinition<? extends Implementation<?>>> getComponents() {
+ Map<String, ComponentDefinition<? extends Implementation<?>>> view =
+ new HashMap<String, ComponentDefinition<? extends Implementation<?>>>(components);
+ for (Include i : includes.values()) {
+ view.putAll(i.getIncluded().getComponents());
+ }
+ return Collections.unmodifiableMap(view);
+ }
+
+
+ /**
+ * Get all wires including the ones are from included composites
+ */
+ @SuppressWarnings("unchecked")
+ public List<WireDefinition> getWires() {
+ List<WireDefinition> view =
+ new ArrayList<WireDefinition>(wires);
+ for (Include i : includes.values()) {
+ view.addAll(i.getIncluded().getWires());
+ }
+ return Collections.unmodifiableList(view);
+ }
+
+ /**
+ * Get declared properties in this composite type, included doesn't count
+ */
+ public Map<String, P> getDeclaredProperties() {
+ return super.getProperties();
+ }
+
+ /**
+ * Get declared references in this composite type, included doesn't count
+ */
+ public Map<String, R> getDeclaredReferences() {
+ return super.getReferences();
+ }
+
+ /**
+ * Get declared services in this composite type, included doesn't count
+ */
+ public Map<String, S> getDeclaredServices() {
+ return super.getServices();
+ }
+
+ /**
+ * Get declared components in this composite type, included doesn't count
+ */
+ public Map<String, ComponentDefinition<? extends Implementation<?>>> getDeclaredComponents() {
+ return components;
+ }
+
+ /**
+ * Get declared wires in this composite type, included doesn't count
+ */
+ public List<WireDefinition> getDeclaredWires() {
+ return wires;
+ }
+
+ public void add(WireDefinition wireDefn) {
+ wires.add(wireDefn);
+ }
+
+
+ public void add(ComponentDefinition<? extends Implementation<?>> componentDefinition) {
+ components.put(componentDefinition.getName(), componentDefinition);
+ }
+
+ public Map<String, Include> getIncludes() {
+ return includes;
+ }
+
+ public void add(Include include) {
+ includes.put(include.getName(), include);
+ }
+
+ public Map<Object, Object> getDeclaredExtensions() {
+ return super.getExtensions();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<Object, Object> getExtensions() {
+ Map<Object, Object> view = new HashMap<Object, Object>(super.getExtensions());
+ for (Include i : includes.values()) {
+ view.putAll(i.getIncluded().getExtensions());
+ }
+ return Collections.unmodifiableMap(view);
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.java
new file mode 100644
index 0000000000..6948c52286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeImplementation.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.spi.model;
+
+import java.net.URL;
+
+/**
+ * A specialization of an implementation associated with composite components
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeImplementation extends Implementation<CompositeComponentType> {
+ private String name;
+ private URL scdlLocation;
+ private ClassLoader classLoader;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public URL getScdlLocation() {
+ return scdlLocation;
+ }
+
+ public void setScdlLocation(URL scdlLocation) {
+ this.scdlLocation = scdlLocation;
+ }
+
+ 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/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.java
new file mode 100644
index 0000000000..30466296c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeReferenceDefinition.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.spi.model;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+
+
+/**
+ * Represents reference defintion that is part of a Composite definition
+ *
+ */
+public class CompositeReferenceDefinition extends ComponentTypeReferenceDefinition {
+ protected List<URI> promotedReferences = new ArrayList<URI>();
+
+ public CompositeReferenceDefinition() {
+ super();
+ }
+
+ public CompositeReferenceDefinition(String name, ServiceContract serviceContract) {
+ super(name, serviceContract);
+ }
+
+ public CompositeReferenceDefinition(String name, ServiceContract serviceContract, Multiplicity multiplicity) {
+ super(name, serviceContract, multiplicity);
+ }
+
+ public void addPromotedReference(URI refUri) {
+ this.promotedReferences.add(refUri);
+ }
+
+ public List<URI> getPromotedReferences() {
+ return Collections.unmodifiableList(promotedReferences);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Contribution.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Contribution.java
new file mode 100644
index 0000000000..6e73fb9e0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Contribution.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.spi.model;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class Contribution extends DeployedArtifact {
+ public static final String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
+ public static final String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
+
+ protected List<String> exports = new ArrayList<String>();
+ protected List<ContributionImport> imports = new ArrayList<ContributionImport>();
+ protected List<QName> deployables = new ArrayList<QName>();
+
+ /**
+ * A list of artifacts in the contribution
+ */
+ protected Map<URI, DeployedArtifact> artifacts = new HashMap<URI, DeployedArtifact>();
+
+ public Contribution() {
+ super();
+ }
+
+ /**
+ * @param uri
+ */
+ public Contribution(URI uri) {
+ super(uri);
+ if (uri != null) {
+ artifacts.put(uri, this);
+ }
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setURI(URI uri) {
+ super.setUri(uri);
+ if (uri != null) {
+ artifacts.put(uri, this);
+ }
+ }
+
+ public List<String> getExports() {
+ return exports;
+ }
+
+ public List<ContributionImport> getImports() {
+ return imports;
+ }
+
+ public List<QName> getDeployables() {
+ return deployables;
+ }
+
+ public Map<URI, DeployedArtifact> getArtifacts() {
+ return Collections.unmodifiableMap(artifacts);
+ }
+
+ public void addArtifact(DeployedArtifact artifact) {
+ artifact.setContribution(this);
+ artifacts.put(artifact.getUri(), artifact);
+ }
+
+ public DeployedArtifact getArtifact(URI uri) {
+ return artifacts.get(uri);
+ }
+
+ /**
+ * @return the location
+ */
+ public URL getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(URL location) {
+ this.location = location;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ContributionImport.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ContributionImport.java
new file mode 100644
index 0000000000..a678adbdc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ContributionImport.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.spi.model;
+
+import java.net.URI;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionImport extends ModelObject {
+ private String namespace; // The namespace to be imported
+ private URI location; // Optional location to hint the where it should be imported
+
+ // TODO: We might need the field to point to the imported artifact/model
+
+ public URI getLocation() {
+ return location;
+ }
+
+ public void setLocation(URI location) {
+ this.location = location;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
new file mode 100644
index 0000000000..72effb52e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Representation of the type of data associated with an operation. Data is represented in two forms: the physical form
+ * used by the runtime and a logical form used by the assembly. The physical form is a Java Type because the runtime is
+ * written in Java. This may be the same form used by the application but it may not; for example, an application that
+ * is performing stream processing may want a physical form such as an {@link java.io.InputStream InputStream} to
+ * semantially operate on application data such as a purchase order. The logical description is that used by the
+ * assembly model and is an identifier into some well-known type space; examples may be a Java type represented by its
+ * Class or an XML type represented by its QName. Every data type may also contain metadata describing the expected
+ * data; for example, it could specify a preferred data binding technology or the size of a typical instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataType<L> extends ModelObject implements Cloneable {
+ private String dataBinding;
+
+ private final Type physical;
+
+ private L logical;
+
+ private Map<String, Object> metadata = new HashMap<String, Object>();
+
+ private Operation operation;
+
+ /**
+ * Construct a data type specifying the physical and logical types.
+ *
+ * @param physical the physical class used by the runtime
+ * @param logical the logical type
+ * @see #getLogical()
+ */
+ public DataType(Type physical, L logical) {
+ this.physical = physical;
+ this.logical = logical;
+ if (physical instanceof Class) {
+ this.dataBinding = ((Class) physical).getName();
+ }
+ }
+
+ public DataType(String dataBinding, Type physical, L logical) {
+ this.dataBinding = dataBinding;
+ this.physical = physical;
+ this.logical = logical;
+ }
+
+ /**
+ * Returns the physical type used by the runtime.
+ *
+ * @return the physical type used by the runtime
+ */
+ public Type getPhysical() {
+ return physical;
+ }
+
+ /**
+ * Returns the logical identifier used by the assembly. The type of this value identifies the logical type system in
+ * use. Known values are: <ul> <li>a java.lang.reflect.Type identifies a Java type by name and ClassLoader; this
+ * includes Java Classes as they are specializations of Type</li> <li>a javax.xml.namespace.QName identifies an XML
+ * type by local name and namespace</li> </ul>
+ *
+ * @return the logical type name
+ */
+ public L getLogical() {
+ return logical;
+ }
+
+ /**
+ * Returns all metadata about this type.
+ *
+ * @return all metadata about this type
+ */
+ public Map<String, ?> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Returns the specified metadata item or null if not present.
+ *
+ * @param name the name of the metadata item
+ * @return the value, or null if not present
+ */
+ public Object getMetadata(String name) {
+ return metadata.get(name);
+ }
+
+ /**
+ * Sets the specified metadata value. A null value undefines it.
+ *
+ * @param name the name of the metadata item
+ * @param value the value, or null to undefine
+ * @return the old value for the item, or null if not present
+ */
+ public Object setMetadata(String name, Object value) {
+ if (value == null) {
+ return metadata.remove(name);
+ } else {
+ return metadata.put(name, value);
+ }
+ }
+
+ public String getDataBinding() {
+ if (dataBinding == null) {
+ // databinding is not set at the DataType level, check the operation
+ Operation<?> operation = (Operation<?>) getOperation();
+ if (operation != null) {
+ return operation.getDataBinding();
+ }
+ }
+ return dataBinding;
+ }
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ public int hashCode() {
+ int result;
+ result = dataBinding != null ? dataBinding.hashCode() : 0;
+ result = 29 * result + (physical != null ? physical.hashCode() : 0);
+ result = 29 * result + (logical != null ? logical.hashCode() : 0);
+ // Commented the following line out since it causes infinite loop from Operation.hashCode()
+ // if the metadata map contains the Operation
+ // result = 29 * result + (metadata != null ? metadata.hashCode() : 0);
+ return result;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DataType dataType = (DataType) o;
+
+ if (dataBinding != null ? !dataBinding.equals(dataType.dataBinding) : dataType.dataBinding != null) {
+ return false;
+ }
+ if (logical != null ? !logical.equals(dataType.logical) : dataType.logical != null) {
+ return false;
+ }
+ return !(physical != null ? !physical.equals(dataType.physical) : dataType.physical != null);
+
+ }
+
+// @SuppressWarnings("unchecked")
+// public boolean equals(Object o) {
+// if (this == o) {
+// return true;
+// }
+// if (o == null || getClass() != o.getClass()) {
+// return false;
+// }
+//
+// final DataType dataType = (DataType) o;
+//
+// if (logical instanceof Class && dataType.logical instanceof Class) {
+// Class<?> logicalClass = (Class<?>) logical;
+// Class<?> targetLogicalClass = (Class<?>) dataType.logical;
+// if (!logicalClass.isAssignableFrom(targetLogicalClass)) {
+// return false;
+// }
+// } else {
+// if (logical != null ? !logical.equals(dataType.logical) : dataType.logical != null) {
+// return false;
+// }
+// }
+// if (physical instanceof Class && dataType.physical instanceof Class) {
+// Class<?> physicalClass = (Class<?>) physical;
+// Class<?> physicalTargetClass = (Class<?>) dataType.physical;
+// if (dataBinding != null
+// && dataType.dataBinding != null
+// && dataBinding.equals(physicalClass.getName())
+// && dataType.dataBinding.equals(physicalTargetClass.getName())) {
+// return physicalClass.isAssignableFrom(physicalTargetClass);
+// }
+// if (!physicalClass.isAssignableFrom(physicalTargetClass)) {
+// return false;
+// }
+// return !(dataBinding != null ? !dataBinding.equals(dataType.dataBinding) : dataType.dataBinding != null);
+//
+//
+// }
+//
+// if (dataBinding != null ? !dataBinding.equals(dataType.dataBinding) : dataType.dataBinding != null) {
+// return false;
+// }
+//
+// return !(physical != null ? !physical.equals(dataType.physical) : dataType.physical != null);
+// }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(physical).append(" ").append(dataBinding).append(" ").append(logical);
+ return sb.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ DataType<L> copy = (DataType<L>) super.clone();
+ assert this.metadata instanceof HashMap;
+ copy.metadata = (HashMap<String, Object>) ((HashMap) this.metadata).clone();
+ return copy;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(Operation operation) {
+ this.operation = operation;
+ }
+
+ /**
+ * @param logical the logical to set
+ */
+ public void setLogical(L logical) {
+ this.logical = logical;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DeployedArtifact.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DeployedArtifact.java
new file mode 100644
index 0000000000..c3261cbe97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DeployedArtifact.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.spi.model;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public class DeployedArtifact extends ModelObject {
+ protected Contribution contribution;
+ protected URI uri;
+ protected URL location;
+ /**
+ * The map keeps all the model objects loaded/introspected from this artifact. The objects
+ * are keyed by the java type of the model such as javax.wsdl.ModelObject. The value is also
+ * a map with namespace as the key and the model object as the value.
+ */
+ protected Map<Class, Map<String, Object>> modelObjects = new HashMap<Class, Map<String, Object>>();
+
+ public DeployedArtifact() {
+ super();
+ }
+
+ /**
+ * @param uri
+ */
+ public DeployedArtifact(URI uri) {
+ super();
+ this.uri = uri;
+ }
+
+ /**
+ * Get the absolute URI as the unique id for the artifact
+ * @return
+ */
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * @return the location
+ */
+ public URL getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(URL location) {
+ this.location = location;
+ }
+
+ public Contribution getContribution() {
+ return contribution;
+ }
+
+ public void setContribution(Contribution contribution) {
+ this.contribution = contribution;
+ }
+
+ public Map<Class, Map<String, Object>> getModelObjects() {
+ return modelObjects;
+ }
+
+ public Map<String, Object> getModelObjects(Class type) {
+ return modelObjects.get(type);
+ }
+
+ public Object getModelObject(Class type, String namespace) {
+ Map<String, Object> map = modelObjects.get(type);
+ if (map == null) {
+ return null;
+ } else {
+ return map.get(namespace);
+ }
+ }
+
+ public void addModelObject(Class type, String namespace, Object modelObject) {
+ Map<String, Object> map = modelObjects.get(type);
+ if (map == null) {
+ map = new HashMap<String, Object>();
+ modelObjects.put(type, map);
+ }
+ map.put(namespace, modelObject);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.java
new file mode 100644
index 0000000000..8520ab49e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Implementation.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.spi.model;
+
+/**
+ * Represents a component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class Implementation<T extends ComponentType> extends ModelObject {
+ private T componentType;
+
+ protected Implementation() {
+ }
+
+ protected Implementation(T componentType) {
+ this.componentType = componentType;
+ }
+
+ public T getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(T componentType) {
+ this.componentType = componentType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java
new file mode 100644
index 0000000000..ac320a2b5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Include.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.net.URL;
+
+/**
+ * Model object that represents the include of a composite by value.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Include extends ModelObject {
+ private String name;
+ private URL scdlLocation;
+ private CompositeComponentType included;
+
+ /**
+ * Returns the name of the composite that is being included.
+ * @return the name of the composite that is being included
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the composite that is being included.
+ * @param name the name of the composite that is being included
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the location of the SCDL for composite being included.
+ * @return the location of the SCDL for composite being included
+ */
+ public URL getScdlLocation() {
+ return scdlLocation;
+ }
+
+ /**
+ * Sets the location of the SCDL for composite being included.
+ * @param scdlLocation the location of the SCDL for composite being included
+ */
+ public void setScdlLocation(URL scdlLocation) {
+ this.scdlLocation = scdlLocation;
+ }
+
+ /**
+ * Returns the composite that was included.
+ * @return the composite that was included
+ */
+ public CompositeComponentType getIncluded() {
+ return included;
+ }
+
+ /**
+ * Sets the composite that was included.
+ * @param included the composite that was included
+ */
+ public void setIncluded(CompositeComponentType included) {
+ this.included = included;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Intent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Intent.java
new file mode 100644
index 0000000000..9f3ee78a23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Intent.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.spi.model;
+
+import java.util.ArrayList;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Model representation for intent. This class is used by intent loader only, other SCA model classes will not reference
+ * this class directly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Intent {
+
+ /**
+ * name of intent.
+ */
+ protected IntentName name;
+
+ /**
+ * Description for this intent
+ */
+ protected String description;
+
+ /**
+ * QNames of artifacts this intent can apply to
+ */
+ protected List<QName> appliedArtifacts = new ArrayList<QName>();
+
+ /**
+ * intents required by this intent, only useful when this intent is a profile intent
+ */
+ protected List<IntentName> requriedIntents = new ArrayList<IntentName>();
+
+ /**
+ * Create a policy intent.
+ *
+ * @param name name of the intent.
+ * @param description description of the intent.
+ */
+ public Intent(IntentName name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public List<QName> getAppliedArtifacts() {
+ return unmodifiableList(appliedArtifacts);
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public IntentName getName() {
+ return name;
+ }
+
+ public List<IntentName> getRequriedIntents() {
+ return unmodifiableList(requriedIntents);
+ }
+
+ public void addRequriedIntents(IntentName intent) {
+ requriedIntents.add(intent);
+ }
+
+ public void addAppliedArtifacts(QName artifactName) {
+ appliedArtifacts.add(artifactName);
+ }
+
+ public boolean isProfileIntent() {
+ return !requriedIntents.isEmpty();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java
new file mode 100644
index 0000000000..cbfba86dfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.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.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+
+/**
+ * Represents an IntentMap within PolicySet.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMap extends PolicyModel {
+
+ /* Name of default intent provied by this IntentMap */
+ private String defaultProvideIntent;
+
+ /* Name of intent provided by this IntentMap */
+ private Collection<String> provideIntents = new ArrayList<String>();
+
+ /* Qualifiers of this IntentMap */
+ private Collection<Qualifier> qualifiers = new ArrayList<Qualifier>();
+
+ public IntentMap(String defaultProvideIntent, Collection<String> provideIntents) {
+ super();
+ this.defaultProvideIntent = defaultProvideIntent;
+ this.provideIntents.addAll(provideIntents);
+ }
+
+ public Collection<String> getProvideIntents() {
+ return unmodifiableCollection(provideIntents);
+ }
+
+ public void addQualifier(Qualifier qualifier) {
+ qualifiers.add(qualifier);
+ }
+
+ public Collection<Qualifier> getQualifiers() {
+ return unmodifiableCollection(qualifiers);
+ }
+
+ public String getDefaultProvideIntent() {
+ return defaultProvideIntent;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java
new file mode 100644
index 0000000000..eb69b44b37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.Arrays;
+
+/**
+ * Model class represents a name of a intent. An intent name has a domain name and one or more qualified names. For
+ * example, in "sec.confidentiality/message/body", the domain name is sec, and the qualified names are confidentiality,
+ * message and body
+ */
+@SuppressWarnings({"SerializableHasSerializationMethods"})
+public class IntentName implements java.io.Serializable {
+ private static final String QUALIFIED_SEPARATOR = "/";
+ private static final String DOMAIN_SEPARATOR = ".";
+ private static final long serialVersionUID = -7030021353149084879L;
+
+ /**
+ * domain of the intent
+ */
+ private String domain;
+
+ private String[] qualifiedNames;
+
+ /**
+ * Construct a IntentName from a string representation.
+ *
+ * @param intent string representation for a intent.
+ */
+ public IntentName(String intent) {
+ parse(intent);
+ }
+
+ /**
+ * Construct a IntentName from domain name and qualified names
+ *
+ * @param domain domain name of the intent
+ * @param qualifiedNames qualified names of the intent
+ */
+ public IntentName(String domain, String[] qualifiedNames) {
+ this.domain = domain;
+ this.qualifiedNames = qualifiedNames;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public String[] getQualifiedNames() {
+ String[] results = new String[qualifiedNames.length];
+ System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
+ return results;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final IntentName other = (IntentName) obj;
+ if (domain == null) {
+ if (other.domain != null) {
+ return false;
+ }
+ } else if (!domain.equals(other.domain)) {
+ return false;
+ }
+ return Arrays.equals(qualifiedNames, other.qualifiedNames);
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 17;
+ int result = 1;
+ result = PRIME * result + ((domain == null) ? 0 : domain.hashCode());
+ result = PRIME * result + Arrays.hashCode(qualifiedNames);
+ return result;
+ }
+
+ private String getName() {
+ StringBuilder sbd = new StringBuilder(domain);
+ for (int i = 0; i < qualifiedNames.length; i++) {
+ if (i == 0) {
+ sbd.append(DOMAIN_SEPARATOR);
+ } else {
+ sbd.append(QUALIFIED_SEPARATOR);
+ }
+ sbd.append(qualifiedNames[i]);
+ }
+
+ return sbd.toString();
+ }
+
+ /**
+ * Parse a string representation of intent.
+ *
+ * @param intent string representation of intent
+ */
+ private void parse(String intent) {
+ String iname = validateFormat(intent);
+ int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
+ domain = iname.substring(0, domainIdx);
+ String qualifNamesStr = iname.substring(domainIdx + 1);
+ qualifiedNames = qualifNamesStr.split(QUALIFIED_SEPARATOR);
+
+ }
+
+ private String validateFormat(String intent) {
+ // TODO validate and canonicalize intent name
+ return intent;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.java
new file mode 100644
index 0000000000..4e15e353c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/InteractionScope.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 org.apache.tuscany.spi.model;
+
+/**
+ * Represents the interaction scope specifed for a service
+ *
+ * @version $Rev$ $Date$
+ */
+public enum InteractionScope {
+ CONVERSATIONAL,
+ NONCONVERSATIONAL
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.java
new file mode 100644
index 0000000000..2d5a0802e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ModelObject.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.spi.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The base class for assembly model subtypes
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ModelObject {
+ private final Map<Object, Object> extensions = new HashMap<Object, Object>();
+
+ protected ModelObject() {
+ }
+
+ public Map<Object, Object> getExtensions() {
+ return extensions;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.java
new file mode 100644
index 0000000000..f7ec8759f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Multiplicity.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.spi.model;
+
+/**
+ * Enumeration for multiplicity.
+ */
+public enum Multiplicity {
+ /**
+ * Indicates a relationship that is optionally connected to the requestor and which, if supplied, must be connected
+ * to exactly one provider.
+ */
+ ZERO_ONE,
+
+ /**
+ * Indicates a relationship that must be connected between exactly one requestor and exactly one provider.
+ */
+ ONE_ONE,
+
+ /**
+ * Indicates a relationship that is optionally connects the requestor to zero to unbounded providers.
+ */
+ ZERO_N,
+
+ /**
+ * Indicates a relationship that must be connected at the requestor and which connects it to zero to unbounded
+ * providers.
+ */
+ ONE_N
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
new file mode 100644
index 0000000000..76e437276b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
@@ -0,0 +1,413 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents an operation that is part of a service contract. The type paramter of this operation identifies the
+ * logical type system for all data types.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Operation<T> extends ModelObject implements Cloneable {
+ public static final int NO_CONVERSATION = -1;
+ public static final int CONVERSATION_CONTINUE = 1;
+ public static final int CONVERSATION_END = 2;
+
+ protected Map<String, Object> metaData;
+ private final String name;
+ private ServiceContract<T> contract;
+ private final DataType<T> outputType;
+ private final DataType<List<DataType<T>>> inputType;
+ private final List<DataType<T>> faultTypes;
+ private String dataBinding;
+ private boolean wrapperStyle;
+ private WrapperInfo wrapper;
+ private boolean callback;
+ private boolean nonBlocking;
+ private int conversationSequence = NO_CONVERSATION;
+
+ /**
+ * Construct a minimally-specified operation
+ *
+ * @param name the name of the operation
+ * @param inputType the data types of parameters passed to the operation
+ * @param outputType the data type returned by the operation
+ * @param faultTypes the data type of faults raised by the operation
+ */
+ public Operation(String name,
+ DataType<List<DataType<T>>> inputType,
+ DataType<T> outputType,
+ List<DataType<T>> faultTypes) {
+ this(name, inputType, outputType, faultTypes, false, null, NO_CONVERSATION);
+ }
+
+ /**
+ * Construct an operation
+ *
+ * @param name the name of the operation
+ * @param inputType the data types of parameters passed to the operation
+ * @param outputType the data type returned by the operation
+ * @param faultTypes the data type of faults raised by the operation
+ * @param nonBlocking if the operation is non-blocking
+ * @param dataBinding the data-binding type required by the operation
+ * @param sequence the conversational attributes of the operation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
+ */
+ public Operation(final String name,
+ final DataType<List<DataType<T>>> inputType,
+ final DataType<T> outputType,
+ final List<DataType<T>> faultTypes,
+ boolean nonBlocking,
+ String dataBinding,
+ int sequence) {
+ super();
+ this.name = name;
+ List<DataType<T>> types = Collections.emptyList();
+ this.inputType = (inputType != null) ? inputType : new DataType<List<DataType<T>>>(Object[].class, types);
+ this.outputType = (outputType != null) ? outputType : new DataType<T>(void.class, null);
+ this.faultTypes = (faultTypes == null) ? types : faultTypes;
+ this.nonBlocking = nonBlocking;
+ this.dataBinding = dataBinding;
+ this.conversationSequence = sequence;
+ // Register the operation with the types
+ this.inputType.setOperation(this);
+ for (DataType<?> d : this.inputType.getLogical()) {
+ d.setOperation(this);
+ }
+ this.outputType.setOperation(this);
+ for (DataType<?> d : this.faultTypes) {
+ d.setOperation(this);
+ }
+ }
+
+ /**
+ * Returns the service contract the operation is part of.
+ *
+ * @return the service contract the operation is part of.
+ */
+ public ServiceContract<T> getServiceContract() {
+ return contract;
+ }
+
+ /**
+ * Sets the service contract the operation is part of.
+ *
+ * @param contract the service contract the operation is part of.
+ */
+ public void setServiceContract(ServiceContract<T> contract) {
+ this.contract = contract;
+ }
+
+ /**
+ * Returns true if the operation is part of the callback contract.
+ *
+ * @return true if the operation is part of the callback contract.
+ */
+ public boolean isCallback() {
+ return callback;
+ }
+
+ /**
+ * Sets whether the operation is part of the callback contract.
+ *
+ * @param callback whether the operation is part of the callback contract.
+ */
+ public void setCallback(boolean callback) {
+ this.callback = callback;
+ }
+
+ /**
+ * Returns the name of the operation.
+ *
+ * @return the name of the operation
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the data type returned by the operation.
+ *
+ * @return the data type returned by the operation
+ */
+ public DataType<T> getOutputType() {
+ return outputType;
+ }
+
+ /**
+ * Returns the data types of the parameters passed to the operation.
+ * <p/>
+ * The inputType's logical type is a list of DataTypes which describes the parameter types
+ *
+ * @return the data types of the parameters passed to the operation
+ */
+ public DataType<List<DataType<T>>> getInputType() {
+ return inputType;
+ }
+
+ /**
+ * Returns the data types of the faults raised by the operation.
+ *
+ * @return the data types of the faults raised by the operation
+ */
+ public List<DataType<T>> getFaultTypes() {
+ if (faultTypes == null) {
+ return Collections.emptyList();
+ }
+ return faultTypes;
+ }
+
+ /**
+ * Returns true if the operation is non-blocking. A non-blocking operation may not have completed execution at the
+ * time an invocation of the operation returns.
+ *
+ * @return true if the operation is non-blocking
+ */
+ public boolean isNonBlocking() {
+ return nonBlocking;
+ }
+
+ /**
+ * Sets if the operation is non-blocking
+ */
+ public void setNonBlocking(boolean nonBlocking) {
+ this.nonBlocking = nonBlocking;
+ }
+
+ /**
+ * Returns the sequence the operation is called in a conversation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
+ *
+ * @return the sequence the operation is called in a conversation
+ */
+ public int getConversationSequence() {
+ return conversationSequence;
+ }
+
+ /**
+ * Sets the sequence the operation is called in a conversation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
+ */
+ public void setConversationSequence(int conversationSequence) {
+ this.conversationSequence = conversationSequence;
+ }
+
+ /**
+ * Returns the data binding type specified for the operation or null.
+ *
+ * @return the data binding type specified for the operation or null.
+ */
+ public String getDataBinding() {
+ return (dataBinding == null && contract != null) ? contract.getDataBinding() : dataBinding;
+ }
+
+ /**
+ * Set the databinding for this operation
+ *
+ * @param dataBinding The databinding
+ */
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ /**
+ * Returns a map of metadata key to value mappings for the operation.
+ *
+ * @return a map of metadata key to value mappings for the operation.
+ */
+ public Map<String, Object> getMetaData() {
+ if (metaData == null) {
+ return Collections.emptyMap();
+ }
+ return metaData;
+ }
+
+ /**
+ * Adds metadata associated with the operation.
+ *
+ * @param key the metadata key
+ * @param val the metadata value
+ */
+ public void setMetaData(String key, Object val) {
+ if (metaData == null) {
+ metaData = new HashMap<String, Object>();
+ }
+ metaData.put(key, val);
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final Operation operation = (Operation) o;
+
+ if (name != null ? !name.equals(operation.name) : operation.name != null) {
+ return false;
+ }
+
+ // HACK: If the operation is mappable, then the equality test is relaxed
+ if (isMappable()) {
+ return true;
+ }
+
+ // TODO: TUSCANY-1111, currently comparing different IDLs fail
+ if (contract != null && !(contract.getClass().equals(operation.getServiceContract().getClass()))) {
+ return true;
+ }
+
+ if (faultTypes == null && operation.faultTypes != null) {
+ return false;
+ } else if (faultTypes != null
+ && operation.faultTypes != null
+ && faultTypes.size() != 0
+ && operation.faultTypes.size() != 0) {
+ if (faultTypes.size() < operation.faultTypes.size()) {
+ return false;
+ } else {
+ //noinspection ForLoopReplaceableByForEach
+ for (int i = 0; i < operation.faultTypes.size(); i++) {
+ if (!faultTypes.get(i).equals(operation.faultTypes.get(i))) {
+ return false;
+ }
+ }
+ }
+ }
+
+ if (inputType != null ? !inputType.equals(operation.inputType) : operation.inputType != null) {
+ return false;
+ }
+ return !(outputType != null ? !outputType.equals(operation.outputType) : operation.outputType != null);
+ }
+
+ public int hashCode() {
+ int result;
+ result = name != null ? name.hashCode() : 0;
+ // HACK:
+ if (isMappable()) {
+ return result;
+ }
+ result = 29 * result + (outputType != null ? outputType.hashCode() : 0);
+ result = 29 * result + (inputType != null ? inputType.hashCode() : 0);
+ result = 29 * result + (faultTypes != null ? faultTypes.hashCode() : 0);
+ return result;
+ }
+
+ /**
+ * Returns true if the operation may be mapped to another target operation through an mediation
+ */
+ private boolean isMappable() {
+ if (contract != null) {
+ return contract.isRemotable();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns true if the operation is wrapper style
+ *
+ * @return the wrapperStyle
+ */
+ public boolean isWrapperStyle() {
+ return wrapperStyle;
+ }
+
+ /**
+ * Return the Wrapper information for this operation is it's wrapper style
+ *
+ * @return The Wrapper
+ */
+ public WrapperInfo getWrapper() {
+ if (!isWrapperStyle()) {
+ throw new IllegalStateException("The operation is not wrapper style.");
+ } else {
+ return wrapper;
+ }
+ }
+
+ /**
+ * @param wrapper the wrapper to set
+ */
+ public void setWrapper(WrapperInfo wrapper) {
+ this.wrapper = wrapper;
+ }
+
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ public void setWrapperStyle(boolean wrapperStyle) {
+ this.wrapperStyle = wrapperStyle;
+ }
+
+ @SuppressWarnings({"unchecked", "CloneDoesntCallSuperClone"})
+ @Override
+ public Operation<T> clone() throws CloneNotSupportedException {
+ final List<DataType<T>> clonedFaultTypes = new ArrayList<DataType<T>>(this.faultTypes.size());
+ for (DataType<T> t : this.faultTypes) {
+ clonedFaultTypes.add((DataType<T>) t.clone());
+ }
+
+ List<DataType<T>> clonedTypes = new ArrayList<DataType<T>>();
+ for (DataType<T> t : inputType.getLogical()) {
+ DataType<T> type = (DataType<T>) t.clone();
+ clonedTypes.add(type);
+ }
+
+ DataType<List<DataType<T>>> clonedInputType =
+ new DataType<List<DataType<T>>>(inputType.getPhysical(), clonedTypes);
+ clonedInputType.setDataBinding(inputType.getDataBinding());
+
+ DataType<T> outputType = (DataType<T>) this.outputType.clone();
+ Operation<T> copy =
+ new Operation<T>(name,
+ clonedInputType,
+ outputType,
+ clonedFaultTypes,
+ nonBlocking,
+ dataBinding,
+ conversationSequence);
+
+ copy.callback = this.callback;
+ copy.contract = this.contract;
+ copy.wrapper = this.wrapper;
+ copy.wrapperStyle = this.wrapperStyle;
+
+ if (this.metaData != null) {
+ assert this.metaData instanceof HashMap;
+ copy.metaData = (HashMap) ((HashMap) this.metaData).clone();
+ }
+ return copy;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.java
new file mode 100644
index 0000000000..cc86b2670a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/OverrideOptions.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.spi.model;
+
+/**
+ * <ul>
+ * <li>no – the value may not be overridden by the higher composite. In this
+ * case, a value must be provided for the reference or property as part of its
+ * declaration.
+ * <li>may – the value may be overridden by the composite. This is the default
+ * for references.
+ * <li>must – no value is specified and the using composite must specify one.
+ * </ul>
+ */
+public enum OverrideOptions {
+ NO, MAY, MUST
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachable.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachable.java
new file mode 100644
index 0000000000..eae425dca8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachable.java
@@ -0,0 +1,21 @@
+package org.apache.tuscany.spi.model;
+
+import java.util.Collection;
+/**
+*
+* Represents capability of being attached with Intent and PolicySet.
+*
+*/
+public interface PolicyAttachable {
+ /**
+ * Get the name of PolicySet attached
+ * @return the name of PolicySet
+ */
+ String getPolicySet();
+ /**
+ * Get collection contains <code>IntentName</code> required.
+ * @return collection contains <code>IntentName</code> required.
+ */
+ Collection<IntentName> getRequiredIntents();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachableModel.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachableModel.java
new file mode 100644
index 0000000000..3ebbfb16d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyAttachableModel.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.spi.model;
+
+import java.util.Collection;
+
+/**
+ * Base class for model classes which can be associated with Intent and PolicySet by specifing requires and policySet
+ * attributes on xml element.
+ */
+
+public abstract class PolicyAttachableModel extends ModelObject implements PolicyAttachable {
+ protected Collection<IntentName> requiredIntent;
+ protected String policySet;
+
+ public String getPolicySet() {
+ return policySet;
+ }
+
+ public void setPolicySet(String policySet) {
+ this.policySet = policySet;
+ }
+
+ public Collection<IntentName> getRequiredIntents() {
+ return requiredIntent;
+ }
+
+ public void addRequiredIntent(IntentName requiredIntent) {
+ this.requiredIntent.add(requiredIntent);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java
new file mode 100644
index 0000000000..7d2412ee8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.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.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+
+/**
+ * PolicyModel which contains concrete policy content in form of WSPolicyAttachment or other extensions.
+ */
+public abstract class PolicyContentModel extends PolicyModel {
+ /* WSPolicyAttachment contained in this Model */
+ protected Collection<WSPolicyAttachment> wsPolicyAttachments = new ArrayList<WSPolicyAttachment>();
+ /* Any policy model extensions besides standard intentMap, ws-policyattachment, etc. */
+ protected Collection<PolicyModel> extensions = new ArrayList<PolicyModel>();
+
+ public Collection<PolicyModel> getPolicyExtensions() {
+ return extensions;
+ }
+
+ public Collection<WSPolicyAttachment> getWsPolicyAttachments() {
+ return unmodifiableCollection(wsPolicyAttachments);
+ }
+
+ public void addWsPolicyAttachment(WSPolicyAttachment attachment) {
+ wsPolicyAttachments.add(attachment);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java
new file mode 100644
index 0000000000..17bd8f0b7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicyModel.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 org.apache.tuscany.spi.model;
+
+
+/**
+ * An abstract base class for all policy model representations.
+ * <p/>
+ * $Version$ $Date$
+ */
+public abstract class PolicyModel extends ModelObject {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
new file mode 100644
index 0000000000..7545f234e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
@@ -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.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Model representation for PolicySet.
+ * <p/>
+ * $Rev$ $Date$
+ */
+public class PolicySet extends PolicyContentModel {
+
+ /**
+ * QNames of artifacts to which this Policy can apply
+ */
+ protected List<QName> appliedArtifacts = new ArrayList<QName>();
+
+ /**
+ * IntentMap contained in this PolicySet
+ */
+ private Collection<IntentMap> intentMaps = new ArrayList<IntentMap>();
+
+ /**
+ * Name for PolicySet, corresponding to name attribute of PolicySet element in SCDL
+ */
+ private QName name;
+
+ /**
+ * References to other PolicySet
+ */
+ private Collection<PolicySetReference> policySetReferences = new ArrayList<PolicySetReference>();
+
+ /**
+ * Name of intents provided by this PolicySet
+ */
+ private Collection<IntentName> provideIntents = new ArrayList<IntentName>();
+
+ public PolicySet(QName name, List<IntentName> providesIntent) {
+ super();
+ this.name = name;
+ this.provideIntents.addAll(providesIntent);
+ }
+
+
+ public void addPolicySetReference(PolicySetReference ref) {
+ policySetReferences.add(ref);
+ }
+
+ public void addAppliedArtifacts(QName artifactName) {
+ appliedArtifacts.add(artifactName);
+ }
+
+ public List<QName> getAppliedArtifacts() {
+ return unmodifiableList(appliedArtifacts);
+ }
+
+ public void addIntentMap(IntentMap intentMap) {
+ intentMaps.add(intentMap);
+ }
+
+ public Collection<IntentMap> getIntentMaps() {
+ return unmodifiableCollection(intentMaps);
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public Collection<PolicySetReference> getPolicySetReferences() {
+ return unmodifiableCollection(policySetReferences);
+ }
+
+ public Collection<IntentName> getProvideIntents() {
+ return unmodifiableCollection(provideIntents);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java
new file mode 100644
index 0000000000..46924910d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.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.spi.model;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Presents a PolicySetReference.
+ */
+public class PolicySetReference extends PolicyModel {
+
+ private QName reference;
+
+ public PolicySetReference(QName reference) {
+ super();
+ this.reference = reference;
+ }
+
+ public QName getReference() {
+ return reference;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java
new file mode 100644
index 0000000000..dff7ee897b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.w3c.dom.Element;
+
+/**
+ * A component property
+ *
+ * @version $Rev$ $Date$
+ */
+public class Property<T> extends ModelObject {
+ private String name;
+ private ObjectFactory<?> defaultValueFactory;
+ private QName xmlType;
+ private QName xmlElement;
+ private Class<T> javaType;
+ private boolean many;
+ private boolean mustSupply;
+ private List<Element> defaultValues;
+
+
+ public Property() {
+ mustSupply = false;
+ many = false;
+ }
+
+ public Property(String name, QName xmlType, Class<T> javaType) {
+ this.name = name;
+ this.xmlType = xmlType;
+ this.javaType = javaType;
+ mustSupply = false;
+ many = false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ObjectFactory<?> getDefaultValueFactory() {
+ return defaultValueFactory;
+ }
+
+ public void setDefaultValueFactory(ObjectFactory<T> factory) {
+ this.defaultValueFactory = factory;
+ }
+
+ public void setDefaultMultiValueFactory(ObjectFactory<List<T>> factory) {
+ this.defaultValueFactory = factory;
+ }
+
+ public QName getXmlType() {
+ return xmlType;
+ }
+
+ public void setXmlType(QName xmlType) {
+ this.xmlType = xmlType;
+ }
+
+ public Class<T> getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(Class<T> javaType) {
+ this.javaType = javaType;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public boolean isMustSupply() {
+ return mustSupply;
+ }
+
+ public void setMustSupply(boolean mustSupply) {
+ this.mustSupply = mustSupply;
+ }
+
+ /*public Document getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(Document defaultValue) {
+ this.defaultValue = defaultValue;
+ }*/
+
+ public QName getXmlElement() {
+ return xmlElement;
+ }
+
+ public void setXmlElement(QName xmlElement) {
+ this.xmlElement = xmlElement;
+ }
+
+ public List<Element> getDefaultValues() {
+ return defaultValues;
+ }
+
+ public void setDefaultValues(List<Element> defaultValues) {
+ this.defaultValues = defaultValues;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java
new file mode 100644
index 0000000000..209be4d13a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PropertyValue.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.w3c.dom.Element;
+
+/**
+ * Represents a configured component property
+ * @version $Rev$ $Date$
+ */
+public class PropertyValue<T> extends ModelObject {
+ private String name;
+ private String source;
+ private String file;
+ private List<Element> value;
+ private ObjectFactory<?> valueFactory;
+
+ public PropertyValue() {
+ }
+
+ /**
+ * Constructor specifying the name of a property and the XPath source expression.
+ *
+ * @param name the name of the property which this value is for
+ * @param source an XPath expression whose result will be the actual value
+ * @param file A URI that the property value can be loaded from
+ */
+ public PropertyValue(String name, String source, String file) {
+ this.name = name;
+ this.source = source;
+ this.file = file;
+ }
+
+ /**
+ * @param name
+ * @param value
+ */
+ public PropertyValue(String name, List<Element> value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public PropertyValue(String name, ObjectFactory<?> valueFactory) {
+ this.name = name;
+ this.valueFactory = valueFactory;
+ }
+
+ /**
+ * Returns the name of the property that this value is for.
+ * @return the name of the property that this value is for
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the property that this value is for.
+ * @param name the name of the property that this value is for
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns an XPath expression that should be evaluated to get the actual property value.
+ *
+ * @return an XPath expression that should be evaluated to get the actual property value
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * Sets an XPath expression that should be evaluated to get the actual property value.
+ * @param source an XPath expression that should be evaluated to get the actual property value
+ */
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public ObjectFactory<?> getValueFactory() {
+ return valueFactory;
+ }
+
+ public void setValueFactory(ObjectFactory<?> valueFactory) {
+ this.valueFactory = valueFactory;
+ }
+
+ public void setMultiValueFactory(ObjectFactory<List<T>> valueFactory) {
+ this.valueFactory = valueFactory;
+ }
+
+
+ public List<Element> getValue() {
+ return value;
+ }
+
+ public void setValue(List<Element> value) {
+ this.value = value;
+ }
+
+ /**
+ * @return the file
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * @param file the file to set
+ */
+ public void setFile(String file) {
+ this.file = file;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java
new file mode 100644
index 0000000000..8a7d709bd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.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.spi.model;
+
+/**
+ * Model reprentation for qualifier
+ */
+
+public class Qualifier extends PolicyContentModel {
+
+ private String name;
+
+ /**
+ * IntentMap contained in this Qualifier
+ */
+ private IntentMap intentMap;
+
+ public Qualifier(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IntentMap getIntentMap() {
+ return intentMap;
+ }
+
+ public void setIntentMap(IntentMap intentMap) {
+ this.intentMap = intentMap;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java
new file mode 100644
index 0000000000..db0bdb2b22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.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.spi.model;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents the set of targets configured on a reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceTarget extends ModelObject {
+ private String referenceName;
+ private List<URI> targets = new ArrayList<URI>();
+
+ public String getReferenceName() {
+ return referenceName;
+ }
+
+ public void setReferenceName(String referenceName) {
+ this.referenceName = referenceName;
+ }
+
+ public List<URI> getTargets() {
+ return targets;
+ }
+
+ public void addTarget(URI target) {
+ targets.add(target);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.java
new file mode 100644
index 0000000000..a53b26d2ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Scope.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.spi.model;
+
+/**
+ * The default implementation scopes supported by assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Scope {
+ public static final Scope STATELESS = new Scope("STATELESS");
+ public static final Scope REQUEST = new Scope("REQUEST");
+ public static final Scope SESSION = new Scope("SESSION");
+ public static final Scope CONVERSATION = new Scope("CONVERSATION");
+ public static final Scope COMPOSITE = new Scope("COMPOSITE");
+ public static final Scope SYSTEM = new Scope("SYSTEM");
+ public static final Scope UNDEFINED = new Scope("UNDEFINED");
+
+ private String scope;
+
+ public Scope(String scope) {
+ this.scope = scope.toUpperCase().intern();
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ @SuppressWarnings({"StringEquality"})
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Scope scope1 = (Scope) o;
+ return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
+ }
+
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
new file mode 100644
index 0000000000..2a1316139c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.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.spi.model;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Base class representing service contract information
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ServiceContract<T> extends ModelObject implements Cloneable {
+ protected InteractionScope interactionScope;
+ protected boolean remotable;
+ protected Class<?> interfaceClass;
+ protected String interfaceName;
+ protected String callbackName;
+ protected Class<?> callbackClass;
+ protected Map<String, Operation<T>> operations;
+ protected Map<String, Operation<T>> callbackOperations;
+ protected String dataBinding;
+ protected Map<String, Object> metaData;
+
+ protected ServiceContract() {
+ }
+
+ protected ServiceContract(Class<?> interfaceClass) {
+ this.interfaceClass = interfaceClass;
+ }
+
+ protected ServiceContract(String interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ /**
+ * Returns the interface name for the contract
+ *
+ * @return the interface name for the contract
+ */
+ public String getInterfaceName() {
+ return interfaceName;
+ }
+
+ /**
+ * Sets the interface name for the contract
+ */
+ public void setInterfaceName(String interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ /**
+ * Returns the class used to represent the service contract
+ */
+ public Class<?> getInterfaceClass() {
+ return interfaceClass;
+ }
+
+ /**
+ * Sets the class used to represent the service contract
+ */
+ public void setInterfaceClass(Class<?> interfaceClass) {
+ this.interfaceClass = interfaceClass;
+ }
+
+ /**
+ * Returns the service interaction scope
+ */
+ public InteractionScope getInteractionScope() {
+ return interactionScope;
+ }
+
+ /**
+ * Sets the service interaction scope
+ */
+ public void setInteractionScope(InteractionScope interactionScope) {
+ this.interactionScope = interactionScope;
+ }
+
+ /**
+ * @return the remotable
+ */
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ /**
+ * @param remotable the remotable to set
+ */
+ public void setRemotable(boolean remotable) {
+ this.remotable = remotable;
+ }
+
+ /**
+ * Returns the name of the callback or null if the contract is unidirectional
+ */
+ public String getCallbackName() {
+ return callbackName;
+ }
+
+ /**
+ * Sets the name of the callback service
+ */
+ public void setCallbackName(String callbackName) {
+ this.callbackName = callbackName;
+ }
+
+ /**
+ * Returns the name of the callback service
+ */
+ public Class<?> getCallbackClass() {
+ return callbackClass;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ this.callbackClass = callbackClass;
+ }
+
+ public Operation getOperation(String name) {
+ return operations == null ? null : operations.get(name);
+ }
+
+ public Map<String, Operation<T>> getOperations() {
+ if (operations == null) {
+ return Collections.emptyMap();
+ }
+ return Collections.unmodifiableMap(operations);
+ }
+
+ public void setOperations(Map<String, Operation<T>> operations) {
+ for (Operation<T> operation : operations.values()) {
+ operation.setServiceContract(this);
+ }
+ this.operations = operations;
+ }
+
+ public Map<String, Operation<T>> getCallbackOperations() {
+ if (callbackOperations == null) {
+ return Collections.emptyMap();
+ }
+ return Collections.unmodifiableMap(callbackOperations);
+ }
+
+ public void setCallbackOperations(Map<String, Operation<T>> callbacksOperations) {
+ for (Operation<T> operation : callbacksOperations.values()) {
+ operation.setServiceContract(this);
+ operation.setCallback(true);
+ }
+ this.callbackOperations = callbacksOperations;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ /**
+ * Returns a map of metadata key to value mappings for the operation.
+ *
+ * @return a map of metadata key to value mappings for the operation.
+ */
+ public Map<String, Object> getMetaData() {
+ if (metaData == null) {
+ return Collections.emptyMap();
+ }
+ return metaData;
+ }
+
+ /**
+ * Adds metadata associated with the operation.
+ *
+ * @param key the metadata key
+ * @param val the metadata value
+ */
+ public void setMetaData(String key, Object val) {
+ if (metaData == null) {
+ metaData = new HashMap<String, Object>();
+ }
+ metaData.put(key, val);
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final ServiceContract that = (ServiceContract) o;
+
+ if (callbackName != null ? !callbackName.equals(that.callbackName) : that.callbackName != null) {
+ return false;
+ }
+ if (callbackOperations != null ? !callbackOperations.equals(that.callbackOperations)
+ : that.callbackOperations != null) {
+ return false;
+ }
+ if (interfaceClass != null ? !interfaceClass.equals(that.interfaceClass) : that.interfaceClass != null) {
+ return false;
+ }
+ if (interfaceName != null ? !interfaceName.equals(that.interfaceName) : that.interfaceName != null) {
+ return false;
+ }
+ return !(operations != null ? !operations.equals(that.operations) : that.operations != null);
+
+ }
+
+ public int hashCode() {
+ int result;
+ result = interfaceClass != null ? interfaceClass.hashCode() : 0;
+ result = 29 * result + (interfaceName != null ? interfaceName.hashCode() : 0);
+ result = 29 * result + (callbackName != null ? callbackName.hashCode() : 0);
+ result = 29 * result + (operations != null ? operations.hashCode() : 0);
+ result = 29 * result + (callbackOperations != null ? callbackOperations.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ if (interfaceName != null) {
+ return new StringBuilder().append("ServiceContract[").append(interfaceName).append("]").toString();
+ } else if (interfaceClass != null) {
+ return new StringBuilder().append("ServiceContract[").append(interfaceClass.getName()).append("]")
+ .toString();
+ } else {
+ return super.toString();
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ServiceContract<T> copy = (ServiceContract<T>) super.clone();
+
+ if (operations != null) {
+ Map<String, Operation<T>> clonedOperations = new HashMap<String, Operation<T>>();
+ for (Operation<T> o : operations.values()) {
+ clonedOperations.put(o.getName(), (Operation<T>) o.clone());
+ }
+ copy.setOperations(clonedOperations);
+ }
+
+ if (callbackOperations != null) {
+ Map<String, Operation<T>> clonedCallbackOperations = new HashMap<String, Operation<T>>();
+ for (Operation<T> o : callbackOperations.values()) {
+ clonedCallbackOperations.put(o.getName(), (Operation<T>) o.clone());
+ }
+ copy.setCallbackOperations(clonedCallbackOperations);
+ }
+
+ if (this.metaData != null) {
+ assert this.metaData instanceof HashMap;
+ copy.metaData = (HashMap) ((HashMap) this.metaData).clone();
+ }
+
+ return copy;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java
new file mode 100644
index 0000000000..6740902c8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.model;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Represents a service offered by a component
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceDefinition extends ModelObject {
+ private String name;
+ private ServiceContract serviceContract;
+ private boolean remotable;
+ private String callbackRefName;
+ private List<BindingDefinition> bindings;
+ private URI target;
+
+ public ServiceDefinition() {
+ bindings = new ArrayList<BindingDefinition>();
+ }
+
+ public ServiceDefinition(String name, ServiceContract serviceContract, boolean remotable) {
+ bindings = new ArrayList<BindingDefinition>();
+ this.name = name;
+ this.serviceContract = serviceContract;
+ this.remotable = remotable;
+ }
+
+ public ServiceDefinition(String name, ServiceContract serviceContract, boolean remotable, String callbackRefName) {
+ bindings = new ArrayList<BindingDefinition>();
+ this.name = name;
+ this.serviceContract = serviceContract;
+ this.remotable = remotable;
+ this.callbackRefName = callbackRefName;
+ }
+
+ /**
+ * Returns the service name
+ *
+ * @return the service name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the service name
+ *
+ * @param name the service name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the service contract
+ *
+ * @return the service contract
+ */
+ public ServiceContract<?> getServiceContract() {
+ return serviceContract;
+ }
+
+ /**
+ * Sets the service contract
+ *
+ * @param contract the service contract
+ */
+ public void setServiceContract(ServiceContract contract) {
+ this.serviceContract = contract;
+ }
+
+ /**
+ * Returns true if the service is remotable
+ *
+ * @return true if the service is remotable
+ */
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ /**
+ * Sets if the service is remotable
+ *
+ * @param remotable if the service is remotable
+ */
+ public void setRemotable(boolean remotable) {
+ this.remotable = remotable;
+ }
+
+ /**
+ * Returns the callback name.
+ */
+ public String getCallbackReferenceName() {
+ return callbackRefName;
+ }
+
+ /**
+ * Sets the callback name
+ */
+ public void setCallbackReferenceName(String name) {
+ this.callbackRefName = name;
+ }
+
+ /**
+ * Returns the bindings configured for the service
+ *
+ * @return the bindings configured for the service
+ */
+ public List<BindingDefinition> getBindings() {
+ return Collections.unmodifiableList(bindings);
+ }
+
+ /**
+ * Configures the service with a binding
+ *
+ * @param binding the binding
+ */
+ public void addBinding(BindingDefinition binding) {
+ this.bindings.add(binding);
+ }
+
+ /**
+ * Returns the target URI the service is wired to
+ *
+ * @return the target URI the service is wired to
+ */
+ public URI getTarget() {
+ return target;
+ }
+
+ /**
+ * Sets the target URI the service is wired to
+ *
+ * @param target the target URI the service is wired to
+ */
+ public void setTarget(URI target) {
+ this.target = target;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java
new file mode 100644
index 0000000000..ff1a6cf791
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.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.spi.model;
+
+/*
+ * Presents a ws-policy attachment.
+ */
+public class WSPolicyAttachment<T> extends PolicyModel {
+ private T content;
+
+ public T getContent() {
+ return content;
+ }
+
+ public void setContent(T content) {
+ this.content = content;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.java
new file mode 100644
index 0000000000..7ae91811b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WireDefinition.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.spi.model;
+
+import java.net.URI;
+
+/**
+ * Represents a wire specified in an assembly
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireDefinition extends ModelObject {
+ private URI source;
+ private URI target;
+
+ public URI getSource() {
+ return source;
+ }
+
+ public void setSource(URI source) {
+ this.source = source;
+ }
+
+ public URI getTarget() {
+ return target;
+ }
+
+ public void setTarget(URI target) {
+ this.target = target;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java
new file mode 100644
index 0000000000..d66d09bcf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.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.spi.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.idl.ElementInfo;
+import org.apache.tuscany.spi.idl.XMLType;
+
+/**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based
+ * Web Services (JAX-WS) 2.0 specification, section 2.3.1.2 Wrapper Style. <p/>
+ * A WSDL operation qualifies for wrapper style mapping only if the following
+ * criteria are met:
+ * <ul>
+ * <li>(i) The operation’s input and output messages (if present) each contain
+ * only a single part
+ * <li>(ii) The input message part refers to a global element declaration whose
+ * localname is equal to the operation name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(iv) The elements referred to by the input and output message parts
+ * (henceforth referred to as wrapper elements) are both complex types defined
+ * using the xsd:sequence compositor
+ * <li>(v) The wrapper elements only contain child elements, they must not
+ * contain other structures such as wildcards (element or attribute),
+ * xsd:choice, substitution groups (element references are not permitted) or
+ * attributes; furthermore, they must not be nillable.
+ * </ul>
+ *
+ * @version $Rev$ $Date$
+ */
+public class WrapperInfo {
+ private ElementInfo inputWrapperElement;
+
+ private ElementInfo outputWrapperElement;
+
+ private List<ElementInfo> inputChildElements;
+
+ private List<ElementInfo> outputChildElements;
+
+ private DataType<List<DataType<XMLType>>> unwrappedInputType;
+
+ private DataType<XMLType> unwrappedOutputType;
+
+ private String dataBinding;
+
+ public WrapperInfo(String dataBinding,
+ ElementInfo inputWrapperElement,
+ ElementInfo outputWrapperElement,
+ List<ElementInfo> inputElements,
+ List<ElementInfo> outputElements) {
+ super();
+ this.dataBinding = dataBinding;
+ this.inputWrapperElement = inputWrapperElement;
+ this.outputWrapperElement = outputWrapperElement;
+ this.inputChildElements = inputElements;
+ this.outputChildElements = outputElements;
+ }
+
+ /**
+ * @return the inputElements
+ */
+ public List<ElementInfo> getInputChildElements() {
+ return inputChildElements;
+ }
+
+ /**
+ * @return the inputWrapperElement
+ */
+ public ElementInfo getInputWrapperElement() {
+ return inputWrapperElement;
+ }
+
+ /**
+ * @return the outputElements
+ */
+ public List<ElementInfo> getOutputChildElements() {
+ return outputChildElements;
+ }
+
+ /**
+ * @return the outputWrapperElement
+ */
+ public ElementInfo getOutputWrapperElement() {
+ return outputWrapperElement;
+ }
+
+ /**
+ * @return the unwrappedInputType
+ */
+ public DataType<List<DataType<XMLType>>> getUnwrappedInputType() {
+ if (unwrappedInputType == null) {
+ List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
+ for (ElementInfo element : getInputChildElements()) {
+ DataType<XMLType> type = new DataType<XMLType>(dataBinding, Object.class, new XMLType(element));
+ // type.setMetadata(ElementInfo.class.getName(),
+ // getElementInfo(element));
+ childTypes.add(type);
+ }
+ unwrappedInputType =
+ new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ /**
+ * @return the unwrappedOutputType
+ */
+ public DataType<XMLType> getUnwrappedOutputType() {
+ if (unwrappedOutputType == null) {
+ List<ElementInfo> elements = getOutputChildElements();
+ if (elements != null && elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new IllegalArgumentException("Multi-part output is not supported");
+ }
+ ElementInfo element = elements.get(0);
+ unwrappedOutputType = new DataType<XMLType>(dataBinding, Object.class, new XMLType(element));
+ }
+ }
+ return unwrappedOutputType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java
new file mode 100644
index 0000000000..8517977f0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.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.spi.policy;
+
+import java.util.Collection;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+
+/**
+ * The registry for intents.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface IntentRegistry {
+
+ /**
+ * Register a intent.
+ *
+ * @param intent intent to register
+ */
+ void register(Intent intent);
+
+ /**
+ * Unregister a intent.
+ *
+ * @param intent intent to unregister
+ */
+ void unRegister(Intent intent);
+
+ /**
+ * Replace the profile intents in intentNameList with the real concrete intent.
+ *
+ * @param intentNameList intent list that may contains profile intents
+ * @param artifact QName of SCA artifact
+ * @return concrete intents list
+ */
+ Collection<IntentName> inlineProfileIntent(Collection<IntentName> intentNameList, QName artifact);
+
+ /**
+ * Whether the intent is appplicable for specified SCA artifact.
+ *
+ * @param intentName name of intent
+ * @param artifact QName of SCA artifact
+ * @return Whether the intent is appplicable for specified SCA artifact
+ */
+ boolean isApplicable(IntentName intentName, QName artifact);
+
+ /**
+ * Get a list including all qualified intents for a qulifiable intent.
+ *
+ * @param qualifiable qualifiable intent
+ * @param artifact QName of SCA artifact
+ * @return list including all qualified intents for a qulifiable intent.
+ */
+ Collection<IntentName> getQualifiedIntents(IntentName qualifiable, QName artifact);
+
+ /**
+ * Whether the intent is a qualified.
+ *
+ * @param name intent name.
+ * @return whether the intent is a qualified
+ */
+ boolean isQualifiedIntent(IntentName name);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.java
new file mode 100644
index 0000000000..d65bc3edf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyBuilderRegistry.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.spi.policy;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * A registry for policy builders that dispatches to the appropriate builder when converting an assembly to runtime
+ * artifacts. Policy builders operate on either a source- or target-side wires.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyBuilderRegistry {
+
+ int INITIAL = 0;
+ int EXTENSION = 1;
+ int FINAL = 2;
+
+ /**
+ * Registers a target-side policy builder. Called by extensions to register their builders.
+ *
+ * @param phase the phase hwne the builder must be run
+ * @param builder the builder to register
+ */
+ void registerTargetBuilder(int phase, TargetPolicyBuilder builder);
+
+ /**
+ * Registers a source-side policy builder. Called by extensions to register their builders.
+ *
+ * @param phase the phase hwne the builder must be run
+ * @param builder the builder to register
+ */
+ void registerSourceBuilder(int phase, SourcePolicyBuilder builder);
+
+ /**
+ * Evaluates source-side policy metadata for referenceDefinition and updates the curresponding collection of wire
+ * configurations
+ *
+ * @throws BuilderException
+ */
+ void buildSource(AbstractReferenceDefinition referenceDefinition, OutboundWire wire) throws BuilderException;
+
+ /**
+ * Evaluates target-side policy metadata for configured reference and updates the curresponding collection of wire
+ * configurations
+ *
+ * @throws BuilderException
+ */
+ void buildTarget(ServiceDefinition serviceDefinition, InboundWire wire) throws BuilderException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java
new file mode 100644
index 0000000000..fd4ba129d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.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.spi.policy;
+
+import java.util.Collection;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.model.PolicyModel;
+
+/**
+ * Responsible for matching concrete policy artifacts required by abstract intent name.
+ */
+public interface PolicyEngine {
+
+ /**
+ * Retrieve policies which match the intents requirement on a SCA artifact. See SCA policy frame spec. 1.4.5 Guided
+ * Selection of PolicySets using Intents
+ *
+ * @param requires Intent names requred by the SCA artifact
+ * @param policySetName PolicySet names specify on the SCA artifact explicitly
+ * @param artifactType QName of SCA artifact type, which may be a abstract artifact type
+ * @return Collection contains all policy matching the intent requirement
+ */
+ Collection<PolicyModel> getPolicy(IntentName[] requires, QName[] policySetName, QName artifactType);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java
new file mode 100644
index 0000000000..f7a9e0922a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.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.spi.policy;
+
+import java.util.Collection;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.PolicySet;
+
+/**
+ * The host for PolicySet.
+ */
+public interface PolicySetContainer {
+
+ /**
+ * Get all PolicySet of this container
+ *
+ * @return Collection contains all PolicySet of this container
+ */
+ Collection<PolicySet> getAllPolicySet();
+
+ /**
+ * Get PolicySet by name.
+ *
+ * @param name QName of PolicySet.
+ * @return PolicySet with specified name
+ */
+ PolicySet getPolicySet(QName name);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java
new file mode 100644
index 0000000000..3a5127f014
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.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 org.apache.tuscany.spi.policy;
+
+import javax.xml.namespace.QName;
+
+public interface SCATypeManager {
+
+ /**
+ * Whether the <code>subType</code> is a sub type of <code>type</code> or the type itself.
+ */
+ boolean isTypeOf(QName subType, QName type);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.java
new file mode 100644
index 0000000000..5e2c152052
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilder.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.spi.policy;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+/**
+ * Implementations contribute {@link org.apache.tuscany.spi.wire.Interceptor}s to handle source-side policy on a wire.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface SourcePolicyBuilder {
+
+ /**
+ * Callback for attaching policy to a source-side wire
+ *
+ * @param definition the service definition
+ * @param wire the wire to attach policy to
+ * @throws BuilderException
+ */
+ void build(AbstractReferenceDefinition definition, OutboundWire wire) throws BuilderException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtension.java
new file mode 100644
index 0000000000..2bb06add8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtension.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.spi.policy;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+/**
+ * A runtime extension point for {@link SourcePolicyBuilder}s
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class SourcePolicyBuilderExtension implements SourcePolicyBuilder {
+ protected int phase = PolicyBuilderRegistry.EXTENSION;
+ private PolicyBuilderRegistry registry;
+
+ @Autowire
+ public void setRegistry(PolicyBuilderRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Property
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ @Init
+ public void init() {
+ registry.registerSourceBuilder(phase, this);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.java
new file mode 100644
index 0000000000..c4b932fdd8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilder.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.spi.policy;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+/**
+ * Implementations contribute {@link org.apache.tuscany.spi.wire.Interceptor}s to handle target-side policy on a wire.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TargetPolicyBuilder {
+
+ /**
+ * Callback for attaching policy to a target-side wire
+ *
+ * @param definition the service definition
+ * @param wire the wire to attach policy to
+ * @throws BuilderException
+ */
+ void build(ServiceDefinition definition, InboundWire wire) throws BuilderException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtension.java
new file mode 100644
index 0000000000..babcce50e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtension.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.spi.policy;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+/**
+ * A runtime extension point for {@link org.apache.tuscany.spi.policy.SourcePolicyBuilder}s
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class TargetPolicyBuilderExtension implements TargetPolicyBuilder {
+ protected int phase = PolicyBuilderRegistry.EXTENSION;
+ private PolicyBuilderRegistry registry;
+
+ @Autowire
+ public void setRegistry(PolicyBuilderRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Property
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ @Init
+ public void init() {
+ registry.registerTargetBuilder(phase, this);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolutionException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolutionException.java
new file mode 100644
index 0000000000..fd7394b6dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolutionException.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.spi.resolver;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes an error during the resolve phase as an assembly is evaluated
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ResolutionException extends TuscanyException {
+
+ public ResolutionException() {
+ }
+
+ public ResolutionException(String message) {
+ super(message);
+ }
+
+ public ResolutionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResolutionException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ResolutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java
new file mode 100644
index 0000000000..036d43eae3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.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.spi.resolver;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Implementations are responsible for resolving resources referenced by an assembly model object
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Resolver<T extends ModelObject> {
+
+ /**
+ * Processes a model object, resolving resources referenced by it
+ *
+ * @param object the model object to process
+ * @throws ResolutionException
+ */
+ void resolve(T object) throws ResolutionException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java
new file mode 100644
index 0000000000..62bdb8d52d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.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.spi.resolver;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Registry for resolvers that handle resolution of resources referenced by assembly model elements
+ * <p/>
+ * Resolvers are contributed by system extensions
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResolverRegistry {
+ /**
+ * Register a resolver for a model type.
+ *
+ * @param modelClass the type model element the resolver handles
+ * @param resolver the resolver to be registered
+ */
+ <T extends ModelObject> void register(Class<T> modelClass, Resolver<T> resolver);
+
+ /**
+ * Unregister a resolver for a model type.
+ *
+ * @param modelClass the model type whose builder should be unregistered
+ */
+ <T extends ModelObject> void unregister(Class<T> modelClass);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.java
new file mode 100644
index 0000000000..777cfbd3e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/VoidService.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.spi.services;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Empty interface for a service component that has no operations.
+ * This can be used as a default service interface by components that
+ * do not wish the base class to be used as the interface as specified
+ * by the defaulting rules.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service
+public interface VoidService {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
new file mode 100644
index 0000000000..4da522d196
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/Artifact.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.services.artifact;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Description of some packaged artifact such as a JAR file or a Composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Artifact {
+
+ /* Artifact group */
+ private String group;
+
+ /* Artifact name */
+ private String name;
+
+ /* Artifact version */
+ private String version;
+
+ /* Artifact classifier */
+ private String classifier;
+
+ /* Artifact type */
+ private String type;
+
+ /* Artifact url */
+ private URL url;
+
+ /* Transitive dependencies */
+ private Set<Artifact> dependencies = new HashSet<Artifact>();
+
+ /**
+ * Adds a transitive dependency to the artifact.
+ *
+ * @param artifact Dependency to be added.
+ */
+ public void addDependency(Artifact artifact) {
+ dependencies.add(artifact);
+ }
+
+ /**
+ * Gets the URLs for all the transitive dependencies.
+ *
+ * @return Sets of URLs for all the transitive dependencies.
+ */
+ public Set<URL> getUrls() {
+
+ Set<URL> urls = new HashSet<URL>();
+
+ for (Artifact artifact : dependencies) {
+ urls.add(artifact.getUrl());
+ }
+ urls.add(getUrl());
+
+ return urls;
+
+ }
+
+ /**
+ * Returns the name of a logical grouping to which this artifact belongs. For example, this might represent the
+ * original publisher of the artifact.
+ *
+ * @return the name of a logical grouping to which this artifact belongs
+ */
+ public String getGroup() {
+ return group;
+ }
+
+ /**
+ * Sets the name of a logical grouping to which this artifact belongs.
+ *
+ * @param group the name of a logical grouping to which this artifact belongs
+ */
+ public void setGroup(String group) {
+ this.group = group;
+ }
+
+ /**
+ * Returns the name of an artifact.
+ *
+ * @return the name of an artifact
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of an artifact.
+ *
+ * @param name the name of an artifact
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the version of an artifact.
+ *
+ * @return the version of an artifact
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the version of an artifact.
+ *
+ * @param version the version of an artifact
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Returns a way of classifying an artifact. This can be used to distinguish variants of an artifact that provide
+ * the same function but which may have platform specific requirements. For example, it may contain the name of a
+ * hardware platform for artifacts that contain native code.
+ *
+ * @return a way of classifying an artifact
+ */
+ public String getClassifier() {
+ return classifier;
+ }
+
+ /**
+ * Sets a way of classifying an artifact
+ *
+ * @param classifier a way of classifying an artifact
+ */
+ public void setClassifier(String classifier) {
+ this.classifier = classifier;
+ }
+
+ /**
+ * Returns the type of artifact.
+ *
+ * @return the type of artifact
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type of artifact.
+ *
+ * @param type the type of artifact
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Returns a URL from which the artifact can be obtained.
+ *
+ * @return a URL from which the artifact can be obtained
+ */
+ public URL getUrl() {
+ return url;
+ }
+
+ /**
+ * Sets a URL from which the artifact can be obtained.
+ *
+ * @param url a URL from which the artifact can be obtained
+ */
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append(group).append(':').append(name).append(':').append(version).append(':').append(type);
+ return buf.toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.java
new file mode 100644
index 0000000000..b0f590e163
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/artifact/ArtifactRepository.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.spi.services.artifact;
+
+import java.util.Collection;
+
+/**
+ * Abstraction for a repository of SCA and other artifacts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactRepository {
+ /**
+ * Resolve an artifact.
+ * This ensures that the information associated with an artifact is fully populated;
+ * Specifically, after this operation the URL should contain a location where the artifact can be obtained.
+ *
+ * @param artifact the artifact to be resolved
+ */
+ void resolve(Artifact artifact);
+
+ /**
+ * Resolve a collection of Artifacts.
+ *
+ * @param artifacts a collection of artifacts to be resolved
+ * @see #resolve(Artifact)
+ */
+ void resolve(Collection<? extends Artifact> artifacts);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/AbstractDiscoveryService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/AbstractDiscoveryService.java
new file mode 100644
index 0000000000..a3dcaae21f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/AbstractDiscoveryService.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.services.discovery;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.host.RuntimeInfo;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * Abstract implementation of the discovery service.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+@EagerInit
+public abstract class AbstractDiscoveryService implements DiscoveryService {
+
+ /** Runtime info. */
+ private RuntimeInfo runtimeInfo;
+
+ /** Request listeners. */
+ private Map<QName, RequestListener> requestListenerMap = new ConcurrentHashMap<QName, RequestListener>();
+
+ /** Response listeners. */
+ private Map<QName, ResponseListener> responseListenerMap = new ConcurrentHashMap<QName, ResponseListener>();
+
+ /**
+ * Registers a request listener for async messages.
+ *
+ * @param messageType Message type that can be handled by the listener.
+ * @param listener Recipient of the async message.
+ */
+ public void registerRequestListener(QName messageType, RequestListener listener) {
+ requestListenerMap.put(messageType, listener);
+ }
+
+ /**
+ * Registers a response listener for async messages.
+ *
+ * @param messageType Message type that can be handled by the listener.
+ * @param listener Recipient of the async message.
+ */
+ public void registerResponseListener(QName messageType, ResponseListener listener) {
+ responseListenerMap.put(messageType, listener);
+ }
+
+ /**
+ * Sets the runtime info for the runtime using the discovery service.
+ *
+ * @param runtimeInfo Runtime info for the runtime using the discovery service.
+ */
+ @Autowire
+ public final void setRuntimeInfo(RuntimeInfo runtimeInfo) {
+ this.runtimeInfo = runtimeInfo;
+ }
+
+ /**
+ * Starts the discovery service.
+ */
+ @Init
+ public final void start() throws DiscoveryException {
+ onStart();
+ }
+
+ /**
+ * Stops the discovery service.
+ */
+ @Destroy
+ public final void stop() throws DiscoveryException {
+ onStop();
+ }
+
+ /**
+ * Gets the runtime info for the runtime using the discovery service.
+ *
+ * @return Runtime info for the runtime using the discovery service.
+ */
+ protected final RuntimeInfo getRuntimeInfo() {
+ return runtimeInfo;
+ }
+
+ /**
+ * Returns the request listener for the specified message type.
+ *
+ * @param messageType Message type for the incoming message.
+ * @return Listener interested in the message type.
+ */
+ public final RequestListener getRequestListener(QName messageType) {
+ return requestListenerMap.get(messageType);
+ }
+
+ /**
+ * Returns the request listener for the specified message type.
+ *
+ * @param messageType Message type for the incoming message.
+ * @return Listener interested in the message type.
+ */
+ public final ResponseListener getResponseListener(QName messageType) {
+ return responseListenerMap.get(messageType);
+ }
+
+ /**
+ * Broadcasts the messages to all runtimes in the domain.
+ *
+ * @param content Message content.
+ * @return The message id.
+ * @throws DiscoveryException In case of discovery errors.
+ */
+ public int broadcastMessage(XMLStreamReader content) throws DiscoveryException {
+ return sendMessage(null, content);
+ }
+
+ /**
+ * Required to be overridden by sub-classes.
+ *
+ */
+ protected abstract void onStart() throws DiscoveryException;
+
+ /**
+ * Required to be overridden by sub-classes.
+ *
+ */
+ protected abstract void onStop() throws DiscoveryException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryException.java
new file mode 100644
index 0000000000..e85bd797b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryException.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.spi.services.discovery;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Checked exception thrown during discovery operations.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class DiscoveryException extends TuscanyException {
+
+ /**
+ * Initialises the exception message.
+ * @param message Message for the exception.
+ */
+ public DiscoveryException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initialises the exception root cause.
+ * @param message Root cause for the exception.
+ */
+ public DiscoveryException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryService.java
new file mode 100644
index 0000000000..5c0a518323
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/DiscoveryService.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.spi.services.discovery;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Defines the abstraction that allows runtimes participating
+ * in the domain to discover each other and broadcast liveness
+ * to the admin server that holds the domain's runtime physical
+ * model and the domain-wide assembly model..
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface DiscoveryService {
+
+ /**
+ * Sends a message to the specified runtime. The method returns a unique
+ * message id for the sent message. The consumers can use the message id for
+ * correlating responses to sent messages.
+ *
+ * @param runtimeId Runtime id of recipient.
+ * @param content Message content.
+ * @return The message id.
+ * @throws DiscoveryException In case of discovery errors.
+ */
+ int sendMessage(String runtimeId, XMLStreamReader content) throws DiscoveryException;
+
+ /**
+ * Broadcasts the messages to all runtimes in the domain.
+ *
+ * @param content Message content.
+ * @return The message id.
+ * @throws DiscoveryException In case of discovery errors.
+ */
+ int broadcastMessage(XMLStreamReader content) throws DiscoveryException;
+
+ /**
+ * Registers a request listener for async messages. Request listeners handle
+ * unslolicited async messages sent by recipients.
+ *
+ * @param messageType Message type that can be handled by the listener.
+ * @param listener Recipient of the async message.
+ */
+ void registerRequestListener(QName messageType, RequestListener listener);
+
+ /**
+ * Registers a response listener for async messages. Response listeners handle
+ * async meesages that are received in response to a request message that was
+ * originally sent.
+ *
+ * @param messageType Message type that can be handled by the listener.
+ * @param listener Recipient of the async message.
+ */
+ void registerResponseListener(QName messageType, ResponseListener listener);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/RequestListener.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/RequestListener.java
new file mode 100644
index 0000000000..8729757a6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/RequestListener.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.spi.services.discovery;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Message listener for propogating callbacks. Request listeners handle
+ * unslolicited async messages sent by recipients.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface RequestListener {
+
+ /**
+ * Callback for propogating async messages.
+ * @param content Message content.
+ * @return Response to the request message.
+ */
+ XMLStreamReader onRequest(XMLStreamReader content);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/ResponseListener.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/ResponseListener.java
new file mode 100644
index 0000000000..5b84ec4002
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/discovery/ResponseListener.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.spi.services.discovery;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Message listener for propogating callbacks. Response listeners handle
+ * async meesages that are received in response to a request message that was
+ * originally sent.
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public interface ResponseListener {
+
+ /**
+ * Callback for propogating async messages.
+ * @param content Message content.
+ * @param An optional message id if this was in response to a message that was sent.
+ */
+ void onResponse(XMLStreamReader content, int messageId);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/management/TuscanyManagementService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/management/TuscanyManagementService.java
new file mode 100644
index 0000000000..10c2215bf6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/management/TuscanyManagementService.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.spi.services.management;
+
+import org.apache.tuscany.host.management.ManagementService;
+import org.apache.tuscany.spi.component.Component;
+
+/**
+ * Interface for the management service abstraction. The implementaion
+ * could be based on a variety of technologies including JMX, WSDM,
+ * SNMP etc.
+ *
+ * @version $Revision$ $Date$
+ */
+public interface TuscanyManagementService extends ManagementService<Component> {
+
+ /**
+ * Registers a component for management.
+ *
+ * @param name Name of the component.
+ * @param component Component to be registered.
+ */
+ void registerComponent(String name, Component component);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/DuplicateRecordException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/DuplicateRecordException.java
new file mode 100644
index 0000000000..1210d05f5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/DuplicateRecordException.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.spi.services.store;
+
+/**
+ * thrown when a record already exists during an insert operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateRecordException extends StoreWriteException {
+
+ public DuplicateRecordException(String owner, String identifier) {
+ super(null, owner, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/RecoveryListener.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/RecoveryListener.java
new file mode 100644
index 0000000000..186d741c04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/RecoveryListener.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.spi.services.store;
+
+import java.util.UUID;
+
+/**
+ * Implementations receive callback events during a store recovery operation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RecoveryListener {
+
+ /**
+ * Signals the start of a recovery
+ */
+ void onBegin();
+
+ /**
+ * Received when a record is recovered
+ *
+ * @param id
+ */
+ void onRecord(UUID id);
+
+ /**
+ * Signals the end of recovery
+ */
+ void onEnd();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/Store.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/Store.java
new file mode 100644
index 0000000000..7a09f90811
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/Store.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 org.apache.tuscany.spi.services.store;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.EventPublisher;
+
+/**
+ * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be
+ * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an
+ * in-memory map.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Store extends EventPublisher {
+
+ /* Used to indicate an the default expiration offset for records for the store */
+ long DEFAULT_EXPIRATION_OFFSET = -1;
+
+ /* Used to indicate an entry should not expire */
+ long NEVER = -2;
+
+ /**
+ * Adds the given record to the store. Implementations may choose different strategies for writing data such as
+ * write-through or write-behind.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException if an error occurs during the write operation
+ */
+ void insertRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Updates a given record in the store, overwriting previous information.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException
+ */
+ void updateRecord(SCAObject owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Returns the deserialized object in the store corresponding to the given id
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @return the deserialized object or null if one is not found
+ * @throws StoreReadException
+ */
+ Object readRecord(SCAObject owner, String id) throws StoreReadException;
+
+ /**
+ * Removes a record from the store
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @throws StoreWriteException
+ */
+ void removeRecord(SCAObject owner, String id) throws StoreWriteException;
+
+ /**
+ * Removes all records from the store
+ *
+ * @throws StoreWriteException
+ */
+ void removeRecords() throws StoreWriteException;
+
+ /**
+ * Initiates a recovery operation, for example during restart after a crash
+ *
+ * @param listener the listener to receive recovery callback events
+ * @throws StoreReadException
+ */
+ void recover(RecoveryListener listener) throws StoreReadException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreException.java
new file mode 100644
index 0000000000..59f1797490
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreException.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.spi.services.store;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Represents a generic exception thrown by a <code>Store</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreException extends TuscanyException {
+ private final String owner;
+
+ public StoreException(String message, String owner, String identifier) {
+ super(message, identifier);
+ this.owner = owner;
+ }
+
+ public StoreException(String message, String owner, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ this.owner = owner;
+ }
+
+ public StoreException(String message, String owner, Throwable cause) {
+ super(message, cause);
+ this.owner = owner;
+ }
+
+ public StoreException(Throwable cause) {
+ super(cause);
+ owner = null;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreExpirationEvent.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreExpirationEvent.java
new file mode 100644
index 0000000000..fbb38dd362
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreExpirationEvent.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.spi.services.store;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.event.Event;
+
+/**
+ * Fired when a store implementation expires a resource
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreExpirationEvent implements Event {
+ private Object source;
+ private SCAObject owner;
+ private Object instance;
+
+ /**
+ * Constructor.
+ *
+ * @param source the source of the event
+ * @param owner the owner of the expiring object
+ * @param instance the expiring object
+ */
+ public StoreExpirationEvent(Object source, SCAObject owner, Object instance) {
+ assert source != null;
+ assert owner != null;
+ assert instance != null;
+ this.source = source;
+ this.owner = owner;
+ this.instance = instance;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Returns the owner of the expiring object.
+ *
+ * @return the owner of the expiring object.
+ */
+ public SCAObject getOwner() {
+ return owner;
+ }
+
+ /**
+ * Returns the expiring object.
+ *
+ * @return the expiring object.
+ */
+ public Object getInstance() {
+ return instance;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreMonitor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreMonitor.java
new file mode 100644
index 0000000000..4f5177bf45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreMonitor.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.spi.services.store;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * A generic monintor interface for services to log events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StoreMonitor {
+
+ /**
+ * Signals the service has started
+ *
+ * @param msg
+ */
+ @LogLevel("FINER")
+ void start(String msg);
+
+ /**
+ * Signals the service has been shutdown
+ *
+ * @param msg
+ */
+ @LogLevel("FINER")
+ void stop(String msg);
+
+ /**
+ * Fired when recovery is started
+ */
+ @LogLevel("FINER")
+ void beginRecover();
+
+ /**
+ * Fired when recovery is completed
+ */
+ @LogLevel("FINER")
+ void endRecover();
+
+ /**
+ * Fired when a record is processed during recovery
+ *
+ * @param recordId the id of the record being recovered
+ */
+ @LogLevel("FINER")
+ void recover(Object recordId);
+
+ /**
+ * Signals an error event
+ *
+ * @param e the error
+ */
+ @LogLevel("SEVERE")
+ void error(Throwable e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreReadException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreReadException.java
new file mode 100644
index 0000000000..0f46ac6878
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreReadException.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.spi.services.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+
+ public StoreReadException(Throwable cause) {
+ super(cause);
+ }
+
+ public StoreReadException(String message, String owner, String identifier) {
+ super(message, owner, identifier);
+ }
+
+ public StoreReadException(String owner, String identifier, Throwable throwable) {
+ super(owner, identifier, throwable);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreWriteException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreWriteException.java
new file mode 100644
index 0000000000..9eef91db9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/store/StoreWriteException.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.spi.services.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+
+ public StoreWriteException(String message, String owner, String identifier) {
+ super(message, owner, identifier);
+ }
+
+ public StoreWriteException(String message, String owner, String identifier, Throwable cause) {
+ super(message, owner, identifier, cause);
+ }
+
+ public StoreWriteException(String message, String owner, Throwable cause) {
+ super(message, owner, cause);
+ }
+
+ public StoreWriteException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.java
new file mode 100644
index 0000000000..9675cdce53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/NotificationListener.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.spi.services.work;
+
+/**
+ * A callback inyterface that can be optionally used for registering
+ * interest in status of asynchronously scheduled unit of work.
+ *
+ */
+public interface NotificationListener<T extends Runnable> {
+
+ /**
+ * Callback method when the unit of work is accepted.
+ *
+ * @param work Work that was accepted.
+ */
+ void workAccepted(T work);
+
+ /**
+ * Callback method when the unit of work is successfully completed.
+ *
+ * @param work Work that was succesfully completed.
+ */
+ void workCompleted(T work);
+
+ /**
+ * Callback when the unit of work is started.
+ *
+ * @param work Unit of work that was started.
+ */
+ void workStarted(T work);
+
+ /**
+ * Callback when the unit of work is rejected.
+ *
+ * @param work Unit of work that was rejected.
+ */
+ void workRejected(T work);
+
+ /**
+ * Callnack when the unit of work fails to complete.
+ *
+ * @param work Unit of work that failed to complete.
+ * @param error Error that caused the unit of work to fail.
+ */
+ void workFailed(T work, Throwable error);
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.java
new file mode 100644
index 0000000000..0824990c93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkScheduler.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.spi.services.work;
+
+/**
+ * Defines the contract for scheduling asychronous units of work.
+ *
+ * <p>
+ * Units of work can be scheduled with an optional <code>NotificationListener</code>.
+ * If a notification listener is specified, the caller will be notified regarding the
+ * status of the work. The unit of work can either be completed, rejected or completed
+ * with an error. If the work completed with an error, the caller is notfied with the
+ * error details.
+ * </p>
+ *
+ */
+public interface WorkScheduler {
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ <T extends Runnable>void scheduleWork(T work, NotificationListener<T> listener);
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ <T extends Runnable>void scheduleWork(T work);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.java
new file mode 100644
index 0000000000..d13edab6a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/services/work/WorkSchedulerException.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.spi.services.work;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * Exception thrown by the work scheduler in case of unexpected exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class WorkSchedulerException extends TuscanyRuntimeException {
+
+ /**
+ * Wraps the root cause.
+ *
+ * @param cause Root cause for the exception.
+ */
+ public WorkSchedulerException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/SCAObjectInputStream.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/SCAObjectInputStream.java
new file mode 100644
index 0000000000..cf495d7f18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/SCAObjectInputStream.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.spi.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * Deserializes an object based on the thread context classloader and provides special handling for {@link
+ * SCAExternalizable}
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectInputStream extends ObjectInputStream {
+ private final ClassLoader classLoader;
+ private WorkContext context;
+
+ public SCAObjectInputStream(InputStream in, WorkContext context) throws IOException, SecurityException {
+ super(in);
+ this.context = context;
+ this.classLoader = Thread.currentThread().getContextClassLoader();
+ enableResolveObject(true);
+ }
+
+ protected Class resolveClass(ObjectStreamClass streamClass) throws IOException, ClassNotFoundException {
+ return classLoader.loadClass(streamClass.getName());
+ }
+
+ protected Object resolveObject(Object obj) throws IOException {
+ if (obj instanceof SCAExternalizable) {
+ SCAExternalizable ext = (SCAExternalizable) obj;
+ ext.setWorkContext(context);
+ ext.reactivate();
+ }
+ return obj;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java
new file mode 100644
index 0000000000..e8ade891b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java
@@ -0,0 +1,401 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.util.stax;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.Multiplicity;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Utility for stax operations.
+ *
+ * @version $Revision$ $Date: 2007-02-01 05:37:32 +0530 (Thu, 01 Feb
+ * 2007) $
+ */
+public abstract class StaxUtil {
+
+ /** XML input factory. */
+ private static final XMLInputFactory xmlFactory =
+ XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", StaxUtil.class
+ .getClassLoader());
+
+ private static final Map<String, Multiplicity> MULTIPLICITY =
+ new HashMap<String, Multiplicity>(4);
+
+ static {
+ MULTIPLICITY.put("0..1", Multiplicity.ZERO_ONE);
+ MULTIPLICITY.put("1..1", Multiplicity.ONE_ONE);
+ MULTIPLICITY.put("0..n", Multiplicity.ZERO_N);
+ MULTIPLICITY.put("1..n", Multiplicity.ONE_N);
+ }
+
+ private StaxUtil() {
+ }
+
+ /**
+ * Convert a "multiplicity" attribute to the equivalent enum value.
+ *
+ * @param multiplicity the attribute to convert
+ * @param def the default value
+ * @return the enum equivalent
+ */
+ public static Multiplicity multiplicity(String multiplicity, Multiplicity def) {
+ return multiplicity == null ? def : MULTIPLICITY.get(multiplicity);
+ }
+
+ /**
+ * Convert a "scope" attribute to the equivalent enum value. Returns
+ * CONVERSATIONAL if the value equals (ignoring case) "conversational",
+ * otherwise returns NONCONVERSATIONAL.
+ *
+ * @param scope the attribute to convert
+ * @return the enum equivalent
+ */
+ public static InteractionScope interactionScope(String scope) {
+ if ("conversational".equalsIgnoreCase(scope)) {
+ return InteractionScope.CONVERSATIONAL;
+ } else {
+ return InteractionScope.NONCONVERSATIONAL;
+ }
+ }
+
+ public static List<Element> createPropertyValues(XMLStreamReader reader,
+ QName type,
+ QName element,
+ boolean many,
+ DocumentBuilder builder) throws XMLStreamException {
+
+ final QName PROPERTY = new QName(SCA_NS, "property");
+ List<Element> propertyValues = new ArrayList<Element>();
+ Document ownerDocument = builder.newDocument();
+ Element value = null;
+ do {
+ value = StaxUtil.createPropertyValue(reader, type, element, many, ownerDocument);
+ if (value != null) {
+ propertyValues.add(value);
+ }
+ } while (!PROPERTY.equals(reader.getName()));
+
+ return propertyValues;
+ }
+
+
+ private static Element createDefaultRootElement(QName type, Document doc) {
+
+ Element root = doc.createElementNS(null, "value");
+ if (type != null) {
+ Attr xsi = doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
+ xsi.setValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ root.setAttributeNodeNS(xsi);
+
+ String prefix = type.getPrefix();
+ if (prefix == null || prefix.length() == 0) {
+ prefix = "ns";
+ }
+ Attr typeXmlns =
+ doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:" + prefix);
+ typeXmlns.setValue(type.getNamespaceURI());
+ root.setAttributeNodeNS(typeXmlns);
+
+ Attr xsiType =
+ doc.createAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
+ xsiType.setValue(prefix + ":" + type.getLocalPart());
+ root.setAttributeNodeNS(xsiType);
+ }
+ return root;
+ }
+
+
+ public static Element createPropertyValue(XMLStreamReader reader,
+ QName type,
+ QName element,
+ boolean many,
+ Document document
+ ) throws XMLStreamException {
+ if (element == null && type != null && SimpleTypeMapperExtension.isSimpleXSDType(type)) {
+ if (many) {
+ //if property is 'many' then each simple value is enclosed within an element
+ //with local name 'value' FIXME :(an assumption for now until specs is clear on this
+ return loadPropertyValue(reader, null, document);
+ } else {
+ // root element has no namespace and local name "value"
+ Element root = createDefaultRootElement(type, document);
+ //doc.appendChild(root);
+ loadPropertyValue(reader, root, document);
+ if (!isValueDefined(root)) {
+ return null;
+ } else {
+ return root;
+ }
+ }
+ } else {
+ return loadPropertyValue(reader, null, document);
+ }
+ }
+
+
+ private static boolean isValueDefined(Element value) {
+ if (value.hasChildNodes()) {
+ Node childNode = value.getFirstChild();
+ if (childNode.getNodeType() == Document.ELEMENT_NODE
+ || (childNode.getNodeType() == Document.TEXT_NODE
+ && childNode.getTextContent().trim().length() > 0)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Load a property value specification from an StAX stream into a DOM
+ * Document. Only elements, text and attributes are processed; all comments
+ * and other whitespace are ignored.
+ *
+ * @param reader the stream to read from
+ * @param root the DOM node to load
+ */
+ public static Element loadPropertyValue(XMLStreamReader reader, Element root, Document document) throws XMLStreamException {
+ Node current = root;
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ Element child =
+ document.createElementNS(name.getNamespaceURI(), name.getLocalPart());
+ child.setPrefix(name.getPrefix());
+
+ // add the attributes for this element
+ int count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String localPart = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ child.setAttributeNS(ns, localPart, value);
+ }
+
+ // push the new element and make it the current one
+ if (root == null) {
+ root = child;
+ } else {
+ current.appendChild(child);
+ }
+ current = child;
+
+ break;
+ case XMLStreamConstants.CDATA:
+ if (current != null) {
+ current.appendChild(document.createCDATASection(reader.getText()));
+ }
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (current != null) {
+ current.appendChild(document.createTextNode(reader.getText()));
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ // if we are back at the root then we are done
+ if (current == root) {
+ return root;
+ }
+
+ // pop the element off the stack
+ current = current.getParentNode();
+ }
+ }
+ }
+
+ /**
+ * Serializes the infoset in the stream reader.
+ *
+ * @param reader Stream reader.
+ * @return Serialized XML.
+ * @throws XMLStreamException In case of an xml stream error.
+ */
+ public static final String serialize(XMLStreamReader reader) throws XMLStreamException {
+
+ try {
+
+ StringBuffer xml = new StringBuffer();
+
+ int event = reader.getEventType();
+ while (true) {
+
+ switch (event) {
+ case XMLStreamConstants.START_ELEMENT:
+ onStartElement(reader, xml);
+ onNsMappings(reader, xml);
+ onAttributes(reader, xml);
+ xml.append(">");
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (reader.isWhiteSpace()) {
+ break;
+ }
+ xml.append(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ onEndElement(reader, xml);
+ break;
+ }
+
+ if (!reader.hasNext()) {
+ break;
+ }
+ event = reader.next();
+
+ }
+ return xml.toString();
+
+ } finally {
+ reader.close();
+ }
+
+ }
+
+ /**
+ * Creates a stream reader to the serialized XML.
+ *
+ * @param xml Serialized XML to which reader is to be created.
+ * @return XML stream reader instance.
+ * @throws XMLStreamException In case of an xml stream error.
+ */
+ public static final XMLStreamReader createReader(String xml) throws XMLStreamException {
+
+ InputStream in = new ByteArrayInputStream(xml.getBytes());
+ return xmlFactory.createXMLStreamReader(in);
+
+ }
+
+ /**
+ * Creates a stream reader to the serialized XML.
+ *
+ * @param xml XML stream to which reader is to be created.
+ * @return XML stream reader instance.
+ * @throws XMLStreamException In case of an xml stream error.
+ */
+ public static final XMLStreamReader createReader(InputStream xml) throws XMLStreamException {
+
+ return xmlFactory.createXMLStreamReader(xml);
+
+ }
+
+ /**
+ * Returns the qualified name of the document element.
+ *
+ * @param xml Serialized xml that needs to be checked.
+ * @return Qualified name of the document element.
+ * @throws XMLStreamException In case of an xml stream error.
+ */
+ public static final QName getDocumentElementQName(String xml) throws XMLStreamException {
+
+ XMLStreamReader reader = null;
+ try {
+ reader = createReader(xml);
+ reader.next();
+ return reader.getName();
+ } finally {
+ reader.close();
+ }
+
+ }
+
+ /*
+ * Renders end element markup.
+ */
+ private static void onEndElement(XMLStreamReader reader, StringBuffer xml) {
+ String name = getName(reader);
+ xml.append("</");
+ xml.append(name);
+ xml.append(">");
+ }
+
+ /*
+ * Gets the fully-qualified name of the element.
+ */
+ private static String getName(XMLStreamReader reader) {
+ QName qname = reader.getName();
+ String namePrefix = qname.getPrefix();
+ String localPart = qname.getLocalPart();
+ String name =
+ namePrefix == null || "".equals(namePrefix) ? localPart : namePrefix + ":" + localPart;
+ return name;
+ }
+
+ /*
+ * Render the attributes.
+ */
+ private static void onAttributes(XMLStreamReader reader, StringBuffer xml) {
+ for (int i = 0, n = reader.getAttributeCount(); i < n; ++i) {
+ xml.append(" ");
+ xml.append(reader.getAttributeLocalName(i));
+ xml.append("=");
+ xml.append("'");
+ xml.append(reader.getAttributeValue(i));
+ xml.append("'");
+ }
+ }
+
+ /*
+ * Renedr namespace mappings.
+ */
+ private static void onNsMappings(XMLStreamReader reader, StringBuffer xml) {
+ for (int i = 0, n = reader.getNamespaceCount(); i < n; ++i) {
+ String prefix = reader.getNamespacePrefix(i);
+ prefix = prefix == null ? prefix = "xmlns" : "xmlns:" + prefix;
+ xml.append(" ");
+ xml.append(prefix);
+ xml.append("=");
+ xml.append("'");
+ xml.append(reader.getNamespaceURI(i));
+ xml.append("'");
+ }
+ }
+
+ /*
+ * Render start element.
+ */
+ private static void onStartElement(XMLStreamReader reader, StringBuffer xml) {
+ xml.append("<");
+ String name = getName(reader);
+ xml.append(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.java
new file mode 100644
index 0000000000..77bc189bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandler.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.spi.wire;
+
+/**
+ * Base class for dispatching an invocation through an {@link InboundInvocationChain}
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractInboundInvocationHandler {
+
+ /**
+ * Dispatches a client request made on a proxy
+ */
+ public Object invoke(InboundInvocationChain chain, TargetInvoker invoker, Object[] args) throws Throwable {
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor == null) {
+ // short-circuit the dispatch and invoke the target directly
+ if (chain.getTargetInvoker() == null) {
+ throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]");
+ }
+ return chain.getTargetInvoker().invokeTarget(args, TargetInvoker.NONE);
+ } else {
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ msg.setBody(args);
+ Message resp;
+ // dispatch the wire down the chain and get the response
+ resp = headInterceptor.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw (Throwable) body;
+ }
+ return body;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java
new file mode 100644
index 0000000000..2ac99e2a60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandler.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.wire;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Base class for performing invocations on an outbound chain. Subclasses are responsible for retrieving and supplying
+ * the appropriate chain, target invoker and invocation arguments.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractOutboundInvocationHandler {
+ private boolean conversationStarted;
+
+ protected Object invoke(OutboundInvocationChain chain,
+ TargetInvoker invoker,
+ Object[] args,
+ Object correlationId,
+ LinkedList<Object> callbackRoutingChain)
+ throws Throwable {
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor == null) {
+ try {
+ // short-circuit the dispatch and invoke the target directly
+ TargetInvoker targetInvoker = chain.getTargetInvoker();
+ if (targetInvoker == null) {
+ String name = chain.getOperation().getName();
+ throw new AssertionError("No target invoker [" + name + "]");
+ }
+ return targetInvoker.invokeTarget(args, TargetInvoker.NONE);
+ } catch (InvocationTargetException e) {
+ // the cause was thrown by the target so throw it
+ throw e.getCause();
+ }
+ } else {
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(invoker);
+ Object fromAddress = getFromAddress();
+ if (fromAddress != null && callbackRoutingChain != null) {
+ throw new AssertionError("Can't use both a from address and callback routing chain");
+ }
+ if (fromAddress != null) {
+ msg.pushFromAddress(fromAddress);
+ }
+ if (correlationId != null) {
+ msg.setCorrelationId(correlationId);
+ }
+ if (callbackRoutingChain != null) {
+ msg.setCallbackRoutingChain(callbackRoutingChain);
+ }
+ Operation operation = chain.getOperation();
+ ServiceContract contract = operation.getServiceContract();
+ if (InteractionScope.CONVERSATIONAL.equals(contract.getInteractionScope())) {
+ int sequence = chain.getOperation().getConversationSequence();
+ if (sequence == Operation.CONVERSATION_END) {
+ msg.setConversationSequence(TargetInvoker.END);
+ conversationStarted = false;
+ } else if (sequence == Operation.CONVERSATION_CONTINUE) {
+ if (conversationStarted) {
+ msg.setConversationSequence(TargetInvoker.CONTINUE);
+ } else {
+ conversationStarted = true;
+ msg.setConversationSequence(TargetInvoker.START);
+ }
+ }
+ }
+ msg.setBody(args);
+ // dispatch the wire down the chain and get the response
+ Message resp = headInterceptor.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw (Throwable) body;
+ }
+ return body;
+ }
+ }
+
+ protected Object getFromAddress() {
+ // Default to null, only needed in outbound (forward) direction
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.java
new file mode 100644
index 0000000000..d557fb84a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundInvocationChain.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 org.apache.tuscany.spi.wire;
+
+/**
+ * A set of interceptors associated with the inbound side of a wire for an operation.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface InboundInvocationChain extends InvocationChain {
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java
new file mode 100644
index 0000000000..ef7e3e2980
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.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.spi.wire;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * Implementations are responsible for managing the inbound side of a wire, including the invocation chains associated
+ * with each service operation.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface InboundWire extends Wire {
+
+ /**
+ * Returns the name of the target service of the wire
+ */
+ String getServiceName();
+
+ /**
+ * Sets the name of the target service of the wire
+ */
+ void setServiceName(String name);
+
+ /**
+ * Returns the invocation chain for each operation on a service specified by a reference or a target
+ * service.
+ */
+ Map<Operation<?>, InboundInvocationChain> getInvocationChains();
+
+ /**
+ * Adds the collection of invocation chains keyed by operation
+ */
+ void addInvocationChains(Map<Operation<?>, InboundInvocationChain> chains);
+
+ /**
+ * Adds the invocation chain associated with the given operation
+ */
+ void addInvocationChain(Operation<?> operation, InboundInvocationChain chain);
+
+ /**
+ * Returns the callback invocation configuration for each operation on a service specified by a reference or a
+ * target service.
+ */
+ Map<Operation<?>, OutboundInvocationChain> getSourceCallbackInvocationChains(Object targetAddr);
+
+ /**
+ * Adds the collection of callback invocation chains keyed by operation for a given target addr
+ */
+ void addSourceCallbackInvocationChains(Object targetAddr, Map<Operation<?>, OutboundInvocationChain> chains);
+
+ /**
+ * Adds the callback invocation chain associated with the given operation for a given target addr
+ */
+ void addSourceCallbackInvocationChain(Object targetAddr, Operation<?> operation, OutboundInvocationChain chain);
+
+ /**
+ * Returns the name of the callback associated with the service of the wire
+ */
+ String getCallbackReferenceName();
+
+ /**
+ * Sets the name of the callback associated with the service of the wire
+ */
+ void setCallbackReferenceName(String callbackReferenceName);
+
+ /**
+ * Set when a wire can be optimized; that is when no handlers or interceptors exist on either end
+ */
+ void setTargetWire(OutboundWire wire);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java
new file mode 100644
index 0000000000..114df5a55c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.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.spi.wire;
+
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Denotes imcompatible service contracts for a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleServiceContractException extends TuscanyException {
+ private static final long serialVersionUID = 5127478601823295587L;
+ private final ServiceContract<?> source;
+ private final ServiceContract<?> target;
+ private final Operation<?> sourceOperation;
+ private final Operation<?> targetOperation;
+
+ public IncompatibleServiceContractException(String message, ServiceContract<?> source, ServiceContract<?> target) {
+ super(message, (String) null);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = null;
+ this.targetOperation = null;
+ }
+
+
+ public IncompatibleServiceContractException(String message,
+ ServiceContract<?> source,
+ ServiceContract<?> target,
+ Operation<?> sourceOperation, Operation<?> targetOperation) {
+ super(message, (String) null);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ }
+
+ public ServiceContract<?> getTarget() {
+ return target;
+ }
+
+ public ServiceContract<?> getSource() {
+ return source;
+ }
+
+ public Operation<?> getSourceOperation() {
+ return sourceOperation;
+ }
+
+ public Operation<?> getTargetOperation() {
+ return targetOperation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.java
new file mode 100644
index 0000000000..ad38ed1cf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Interceptor.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.spi.wire;
+
+/**
+ * Synchronous, around-style mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interceptor {
+
+ /**
+ * Process a synchronous wire
+ *
+ * @param msg the request Message for the wire
+ * @return the response Message from the wire
+ */
+ Message invoke(Message msg);
+
+ /**
+ * Sets the next interceptor
+ */
+ void setNext(Interceptor next);
+
+ /**
+ * Returns the next interceptor or null
+ */
+ Interceptor getNext();
+
+ /**
+ * Returns true if the interceptor can be optimized away from a wire
+ */
+ boolean isOptimizable();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
new file mode 100644
index 0000000000..82e1a52adf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.wire;
+
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * An inbound or outbound invocation pipeline for a service operation. Wires consist of 1..n invocation chains
+ * associated with the operations of the service contract the wire represents. Invocation chains are associated with the
+ * outbound or inbound side of a wire are bridged or "connected" when an assembly is processed. Outbound chains are only
+ * connected to inbound chains and vice versa.
+ * <p/>
+ * Invocation chains contain at least one {@link Interceptor} that process invocations in an around-style manner. In
+ * some scenarios, a service proxy may only contain inbound invocation chains, for example, when a service is resolved
+ * through a locate operation by a non-component client. In this case, there will be no outbound invocation chains and
+ * the target invoker will be held by the target-side and passed down the pipeline.
+ * <p/>
+ * A {@link Message} is used to pass data associated with an invocation through the chain. <code>Message</code>s contain
+ * a {@link TargetInvoker} responsible for dispatching to a target instance and may be cached on the source-side.
+ * Caching allows various optimizations such as avoiding target instance resolution when the client-side lifecycle scope
+ * is a shorter duration than the target.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InvocationChain {
+ /**
+ * Returns the target operation for this invocation chain
+ */
+ Operation getOperation();
+
+ /**
+ * Sets the target invoker to pass down the chain
+ */
+ void setTargetInvoker(TargetInvoker invoker);
+
+ /**
+ * Returns the target invoker that is passed down the chain
+ */
+ TargetInvoker getTargetInvoker();
+
+ /**
+ * Adds an interceptor to the chain
+ */
+ void addInterceptor(Interceptor interceptor);
+
+ /**
+ * Adds an interceptor at the given position in the interceptor stack
+ *
+ * @param index the position in the interceptor stack to add the interceptor
+ * @param interceptor the interceptor to add
+ */
+ void addInterceptor(int index, Interceptor interceptor);
+
+ /**
+ * Returns the first interceptor in the chain
+ */
+ Interceptor getHeadInterceptor();
+
+ /**
+ * Returns the last interceptor in the chain
+ */
+ Interceptor getTailInterceptor();
+
+ /**
+ * Sets the head interceptor of the bridged target-side chain
+ */
+ void setTargetInterceptor(Interceptor interceptor);
+
+ /**
+ * Returns the head interceptor of the birdged target-side chain
+ */
+ Interceptor getTargetInterceptor();
+
+ /**
+ * Signals to the chain that its configuration is complete. Implementations may use this callback to prepare their
+ * invocation chains.
+ */
+ void prepare();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.java
new file mode 100644
index 0000000000..c2ba19c48a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationRuntimeException.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.spi.wire;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Denotes a runtime exception thrown during an invocation over a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationRuntimeException extends ServiceRuntimeException {
+
+ public InvocationRuntimeException() {
+ super();
+ }
+
+ public InvocationRuntimeException(String message) {
+ super(message);
+ }
+
+ public InvocationRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvocationRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.java
new file mode 100644
index 0000000000..e6fc43d889
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Message.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.spi.wire;
+
+import java.util.LinkedList;
+
+/**
+ * Represents a request, response, or exception flowing through a wire
+ *
+ * @version $Rev $Date
+ */
+public interface Message {
+
+ /**
+ * Returns the body of the message, which will be the payload or parameters associated with the wire
+ */
+ Object getBody();
+
+ /**
+ * Sets the body of the message.
+ */
+ void setBody(Object body);
+
+ /**
+ * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain
+ */
+ void setTargetInvoker(TargetInvoker invoker);
+
+ /**
+ * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain
+ */
+ TargetInvoker getTargetInvoker();
+
+ /**
+ * Returns the latest 'address' of the SCAObject where this message originated
+ */
+ Object popFromAddress();
+
+ /**
+ * Adds the latest 'address' of the SCAObject where this message originated
+ */
+ void pushFromAddress(Object fromAddress);
+
+ /**
+ * Returns the chain of SCAObject addresses
+ */
+ LinkedList<Object> getCallbackRoutingChain();
+
+ /**
+ * Sets the chain of SCAObject addresses
+ */
+ void setCallbackRoutingChain(LinkedList<Object> fromAddresses);
+
+ /**
+ * Returns the id of the message
+ */
+ Object getMessageId();
+
+ /**
+ * Sets the id of the message
+ */
+ void setMessageId(Object messageId);
+
+ /**
+ * Returns the correlation id of the message
+ */
+ Object getCorrelationId();
+
+ /**
+ * Sets the correlation id of the message
+ */
+ void setCorrelationId(Object correlationId);
+
+ /**
+ * Test if the message represents a fault/exception
+ *
+ * @return true if the message body is a fault object, false is the body is a normal payload
+ */
+ boolean isFault();
+
+ /**
+ * Set the message body with a fault object. After this method is called, isFault() returns true.
+ *
+ * @param fault The fault object represents an exception
+ */
+ void setBodyWithFault(Object fault);
+
+ /**
+ * Returns the conversational sequence the message is associated with, {@link TargetInvoker.NONE}, {@link
+ * TargetInvoker.START}, {@link TargetInvoker.CONTINUE}, or {@link TargetInvoker.END}
+ *
+ * @return the conversational sequence the message is associated with
+ */
+ short getConversationSequence();
+
+ /**
+ * Sets the conversational sequence the message is associated with,
+ *
+ * @param sequence {@link TargetInvoker.NONE}, {@link TargetInvoker.START}, {@link TargetInvoker.CONTINUE}, or
+ * {@link TargetInvoker.END}
+ */
+ void setConversationSequence(short sequence);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.java
new file mode 100644
index 0000000000..f179eb79b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageId.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.spi.wire;
+
+/**
+ * A unique identifier for a message flowing on a wire, potentially end-to-end (ie, through more than one SCAObject to
+ * SCAObject hop).
+ */
+public class MessageId {
+
+ private long timestamp;
+
+ public MessageId() {
+ this.timestamp = System.currentTimeMillis();
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public String toString() {
+ return "MsgId[" + timestamp + "]";
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final MessageId messageId = (MessageId) o;
+ return timestamp == messageId.timestamp;
+ }
+
+ public int hashCode() {
+ return (int) (timestamp ^ (timestamp >>> 32));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java
new file mode 100644
index 0000000000..728be85771
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/MessageImpl.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.wire;
+
+import java.util.LinkedList;
+
+/**
+ * The default implementation of a message flowed through a wire during an invocation
+ *
+ * @version $Rev $Date
+ */
+public class MessageImpl implements Message {
+ private Object body;
+ private TargetInvoker invoker;
+ private LinkedList<Object> callbackRoutingChain;
+ private Object messageId;
+ private Object correlationId;
+ private boolean isFault;
+ private short conversationSequence;
+
+ public MessageImpl() {
+ }
+
+ public Object getBody() {
+ return body;
+ }
+
+ public void setBody(Object body) {
+ this.isFault = false;
+ this.body = body;
+ }
+
+ public void setTargetInvoker(TargetInvoker invoker) {
+ this.invoker = invoker;
+ }
+
+ public TargetInvoker getTargetInvoker() {
+ return invoker;
+ }
+
+ public Object popFromAddress() {
+ return callbackRoutingChain.removeFirst();
+ }
+
+ public void pushFromAddress(Object fromAddress) {
+ if (callbackRoutingChain == null) {
+ callbackRoutingChain = new LinkedList<Object>();
+ }
+ callbackRoutingChain.addFirst(fromAddress);
+ }
+
+ public LinkedList<Object> getCallbackRoutingChain() {
+ return callbackRoutingChain;
+ }
+
+ public void setCallbackRoutingChain(LinkedList<Object> callbackRoutingChain) {
+ this.callbackRoutingChain = callbackRoutingChain;
+ }
+
+ public Object getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(Object messageId) {
+ this.messageId = messageId;
+ }
+
+ public Object getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(Object correlationId) {
+ this.correlationId = correlationId;
+ }
+
+ public boolean isFault() {
+ return isFault;
+ }
+
+ public void setBodyWithFault(Object fault) {
+ this.isFault = true;
+ this.body = fault;
+ }
+
+ public TargetInvoker getInvoker() {
+ return invoker;
+ }
+
+ public void setInvoker(TargetInvoker invoker) {
+ this.invoker = invoker;
+ }
+
+ public short getConversationSequence() {
+ return conversationSequence;
+ }
+
+ public void setConversationSequence(short conversationSequence) {
+ this.conversationSequence = conversationSequence;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundChainHolder.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundChainHolder.java
new file mode 100644
index 0000000000..7c20efeca8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundChainHolder.java
@@ -0,0 +1,38 @@
+package org.apache.tuscany.spi.wire;
+
+/**
+ * A holder used to associate an wire chain with a local copy of a target invoker that was previously cloned from the
+ * chain master
+ *
+ * @version $Rev$ $Date$
+ */
+public class OutboundChainHolder implements Cloneable {
+ OutboundInvocationChain chain;
+ TargetInvoker cachedInvoker;
+
+ public OutboundChainHolder(OutboundInvocationChain config) {
+ this.chain = config;
+ }
+
+ public OutboundInvocationChain getChain() {
+ return chain;
+ }
+
+ public TargetInvoker getCachedInvoker() {
+ return cachedInvoker;
+ }
+
+ public void setCachedInvoker(TargetInvoker invoker) {
+ this.cachedInvoker = invoker;
+ }
+
+ @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException"})
+ @Override
+ public OutboundChainHolder clone() {
+ try {
+ return (OutboundChainHolder) super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.java
new file mode 100644
index 0000000000..b15678a4a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundInvocationChain.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.spi.wire;
+
+/**
+ * Responsible for flowing a request to a target service and invoking an operation.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OutboundInvocationChain extends InvocationChain {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java
new file mode 100644
index 0000000000..cf37fe84d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.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.spi.wire;
+
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * Implementations are responsible for managing the reference side of a wire, including the invocation chains associated
+ * with each service operation. An <code>OutboundWire</code> is connected to an {@link InboundWire} through their
+ * invocation chains.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OutboundWire extends Wire {
+
+ /**
+ * Returns the name of the source reference
+ */
+ String getReferenceName();
+
+ /**
+ * Sets the name of the source reference
+ */
+ void setReferenceName(String name);
+
+ /**
+ * Returns the name of the target
+ */
+ QualifiedName getTargetName();
+
+ /**
+ * Sets the name of the target
+ */
+ void setTargetName(QualifiedName name);
+
+ boolean isAutowire();
+
+ void setAutowire(boolean val);
+
+ /**
+ * Sets the callback interface type generated proxies implement
+ */
+ void setCallbackInterface(Class<?> interfaze);
+
+ /**
+ * Returns the callback interface type implemented by generated proxies
+ */
+ Class<?> getCallbackInterface();
+
+ /**
+ * Returns the invocation configuration for each operation on a service specified by a reference or a target
+ * service.
+ */
+ Map<Operation<?>, OutboundInvocationChain> getInvocationChains();
+
+ /**
+ * Adds the collection of invocation chains keyed by operation
+ */
+ void addInvocationChains(Map<Operation<?>, OutboundInvocationChain> chains);
+
+ /**
+ * Adds the invocation chain associated with the given operation
+ */
+ void addInvocationChain(Operation<?> operation, OutboundInvocationChain chain);
+
+ /**
+ * Returns the callback invocation configuration for each operation on a service specified by a reference or a
+ * target service.
+ */
+ Map<Operation<?>, InboundInvocationChain> getTargetCallbackInvocationChains();
+
+ /**
+ * Adds the collection of callback invocation chains keyed by operation
+ */
+ void addTargetCallbackInvocationChains(Map<Operation<?>, InboundInvocationChain> chains);
+
+ /**
+ * Adds the callback invocation chain associated with the given operation
+ */
+ void addTargetCallbackInvocationChain(Operation<?> operation, InboundInvocationChain chain);
+
+ /**
+ * Set when a wire can be optimized; that is when no handlers or interceptors exist on either end
+ */
+ void setTargetWire(InboundWire wire);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.java
new file mode 100644
index 0000000000..4805c75252
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/ProxyCreationException.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.spi.wire;
+
+import org.apache.tuscany.spi.CoreRuntimeException;
+
+/**
+ * Denotes an error creating a proxy
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ProxyCreationException extends CoreRuntimeException {
+ public ProxyCreationException() {
+ }
+
+ public ProxyCreationException(String message) {
+ super(message);
+ }
+
+ public ProxyCreationException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ProxyCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ProxyCreationException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ProxyCreationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.java
new file mode 100644
index 0000000000..b2d4648a2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/TargetInvoker.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.spi.wire;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Implementations are responsible for resolving a target and performing the actual invocation on it, for example, a
+ * component implementation instance or a service client.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TargetInvoker extends Cloneable {
+ /* indicates that no conversational sequence is associated with the message */
+ short NONE = 0;
+ /* indicates that the message initiates a conversation */
+ short START = 1;
+ /* indicates that the message continues a conversation */
+ short CONTINUE = 2;
+ /* indicates that the message ends a conversation */
+ short END = 3;
+
+ /**
+ * Invokes an operation on a target with the given payload. Used in optmized cases where messages do not need to be
+ * flowed such as in non-proxied wires.
+ *
+ * @param payload the invocation payload, typically an array of parameters
+ * @param sequence if the invocation is part of a conversation, the sequence. Valid values are {@link NONE} for
+ * non-conversational, {@link START} to begin a conversation, {@link CONTINUE} to continue a
+ * conversation, or {@link END} to end a conversation
+ * @throws InvocationTargetException
+ */
+ Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException;
+
+ /**
+ * Invokes an operation on a target with the given message
+ *
+ * @throws InvocationRuntimeException
+ */
+ Message invoke(Message msg) throws InvocationRuntimeException;
+
+ /**
+ * Determines whether the proxy can be cached on the client/source side
+ */
+ boolean isCacheable();
+
+ /**
+ * Sets whether the target service instance may be cached by the invoker. This is a possible optimization when a
+ * wire is configured for a "down-scope" reference, i.e. a reference from a source of a shorter lifetime to a source
+ * of greater lifetime.
+ */
+ void setCacheable(boolean cacheable);
+
+ /**
+ * Determines if the target invoker can be discarded during wire optimization
+ */
+ boolean isOptimizable();
+
+ /**
+ * Implementations must support deep cloning
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
new file mode 100644
index 0000000000..bece953a6e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.wire;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * The base wire type used to connect references and serviceBindings
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Wire {
+ QName LOCAL_BINDING = new QName("http://tuscany.apache.org/xmlns/sca/binding/1.0", "binding.local");
+
+ QName getBindingType();
+
+ /**
+ * Returns the non-proxied target instance for this wire
+ */
+ Object getTargetService() throws TargetResolutionException;
+
+ /**
+ * Returns the service contract associated with the wire
+ *
+ * @return the service contract associated with the wire
+ */
+ ServiceContract getServiceContract();
+
+ /**
+ * Sets the contract associated with the wire
+ *
+ * @param contract the contract associated with the wire
+ */
+ void setServiceContract(ServiceContract contract);
+
+ /**
+ * Adds an interface type generated proxies implement
+ */
+ void addInterface(Class<?> claz);
+
+ /**
+ * Returns true if its invocation chains may be bypassed
+ */
+ boolean isOptimizable();
+
+ /**
+ * Determines if the wire may be optimized
+ *
+ * @param optimizable true if the wire is optimizable
+ */
+ void setOptimizable(boolean optimizable);
+
+ /**
+ * Returns the SCAObject that contains this wire
+ */
+ SCAObject getContainer();
+
+ /**
+ * Sets the name of the SCAObject that contains this wire
+ */
+ void setContainer(SCAObject container);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.java
new file mode 100644
index 0000000000..325f26ba91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireInvocationHandler.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.spi.wire;
+
+import java.lang.reflect.Method;
+
+/**
+ * Implementations are responsible for dispatching an operation down an invocation chain
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface WireInvocationHandler {
+
+ Object invoke(Method method, Object[] args) throws Throwable;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java
new file mode 100644
index 0000000000..a0b1192bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.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.spi.wire;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private OutboundWire wire;
+ private WireService wireService;
+
+ /**
+ * Constructor.
+ *
+ * @param interfaze the interface to inject on the client
+ * @param wire the backing wire
+ * @param wireService the wire service to create the proxy
+ */
+ public WireObjectFactory(Class<T> interfaze, OutboundWire wire, WireService wireService) {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.wireService = wireService;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ return interfaze.cast(wireService.createProxy(interfaze, wire));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessor.java
new file mode 100644
index 0000000000..c380d208d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessor.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.spi.wire;
+
+/**
+ * Implementations are called after inbound and outbound wires are decorated with policy and before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WirePostProcessor {
+
+ /**
+ * @param source
+ * @param target
+ */
+ void process(OutboundWire source, InboundWire target);
+
+ /**
+ * @param source
+ * @param target
+ */
+ void process(InboundWire source, OutboundWire target);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorExtension.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorExtension.java
new file mode 100644
index 0000000000..605a433590
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorExtension.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.spi.wire;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public abstract class WirePostProcessorExtension implements WirePostProcessor {
+ protected WirePostProcessorRegistry registry;
+
+ @Autowire
+ public void setRegistry(WirePostProcessorRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.register(this);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorRegistry.java
new file mode 100644
index 0000000000..f012d119c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WirePostProcessorRegistry.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.spi.wire;
+
+/**
+ * Acts as a delegating <code>WirePostProcessor</code>, delegating post-processing of wires after policies have been
+ * applied and source an targets have been matched but before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WirePostProcessorRegistry extends WirePostProcessor {
+
+
+ /**
+ * Registers a post-processor in the runtime
+ *
+ * @param processor the processor to register
+ */
+ void register(WirePostProcessor processor);
+
+ /**
+ * De-registers a post-processor in the runtime
+ *
+ * @param processor the processor to de-register
+ */
+ void unregister(WirePostProcessor processor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
new file mode 100644
index 0000000000..f913b9ed80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.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.spi.wire;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Creates proxies that implement Java interfaces and invocation handlers for fronting wires
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public interface WireService {
+
+ /**
+ * Creates a Java proxy for the given wire
+ *
+ * @param interfaze the interface the proxy implements
+ * @param wire the wire to proxy @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createProxy(Class<T> interfaze, Wire wire) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the given wire
+ *
+ * @param interfaze the interface the proxy implements
+ * @param wire the wire to proxy @return the proxy
+ * @param mapping the method to chain holder mapping to use in creating the proxy. Clients may cache and resuse
+ * this mapping for performance.
+ * @throws ProxyCreationException
+ */
+ <T> T createProxy(Class<T> interfaze, Wire wire, Map<Method, OutboundChainHolder> mapping)
+ throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the service contract callback
+ *
+ * @param interfaze the interface the proxy should implement
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException;
+
+ /**
+ * Creates an {@link WireInvocationHandler} for the given wire
+ *
+ * @param interfaze the client side interface
+ * @param wire the wire to create the invocation handler for
+ * @return the invocation handler
+ */
+ WireInvocationHandler createHandler(Class<?> interfaze, Wire wire);
+
+ /**
+ * Creates an outbound invocation chain for a given operation
+ *
+ * @param operation the operation to create the chain for
+ * @return the outbound invocation chain for a given operation
+ */
+ OutboundInvocationChain createOutboundChain(Operation<?> operation);
+
+ /**
+ * Creates an inbound invocation chain for a given operation
+ *
+ * @param operation the operation to create the chain for
+ * @return the inbound invocation chain for a given operation
+ */
+ InboundInvocationChain createInboundChain(Operation<?> operation);
+
+ /**
+ * Creates a wire for flowing inbound invocations to a service. The returned inbound chain will always contain at
+ * least one interceptor in order for outbound wires to connect to it.
+ *
+ * @param service the model representation of the service
+ * @return the wire for flowing inbound invocations to a service
+ */
+ InboundWire createWire(ServiceDefinition service);
+
+ /**
+ * Creates and injects wires for an atomic component
+ *
+ * @param component the component
+ * @param definition the model artifact representing the component
+ */
+ void createWires(AtomicComponent component, ComponentDefinition<?> definition);
+
+ /**
+ * Creates and injects wires for a reference binding
+ *
+ * @param referenceBinding the reference
+ * @param contract the model artifact representing the service contract for the reference
+ * @param targetName the qualified target name or null if the reference referes to a target outside the SCA
+ * domain
+ */
+ void createWires(ReferenceBinding referenceBinding, ServiceContract<?> contract, QualifiedName targetName);
+
+ /**
+ * Creates and injects wires for a service binding
+ *
+ * @param serviceBinding the serviceBinding
+ * @param contract the serviceBinding contract
+ * @param targetName the target nane
+ */
+ void createWires(ServiceBinding serviceBinding, ServiceContract<?> contract, String targetName);
+
+ /**
+ * Check the compatiblity of the source and the target service contracts.<p> A wire may only connect a source to a
+ * target if the target implements an interface that is compatible with the interface required by the source. The
+ * source and the target are compatible if:
+ * <p/>
+ * <ol> <li>the source interface and the target interface MUST either both be remotable or they are both local
+ * <li>the methods on the target interface MUST be the same as or be a superset of the methods in the interface
+ * specified on the source <li>compatibility for the individual method is defined as compatibility of the signature,
+ * that is method name, input types, and output types MUST BE the same. <li>the order of the input and output types
+ * also MUST BE the same. <li>the set of Faults and Exceptions expected by the source MUST BE the same or be a
+ * superset of those specified by the service. <li>other specified attributes of the two interfaces MUST match,
+ * including Scope and Callback interface </ol>
+ * <p/>
+ * <p>Please note this test is not symetric: the success of checkCompatibility(A, B) does NOT imply that
+ * checkCompatibility(B, A)
+ *
+ * @param source The source service contract
+ * @param target The target service contract
+ * @param ignoreCallback Indicate the callback should be checked
+ * @throws IncompatibleServiceContractException
+ * If the source service contract is not compatible with the target one
+ */
+ void checkCompatibility(ServiceContract<?> source, ServiceContract<?> target, boolean ignoreCallback)
+ throws IncompatibleServiceContractException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.java
new file mode 100644
index 0000000000..72739d56c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/AssertionTestCase.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.spi;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AssertionTestCase extends TestCase {
+ /**
+ * test case that confirms that JRE assertions are enabled
+ */
+ public void testAssertionsAreEnabled() {
+ try {
+ assert false;
+ fail("assertions are not enabled");
+ } catch (AssertionError e) {
+ // ok
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.java
new file mode 100644
index 0000000000..1f5faa5f9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/QualifiedNameTestCase.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.spi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests parsing of naming patters
+ *
+ * @version $Rev$ $Date$
+ */
+public class QualifiedNameTestCase extends TestCase {
+
+ public void testSimpleName() throws Exception {
+ QualifiedName name = new QualifiedName("Foo");
+ assertEquals("Foo", name.getPartName());
+ assertEquals(null, name.getPortName());
+ }
+
+ public void testCompoundName() throws Exception {
+ QualifiedName name = new QualifiedName("Foo/Bar");
+ assertEquals("Foo", name.getPartName());
+ assertEquals("Bar", name.getPortName());
+ }
+
+ public void testCompoundMultiName() throws Exception {
+ QualifiedName name = new QualifiedName("Foo/Bar/Baz");
+ assertEquals("Foo", name.getPartName());
+ assertEquals("Bar/Baz", name.getPortName());
+ }
+
+ public void testInvalidName() throws Exception {
+ try {
+ new QualifiedName("/Foo/Bar");
+ fail("Invalid name exception not thrown");
+ } catch (InvalidNameException e) {
+ //expected
+ }
+ }
+
+ public void testQualifiedName() throws Exception {
+ QualifiedName name = new QualifiedName("Foo/Bar");
+ assertEquals("Foo/Bar", name.getQualifiedName());
+ }
+
+ public void testToString() throws Exception {
+ QualifiedName name = new QualifiedName("Foo/Bar");
+ assertEquals("Foo/Bar", name.toString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.java
new file mode 100644
index 0000000000..44e6bd7927
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/TuscanyRuntimeExceptionTestCase.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.spi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.TuscanyRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TuscanyRuntimeExceptionTestCase extends TestCase {
+
+ public void testIdentifier() throws Exception {
+ TuscanyRuntimeException e = new TestException("bar", "foo");
+ assertEquals("foo", e.getIdentifier());
+ }
+
+ public void testAddContext() throws Exception {
+ TuscanyRuntimeException e = new TestException();
+ e.addContextName("foo");
+ e.addContextName("bar");
+ assertEquals("foo", e.returnContextNames().get(0));
+ assertEquals("bar", e.returnContextNames().get(1));
+ }
+
+ public void testEmptyContext() throws Exception {
+ TuscanyRuntimeException e = new TestException();
+ assertEquals(0, e.returnContextNames().size());
+ }
+
+ public void testEmptyGetMessage() throws Exception {
+ TuscanyRuntimeException e = new TestException();
+ e.getMessage();
+ }
+
+ public void testFullMessage() throws Exception {
+ TuscanyRuntimeException e = new TestException();
+ e.addContextName("foo");
+ e.getMessage();
+ }
+
+
+ private class TestException extends TuscanyRuntimeException {
+
+ public TestException() {
+ }
+
+ public TestException(String message, String identifier) {
+ super(message, identifier);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.java
new file mode 100644
index 0000000000..affd52df42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/annotation/ConstructorAnnotationTest.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.spi.annotation;
+
+import java.util.Arrays;
+
+import org.osoa.sca.annotations.Constructor;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorAnnotationTest extends TestCase {
+ public void testSingleName() throws NoSuchMethodException {
+ Constructor ann = Foo1.class.getConstructor(String.class).getAnnotation(Constructor.class);
+ assertNotNull(ann);
+ String[] names = ann.value();
+ assertTrue(Arrays.equals(new String[]{"prop"}, names));
+ }
+
+ public void testMultipleNames() throws NoSuchMethodException {
+ Constructor ann = Foo1.class.getConstructor(String.class, String.class).getAnnotation(Constructor.class);
+ assertNotNull(ann);
+ String[] names = ann.value();
+ assertTrue(Arrays.equals(new String[]{"prop", "ref"}, names));
+ }
+
+ public static class Foo1 {
+ @Constructor({"prop", "ref"})
+ public Foo1(String prop, String ref) {
+ }
+
+ @Constructor("prop")
+ public Foo1(String prop) {
+ }
+ }
+
+ public static class Foo2 {
+ public Foo2(@Autowire String prop,
+ @Autowire String ref) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java
new file mode 100644
index 0000000000..4f99d3b7ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.component;
+
+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;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractSCAObjectTestCase extends TestCase {
+
+ public void testFireListener() {
+ SCAObject object = new TestSCAObject("foo", null);
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ object.addListener(listener);
+ object.publish(event);
+ }
+
+ public void testRemoveListener() {
+ SCAObject object = new TestSCAObject("foo", null);
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ object.addListener(listener);
+ object.removeListener(listener);
+ object.publish(event);
+ }
+
+ public void testFalseFilterListener() {
+ SCAObject object = new TestSCAObject("foo", null);
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ object.addListener(new FalseFilter(), listener);
+ object.publish(event);
+ }
+
+ public void testTrueFilterListener() {
+ SCAObject object = new TestSCAObject("foo", null);
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ object.addListener(new TrueFilter(), listener);
+ object.publish(event);
+ }
+
+ public void testToString() {
+ SCAObject object = new TestSCAObject("foo", null);
+ assertNotNull(object.toString());
+ }
+
+ public void testGetName() {
+ SCAObject object = new TestSCAObject("foo", null);
+ assertEquals("foo", object.getName());
+ }
+
+
+ public void testToPrepare() throws Exception {
+ SCAObject object = new TestSCAObject("foo", null);
+ object.prepare();
+ }
+
+ public void testCanonicalName() {
+ CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
+ EasyMock.expect(parent.getCanonicalName()).andReturn("foo");
+ EasyMock.replay(parent);
+ TestSCAObject test = new TestSCAObject("bar", parent);
+ assertEquals("foo/bar", test.getCanonicalName());
+ }
+
+ private class TestSCAObject extends AbstractSCAObject {
+ public TestSCAObject(String name, CompositeComponent parent) {
+ super(name, parent);
+ }
+
+ public Scope getScope() {
+ return null;
+ }
+
+ }
+
+ private class TestEvent implements Event {
+ public Object getSource() {
+ return null;
+ }
+ }
+
+ private class FalseFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return false;
+ }
+ }
+
+
+}
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.java
new file mode 100644
index 0000000000..40843dea94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DOMHelperTestCase.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.spi.databinding.extension;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class DOMHelperTestCase extends TestCase {
+ private static final QName FOO_NAME = new QName("http://foo", "foo");
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testDOM() throws Exception {
+ DocumentBuilder builder = DOMHelper.newDocumentBuilder();
+ assertNotNull(builder);
+ Document document = DOMHelper.newDocument();
+ assertNotNull(document);
+ Element element = DOMHelper.createElement(document, FOO_NAME);
+ document.appendChild(element);
+ QName name = DOMHelper.getQName(element);
+ assertEquals(FOO_NAME, name);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.java
new file mode 100644
index 0000000000..b78cddf70e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/DataBindingExtensionTestCase.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.spi.databinding.extension;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testExtension() {
+ DataBinding1 binding1 = new DataBinding1(Node.class);
+ assertEquals(Node.class.getName(), binding1.getName());
+ DataType dt1 = new DataType(Element.class, null);
+ assertTrue(binding1.introspect(dt1, null));
+ DataType dt2 = new DataType(String.class, null);
+ assertFalse(binding1.introspect(dt2, null));
+ assertNull(binding1.getWrapperHandler());
+
+ DataBindingRegistry registry = EasyMock.createMock(DataBindingRegistry.class);
+ registry.register(binding1);
+ EasyMock.expect(registry.getDataBinding(Node.class.getName())).andReturn(binding1);
+ EasyMock.replay(registry);
+
+ binding1.setDataBindingRegistry(registry);
+ binding1.init();
+ assertNotNull(registry.getDataBinding(Node.class.getName()));
+
+ DataBinding1 binding2 = new DataBinding1("dom", Node.class);
+ assertEquals("dom", binding2.getName());
+ }
+
+ private static class DataBinding1 extends DataBindingExtension {
+
+ /**
+ * @param baseType
+ */
+ public DataBinding1(Class<?> baseType) {
+ super(baseType);
+ }
+
+ /**
+ * @param name
+ * @param baseType
+ */
+ public DataBinding1(String name, Class<?> baseType) {
+ super(name, baseType);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.java
new file mode 100644
index 0000000000..c3b1f90741
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/SimpleTypeMapperExtensionTestCase.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.spi.databinding.extension;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.easymock.EasyMock;
+
+/**
+ *
+ */
+public class SimpleTypeMapperExtensionTestCase extends TestCase {
+
+ private static final Map<String, Object> SAMPLE_VALUES = new HashMap<String, Object>();
+
+ static {
+ SAMPLE_VALUES.put("anyURI", "http://www.w3.com");
+ SAMPLE_VALUES.put("boolean", new String[] {"true", "false", "1", "0"});
+ SAMPLE_VALUES.put("byte", new String[] {"-128", "127"});
+ SAMPLE_VALUES.put("date", new String[] {"2004-03-15", "2002-09-24-06:00"});
+ SAMPLE_VALUES.put("dateTime", "2003-12-25T08:30:00");
+ SAMPLE_VALUES.put("decimal", "3.1415292");
+ SAMPLE_VALUES.put("double", new String[] {"3.1415292", "INF", "NaN"});
+ SAMPLE_VALUES.put("duration", new String[] {"P8M3DT7H33M2S", "P5Y2M10DT15H"});
+ SAMPLE_VALUES.put("float", new String[] {"3.1415292", "INF", "NaN"});
+ SAMPLE_VALUES.put("gDay", "---11");
+ SAMPLE_VALUES.put("gMonth", "--02--");
+ SAMPLE_VALUES.put("gMonthDay", "--02-14");
+ SAMPLE_VALUES.put("gYear", "1999");
+ SAMPLE_VALUES.put("gYearMonth", "1972-08");
+ SAMPLE_VALUES.put("ID", "id-102");
+ SAMPLE_VALUES.put("IDREF", "id-102");
+ SAMPLE_VALUES.put("IDREFS", "id-102 id-103 id-100");
+ SAMPLE_VALUES.put("int", "77");
+ SAMPLE_VALUES.put("integer", "77");
+ SAMPLE_VALUES.put("long", "214");
+ SAMPLE_VALUES.put("negativeInteger", "-123");
+ SAMPLE_VALUES.put("nonNegativeInteger", "2");
+ SAMPLE_VALUES.put("nonPositiveInteger", "0");
+ SAMPLE_VALUES.put("positiveInteger", "500");
+ SAMPLE_VALUES.put("short", "476");
+ SAMPLE_VALUES.put("string", "Joeseph");
+ SAMPLE_VALUES.put("time", "13:02:00");
+ SAMPLE_VALUES.put("base64Binary", "TWFu");
+ SAMPLE_VALUES.put("hexBinary", "2CDB5F");
+ SAMPLE_VALUES.put("QName", "f:foo");
+ SAMPLE_VALUES.put("NOTATION", "f:bar");
+ }
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testMap() throws Exception {
+ SimpleTypeMapperExtension extension = new SimpleTypeMapperExtension();
+ TransformationContext context = EasyMock.createMock(TransformationContext.class);
+ Map<Class<?>, Object> metaData = new HashMap<Class<?>, Object>();
+ EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
+ EasyMock.replay(context);
+
+ NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
+ EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo")
+ .anyTimes();
+ EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
+ EasyMock.replay(namespaceContext);
+ context.getMetadata().put(NamespaceContext.class, namespaceContext);
+ for (TypeInfo simpleType : SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.values()) {
+ String name = simpleType.getQName().getLocalPart();
+ Object value = SAMPLE_VALUES.get(name);
+ if (value instanceof String[]) {
+ for (String s : (String[])value) {
+ Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
+ String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
+ assertNotNull(str);
+ // assertTrue("[" + name + "] " + s + " " + str,
+ // str.contains((String) s));
+ }
+ } else if (value instanceof String) {
+ Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
+ String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
+ assertNotNull(str);
+ // assertTrue("[" + name + "] " + value + " " + str,
+ // str.contains((String) value));
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.java
new file mode 100644
index 0000000000..6f5dfc90e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/TransformerExtensionTestCase.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.spi.databinding.extension;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.TransformerRegistry;
+import org.easymock.EasyMock;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for TransformerExtension
+ */
+public class TransformerExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testExtension() {
+ MyTransformer transformer = new MyTransformer();
+ assertEquals(Node.class.getName(), transformer.getSourceDataBinding());
+ assertEquals(XMLStreamReader.class.getName(), transformer.getTargetDataBinding());
+ assertEquals(50, transformer.getWeight());
+ TransformerRegistry registry = EasyMock.createMock(TransformerRegistry.class);
+ registry.registerTransformer(EasyMock.isA(Transformer.class));
+ EasyMock
+ .expect(registry.getTransformer(transformer.getSourceDataBinding(), transformer.getTargetDataBinding()))
+ .andReturn(transformer);
+ EasyMock.replay(registry);
+ transformer.setTransformerRegistry(registry);
+ transformer.init();
+ assertSame(transformer, registry.getTransformer(transformer.getSourceDataBinding(), transformer
+ .getTargetDataBinding()));
+ }
+
+ private static class MyTransformer extends TransformerExtension<Node, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.java
new file mode 100644
index 0000000000..4693025c11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverterTestCase.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.spi.databinding.extension;
+
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class XSDDataTypeConverterTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testConvert() throws Exception {
+ XSDDataTypeConverter c = new XSDDataTypeConverter();
+ assertEquals("123", c.parseAnySimpleType(c.printAnySimpleType("123")));
+ assertEquals(true, c.parseBoolean(c.printBoolean(true)));
+ assertEquals(false, c.parseBoolean(c.printBoolean(false)));
+ assertEquals(123.0, c.parseDouble(c.printDouble(123.0)));
+ assertEquals(123.0f, c.parseFloat(c.printFloat(123.0f)));
+ assertEquals(64, c.parseByte(c.printByte((byte)64)));
+ assertEquals(123, c.parseInt(c.printInt(123)));
+ assertEquals(new BigInteger("123456"), c.parseInteger(c.printInteger(new BigInteger("123456"))));
+ assertEquals(123456L, c.parseLong(c.printLong(123456L)));
+ assertEquals((short)123, c.parseShort(c.printShort((short)123)));
+
+ Calendar calendar = new GregorianCalendar();
+ String s = c.printDate(calendar);
+ calendar = (GregorianCalendar)c.parseDate(s);
+ assertEquals(s, c.printDate(calendar));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/event/AbstractEventPublisherTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/event/AbstractEventPublisherTestCase.java
new file mode 100644
index 0000000000..6efd61bea6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/event/AbstractEventPublisherTestCase.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.spi.event;
+
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractEventPublisherTestCase extends TestCase {
+ EventPublisher publisher;
+
+ public void testFireListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ publisher.addListener(listener);
+ publisher.publish(event);
+ EasyMock.verify(publisher);
+ }
+
+ public void testRemoveListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ publisher.addListener(listener);
+ publisher.removeListener(listener);
+ publisher.publish(event);
+ EasyMock.verify(publisher);
+ }
+
+ public void testFalseFilterListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ publisher.addListener(new FalseFilter(), listener);
+ publisher.publish(event);
+ EasyMock.verify(publisher);
+ }
+
+ public void testTrueFilterListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ publisher.addListener(new TrueFilter(), listener);
+ publisher.publish(event);
+ EasyMock.verify(publisher);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ publisher = new AbstractEventPublisher() {
+ };
+ }
+
+ private class TestEvent implements Event {
+ public Object getSource() {
+ return null;
+ }
+ }
+
+ private class FalseFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java
new file mode 100644
index 0000000000..1e81311765
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+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;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AtomicComponentExtensionTestCase extends TestCase {
+
+ public void testIsEagerInit() throws Exception {
+ TestExtension ext = new TestExtension();
+ ext.isEagerInit();
+ }
+
+ public void testPrepare() throws Exception {
+ TestExtension ext = new TestExtension();
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null);
+ InboundInvocationChain chain = EasyMock.createMock(InboundInvocationChain.class);
+ EasyMock.expect(chain.getOperation()).andReturn(operation);
+ chain.prepare();
+ chain.setTargetInvoker(EasyMock.isA(TargetInvoker.class));
+ EasyMock.replay(chain);
+
+ Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
+ chains.put(operation, chain);
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getInvocationChains()).andReturn(chains);
+ EasyMock.expect(wire.getServiceName()).andReturn("Service").atLeastOnce();
+ EasyMock.replay(wire);
+
+ ext.addInboundWire(wire);
+ ext.prepare();
+
+ EasyMock.verify(chain);
+ EasyMock.verify(wire);
+
+ }
+
+ public void testInit() throws Exception {
+ TestExtension ext = new TestExtension();
+ ext.init(null);
+ }
+
+ public void testDestroy() throws Exception {
+ TestExtension ext = new TestExtension();
+ ext.destroy(null);
+ }
+
+ public void testInboundWire() throws Exception {
+ TestExtension ext = new TestExtension();
+ ext.getInboundWire(null);
+ }
+
+ public void testRemoveInstance() throws Exception {
+ ScopeContainer container = EasyMock.createMock(ScopeContainer.class);
+ EasyMock.expect(container.getScope()).andReturn(Scope.COMPOSITE);
+ container.remove(EasyMock.isA(AtomicComponentExtension.class));
+ EasyMock.replay(container);
+ TestExtension ext = new TestExtension(container);
+ ext.removeInstance();
+ EasyMock.verify(container);
+ }
+
+ private class TestExtension extends AtomicComponentExtension {
+ public TestExtension() {
+ super(null, null, null, null, null, null, 0);
+ }
+
+ public TestExtension(ScopeContainer scopeContainer) {
+ super(null, null, null, null, null, null, 0);
+ setScopeContainer(scopeContainer);
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ return null;
+ }
+
+ public Object getTargetInstance() throws TargetResolutionException {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ return new TargetInvoker() {
+
+ public Object invokeTarget(final Object payload, final short sequence)
+ throws InvocationTargetException {
+ return null;
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ return null;
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ };
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.java
new file mode 100644
index 0000000000..54229633eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ComponentTypeLoaderExtensionTestCase.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.spi.extension;
+
+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.Implementation;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeLoaderExtensionTestCase extends TestCase {
+
+ public void testRegistrationDeregistration() throws Exception {
+ Extension loader = new Extension();
+ LoaderRegistry registry = createMock(LoaderRegistry.class);
+ registry.registerLoader(eq(Implementation.class), eq(loader));
+ registry.unregisterLoader(eq(Implementation.class));
+ EasyMock.replay(registry);
+ loader.setLoaderRegistry(registry);
+ loader.start();
+ loader.stop();
+ }
+
+
+ private class Extension extends ComponentTypeLoaderExtension<Implementation> {
+
+ protected Class<Implementation> getImplementationClass() {
+ return Implementation.class;
+ }
+
+ public void load(CompositeComponent parent, Implementation implementation,
+ DeploymentContext deploymentContext) throws LoaderException {
+
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java
new file mode 100644
index 0000000000..9d9df81104
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java
@@ -0,0 +1,302 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+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.ScopeContainer;
+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.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.Wire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentExtensionAutowireTestCase extends TestCase {
+ private CompositeComponent composite;
+ private ServiceContract<?> contract;
+ private ServiceContract<?> contract2;
+
+ public void testAutowireAtomicComponent() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ List<InboundWire> wires = new ArrayList<InboundWire>();
+ wires.add(wire);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(component);
+ composite.register(component);
+ assertEquals(wire, composite.resolveAutowire(Foo.class));
+ }
+
+ public void testAutowireSystemAtomicComponent() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ List<InboundWire> wires = new ArrayList<InboundWire>();
+ wires.add(wire);
+ AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
+ EasyMock.expect(component.getInboundWires()).andReturn(wires).atLeastOnce();
+ EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
+ EasyMock.expect(component.getName()).andReturn("foo").atLeastOnce();
+ EasyMock.replay(component);
+ composite.register(component);
+ assertEquals(wire, composite.resolveSystemAutowire(Foo.class));
+ }
+
+ public void testAutowireSystemCompositeComponent() throws Exception {
+ // configure service
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+
+ // configure system service
+ InboundWire systemWire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(systemWire.getServiceContract()).andReturn(contract2).atLeastOnce();
+ EasyMock.expect(systemWire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(systemWire);
+ ServiceBinding systemBinding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(systemBinding.getInboundWire()).andReturn(systemWire).atLeastOnce();
+ EasyMock.replay(systemBinding);
+ Service systemService = EasyMock.createMock(Service.class);
+ EasyMock.expect(systemService.getName()).andReturn("systemService").atLeastOnce();
+ EasyMock.expect(systemService.isSystem()).andReturn(true).atLeastOnce();
+ systemService.getServiceBindings();
+ List<ServiceBinding> systemBindings = new ArrayList<ServiceBinding>();
+ systemBindings.add(systemBinding);
+ EasyMock.expectLastCall().andReturn(systemBindings).atLeastOnce();
+ EasyMock.replay(systemService);
+
+ CompositeComponent child = new MockComposite(true);
+ child.register(service);
+ child.register(systemService);
+ composite.register(child);
+ // since the child is registered under the system hierarchy, its services should not be visible from the
+ // applicaiton hierarchy
+ assertNull(composite.resolveAutowire(Foo.class));
+ assertEquals(systemWire, composite.resolveSystemAutowire(Bar.class));
+ }
+
+ public void testAutowireCompositeComponent() throws Exception {
+ // configure service
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+
+ // configure system service
+ InboundWire systemWire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(systemWire.getServiceContract()).andReturn(contract2).atLeastOnce();
+ EasyMock.expect(systemWire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(systemWire);
+ ServiceBinding systemBinding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(systemBinding.getInboundWire()).andReturn(systemWire).atLeastOnce();
+ EasyMock.replay(systemBinding);
+ Service systemService = EasyMock.createMock(Service.class);
+ EasyMock.expect(systemService.getName()).andReturn("systemService").atLeastOnce();
+ EasyMock.expect(systemService.isSystem()).andReturn(true).atLeastOnce();
+ systemService.getServiceBindings();
+ List<ServiceBinding> systemBindings = new ArrayList<ServiceBinding>();
+ systemBindings.add(systemBinding);
+ EasyMock.expectLastCall().andReturn(systemBindings).atLeastOnce();
+ EasyMock.replay(systemService);
+
+ CompositeComponent child = new MockComposite();
+ child.register(service);
+ child.register(systemService);
+ composite.register(child);
+ // since the child is registered under the application hierarchy, its services should not be visible from the
+ // system hierarchy
+ assertEquals(wire, composite.resolveAutowire(Foo.class));
+ assertNull(composite.resolveSystemAutowire(Bar.class));
+ }
+
+ public void testAutowireSystemService() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(wire, composite.resolveSystemExternalAutowire(Foo.class));
+ }
+
+ public void testAutowireService() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(wire, composite.resolveExternalAutowire(Foo.class));
+ }
+
+ public void testAutowireReference() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+ reference.getReferenceBindings();
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(reference);
+ composite.register(reference);
+ assertEquals(wire, composite.resolveAutowire(Foo.class));
+ }
+
+ public void testAutowireSystemReference() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(reference.isSystem()).andReturn(true).atLeastOnce();
+ reference.getReferenceBindings();
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(reference);
+ composite.register(reference);
+ assertEquals(wire, composite.resolveSystemAutowire(Foo.class));
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ contract = new ServiceContract<Object>(Foo.class) {
+
+ };
+ contract2 = new ServiceContract<Object>(Bar.class) {
+
+ };
+ composite = new MockComposite();
+ }
+
+ private interface Foo {
+
+ }
+
+ private interface Bar {
+
+ }
+
+ private static class MockComposite extends CompositeComponentExtension {
+ private boolean system;
+
+ public MockComposite() {
+ super("foo", null, null, null);
+ }
+
+ public MockComposite(boolean system) {
+ super("foo", null, null, null);
+ this.system = system;
+ }
+
+ public boolean isSystem() {
+ return system;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java
new file mode 100644
index 0000000000..9eaedb04f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java
@@ -0,0 +1,332 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+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.ScopeContainer;
+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.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+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.Wire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeComponentExtensionTestCase extends TestCase {
+ private CompositeComponent composite;
+ private ServiceContract<?> contract;
+
+ public void testDefaultInboundWire() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(wire, composite.getInboundWire(null));
+ }
+
+ public void testNoLocalBinding() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(new QName("foo", "foo")).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertNull(composite.getInboundWire("service"));
+ }
+
+ public void testDefaultSystemInboundWire() throws Exception {
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
+ service.getServiceBindings();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(wire, composite.getInboundSystemWire(null));
+ }
+
+ public void testMoreThanOneServiceGetDefault() throws Exception {
+ Service service1 = EasyMock.createMock(Service.class);
+ EasyMock.expect(service1.getName()).andReturn("service1").atLeastOnce();
+ EasyMock.expect(service1.isSystem()).andReturn(false).atLeastOnce();
+ service1.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.replay(service1);
+
+ Service service2 = EasyMock.createMock(Service.class);
+ EasyMock.expect(service2.getName()).andReturn("service2").atLeastOnce();
+ EasyMock.expect(service2.isSystem()).andReturn(false).atLeastOnce();
+ service2.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(Collections.emptyList()).atLeastOnce();
+ EasyMock.replay(service2);
+
+ composite.register(service1);
+ composite.register(service2);
+ assertNull(composite.getInboundWire(null));
+ assertNull(composite.getInboundSystemWire(null));
+ }
+
+ public void testInboundWire() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
+ wire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertNotNull(composite.getInboundWire("service"));
+ }
+
+ public void testInboundWires() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
+ wire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(1, composite.getInboundWires().size());
+ }
+
+ public void testInboundWiresNonLocalBinding() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getBindingType()).andReturn(new QName("foo", "foo"));
+ wire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(0, composite.getInboundWires().size());
+ }
+
+
+ public void testGetOutboundWires() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
+ inboundWire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(inboundWire);
+
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.expect(outboundWire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
+ EasyMock.replay(outboundWire);
+
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(inboundWire).atLeastOnce();
+ EasyMock.expect(binding.getOutboundWire()).andReturn(outboundWire).atLeastOnce();
+ EasyMock.replay(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getName()).andReturn("reference").atLeastOnce();
+ EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
+ EasyMock.replay(reference);
+ composite.register(reference);
+ Map<String, List<OutboundWire>> wires = composite.getOutboundWires();
+ assertEquals(1, wires.get("reference").size());
+ }
+
+ public void testGetOutboundWiresWithNonLocalBinding() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ QName qName = new QName("foo", "foo");
+ InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(inboundWire.getBindingType()).andReturn(qName);
+ inboundWire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(inboundWire);
+
+ OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+ outboundWire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.expect(outboundWire.getBindingType()).andReturn(qName);
+ EasyMock.replay(outboundWire);
+
+ ReferenceBinding binding = EasyMock.createMock(ReferenceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(inboundWire).atLeastOnce();
+ EasyMock.expect(binding.getOutboundWire()).andReturn(outboundWire).atLeastOnce();
+ EasyMock.replay(binding);
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.getName()).andReturn("reference").atLeastOnce();
+ EasyMock.expect(reference.isSystem()).andReturn(false).atLeastOnce();
+ List<ReferenceBinding> bindings = new ArrayList<ReferenceBinding>();
+ bindings.add(binding);
+ EasyMock.expect(reference.getReferenceBindings()).andReturn(bindings).atLeastOnce();
+ EasyMock.replay(reference);
+ composite.register(reference);
+ Map<String, List<OutboundWire>> wires = composite.getOutboundWires();
+ assertEquals(0, wires.get("reference").size());
+ }
+
+ public void testInboundSystemWire() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
+ wire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertNotNull(composite.getInboundSystemWire("service"));
+ }
+
+ public void testInboundSystemWires() throws Exception {
+ ServiceContract<Object> contract = new ServiceContract<Object>(Object.class) {
+ };
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.expect(wire.getBindingType()).andReturn(Wire.LOCAL_BINDING);
+ wire.getServiceContract();
+ EasyMock.expectLastCall().andReturn(contract).atLeastOnce();
+ EasyMock.replay(wire);
+ ServiceBinding binding = EasyMock.createMock(ServiceBinding.class);
+ EasyMock.expect(binding.getInboundWire()).andReturn(wire).atLeastOnce();
+ EasyMock.replay(binding);
+
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.getName()).andReturn("service").atLeastOnce();
+ EasyMock.expect(service.isSystem()).andReturn(true).atLeastOnce();
+ List<ServiceBinding> bindings = new ArrayList<ServiceBinding>();
+ bindings.add(binding);
+ service.getServiceBindings();
+ EasyMock.expectLastCall().andReturn(bindings).atLeastOnce();
+ EasyMock.replay(service);
+ composite.register(service);
+ assertEquals(wire, composite.getInboundSystemWires().iterator().next());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ contract = new ServiceContract<Object>(Object.class) {
+
+ };
+ composite = new CompositeComponentExtension("foo", null, null, null) {
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ throws TargetInvokerCreationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.java
new file mode 100644
index 0000000000..84175d8578
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/LoaderExtensionTestCase.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.spi.extension;
+
+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.model.ModelObject;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LoaderExtensionTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testRegistrationDeregistration() throws Exception {
+ LoaderRegistry registry = EasyMock.createMock(LoaderRegistry.class);
+ registry.registerLoader(isA(QName.class), isA(Extension.class));
+ expectLastCall();
+ registry.unregisterLoader(isA(QName.class), isA(Extension.class));
+ expectLastCall();
+ EasyMock.replay(registry);
+ Extension loader = new Extension(registry);
+ loader.start();
+ loader.stop();
+ }
+
+
+ private static class Extension extends LoaderExtension {
+
+ public Extension(LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return new QName("");
+ }
+
+ public ModelObject load(CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ throw new AssertionError();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java
new file mode 100644
index 0000000000..e48d72e7fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java
@@ -0,0 +1,67 @@
+package org.apache.tuscany.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.Reference;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+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 junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceBindingExtensionTestCase extends TestCase {
+
+ public void testScope() throws Exception {
+ ReferenceBindingExtension binding = new MockBindingExtension();
+ assertEquals(Scope.SYSTEM, binding.getScope());
+ }
+
+ public void testPrepare() throws Exception {
+ ReferenceBindingExtension binding = new MockBindingExtension();
+ binding.prepare();
+ }
+
+ public void testIsSystemNoParent() throws Exception {
+ ReferenceBindingExtension binding = new MockBindingExtension();
+ assertFalse(binding.isSystem());
+ }
+
+ public void testIsSystem() throws Exception {
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.isSystem()).andReturn(true);
+ EasyMock.replay(reference);
+ ReferenceBindingExtension binding = new MockBindingExtension();
+ binding.setReference(reference);
+ assertTrue(binding.isSystem());
+ }
+
+ public void testIsNotSystem() throws Exception {
+ Reference reference = EasyMock.createMock(Reference.class);
+ EasyMock.expect(reference.isSystem()).andReturn(false);
+ EasyMock.replay(reference);
+ ReferenceBindingExtension binding = new MockBindingExtension();
+ binding.setReference(reference);
+ assertFalse(binding.isSystem());
+ }
+
+ private static class MockBindingExtension extends ReferenceBindingExtension {
+ public MockBindingExtension() {
+ super(null, null);
+ }
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation)
+ throws TargetInvokerCreationException {
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
new file mode 100644
index 0000000000..60d7a4d908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.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.spi.extension;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.QualifiedName;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundInvocationChain;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceTestCase extends TestCase {
+
+ public void testScope() throws Exception {
+ TestReferenceBinding ref = new TestReferenceBinding();
+ assertEquals(Scope.SYSTEM, ref.getScope());
+ }
+
+ public void testPrepare() throws Exception {
+ InboundInvocationChain chain = createMock(InboundInvocationChain.class);
+ Operation<Type> operation = new Operation<Type>("test", null, null, null, false, null, NO_CONVERSATION);
+ chain.setTargetInvoker(null);
+ expectLastCall();
+ chain.getOperation();
+ expectLastCall().andReturn(operation);
+ chain.prepare();
+ expectLastCall();
+ InboundWire wire = createMock(InboundWire.class);
+ wire.getInvocationChains();
+ Map<Operation, InvocationChain> chains = new HashMap<Operation, InvocationChain>();
+ chains.put(operation, chain);
+ expectLastCall().andReturn(chains);
+ OutboundWire outboundWire = createMock(OutboundWire.class);
+ outboundWire.getTargetName();
+ expectLastCall().andReturn(new QualifiedName("foo/bar"));
+ replay(chain);
+ replay(wire);
+ replay(outboundWire);
+ TestReferenceBinding ref = new TestReferenceBinding();
+ ref.setInboundWire(wire);
+ ref.setOutboundWire(outboundWire);
+ ref.prepare();
+ }
+
+ private class TestReferenceBinding extends ReferenceBindingExtension {
+ public TestReferenceBinding() {
+ super(null, null);
+ }
+
+ public QName getBindingType() {
+ return null;
+ }
+
+ public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
+ return null;
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java
new file mode 100644
index 0000000000..5570ee1fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.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 org.apache.tuscany.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.Service;
+import org.apache.tuscany.spi.model.Scope;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceBindingExtensionTestCase extends TestCase {
+
+ public void testScope() throws Exception {
+ ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ public QName getBindingType() {
+ return null;
+ }
+ };
+ assertEquals(Scope.SYSTEM, binding.getScope());
+ }
+
+ public void testPrepare() throws Exception {
+ ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ public QName getBindingType() {
+ return null;
+ }
+ };
+ binding.prepare();
+ }
+
+ public void testIsSystemNoParent() throws Exception {
+ ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ public QName getBindingType() {
+ return null;
+ }
+ };
+ assertFalse(binding.isSystem());
+ }
+
+ public void testIsSystem() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.isSystem()).andReturn(true);
+ EasyMock.replay(service);
+ ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ public QName getBindingType() {
+ return null;
+ }
+ };
+ binding.setService(service);
+ assertTrue(binding.isSystem());
+ }
+
+ public void testIsNotSystem() throws Exception {
+ Service service = EasyMock.createMock(Service.class);
+ EasyMock.expect(service.isSystem()).andReturn(false);
+ EasyMock.replay(service);
+ ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ public QName getBindingType() {
+ return null;
+ }
+ };
+ binding.setService(service);
+ assertFalse(binding.isSystem());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java
new file mode 100644
index 0000000000..21d5ee763c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionSequenceTestCase.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetInvokerExtensionSequenceTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testStart() {
+ Object from = new Object();
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.replay(wire);
+ WorkContext context;
+ context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCallbackRoutingChain(EasyMock.isA(LinkedList.class));
+ EasyMock.replay(context);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ Target target = EasyMock.createMock(Target.class);
+ target.invokeStart("test");
+ EasyMock.replay(target);
+ Invoker invoker = new Invoker(wire, context, monitor, target);
+ Message msg = new MessageImpl();
+ msg.pushFromAddress(from);
+ msg.setBody("test");
+ msg.setConversationSequence(Invoker.START);
+ invoker.invoke(msg);
+ EasyMock.verify(wire);
+ EasyMock.verify(context);
+ EasyMock.verify(target);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testContinue() {
+ Object from = new Object();
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.replay(wire);
+ WorkContext context;
+ context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCallbackRoutingChain(EasyMock.isA(LinkedList.class));
+ EasyMock.replay(context);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ Target target = EasyMock.createMock(Target.class);
+ target.invokeContinue("test");
+ EasyMock.replay(target);
+ Invoker invoker = new Invoker(wire, context, monitor, target);
+ Message msg = new MessageImpl();
+ msg.pushFromAddress(from);
+ msg.setBody("test");
+ msg.setConversationSequence(Invoker.CONTINUE);
+ invoker.invoke(msg);
+ EasyMock.verify(wire);
+ EasyMock.verify(context);
+ EasyMock.verify(target);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testEnd() {
+ Object from = new Object();
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.replay(wire);
+ WorkContext context;
+ context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCallbackRoutingChain(EasyMock.isA(LinkedList.class));
+ EasyMock.replay(context);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ Target target = EasyMock.createMock(Target.class);
+ target.invokeEnd("test");
+ EasyMock.replay(target);
+ Invoker invoker = new Invoker(wire, context, monitor, target);
+ Message msg = new MessageImpl();
+ msg.pushFromAddress(from);
+ msg.setBody("test");
+ msg.setConversationSequence(Invoker.END);
+ invoker.invoke(msg);
+ EasyMock.verify(wire);
+ EasyMock.verify(context);
+ EasyMock.verify(target);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testNone() {
+ Object from = new Object();
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.replay(wire);
+ WorkContext context;
+ context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCallbackRoutingChain(EasyMock.isA(LinkedList.class));
+ EasyMock.replay(context);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ Target target = EasyMock.createMock(Target.class);
+ target.invokeNone("test");
+ EasyMock.replay(target);
+ Invoker invoker = new Invoker(wire, context, monitor, target);
+ Message msg = new MessageImpl();
+ msg.pushFromAddress(from);
+ msg.setBody("test");
+ invoker.invoke(msg);
+ EasyMock.verify(wire);
+ EasyMock.verify(context);
+ EasyMock.verify(target);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ private class Invoker extends TargetInvokerExtension {
+ private Target target;
+
+ public Invoker(InboundWire wire, WorkContext workContext, ExecutionMonitor monitor,
+ TargetInvokerExtensionSequenceTestCase.Target target) {
+ super(wire, workContext, monitor);
+ this.target = target;
+ }
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ if (sequence == NONE) {
+ target.invokeNone((String) payload);
+ } else if (sequence == START) {
+ target.invokeStart((String) payload);
+ } else if (sequence == CONTINUE) {
+ target.invokeContinue((String) payload);
+ } else if (sequence == END) {
+ target.invokeEnd((String) payload);
+ }
+ return null;
+ }
+ }
+
+ private interface Target {
+ void invokeStart(String msg);
+
+ void invokeContinue(String msg);
+
+ void invokeEnd(String msg);
+
+ void invokeNone(String msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java
new file mode 100644
index 0000000000..56d069005d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/TargetInvokerExtensionTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.extension;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetInvokerExtensionTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testNonBlockingDispatch() {
+ Object from = new Object();
+ InboundWire wire = EasyMock.createMock(InboundWire.class);
+ EasyMock.replay(wire);
+ WorkContext context;
+ context = EasyMock.createMock(WorkContext.class);
+ context.setCurrentCallbackRoutingChain(EasyMock.isA(LinkedList.class));
+ EasyMock.replay(context);
+ ExecutionMonitor monitor = EasyMock.createNiceMock(ExecutionMonitor.class);
+ Target target = EasyMock.createMock(Target.class);
+ target.invoke("test");
+ EasyMock.replay(target);
+ Invoker invoker = new Invoker(wire, context, monitor, target);
+ Message msg = new MessageImpl();
+ msg.pushFromAddress(from);
+ msg.setBody("test");
+ invoker.invoke(msg);
+ EasyMock.verify(wire);
+ EasyMock.verify(context);
+ EasyMock.verify(target);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ private class Invoker extends TargetInvokerExtension {
+ private Target target;
+
+ public Invoker(InboundWire wire, WorkContext workContext, ExecutionMonitor monitor, Target target) {
+ super(wire, workContext, monitor);
+ this.target = target;
+ }
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ target.invoke((String) payload);
+ return null;
+ }
+ }
+
+ private interface Target {
+ void invoke(String msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java
new file mode 100644
index 0000000000..e50c1e32a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.idl.java;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
+import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findOperation;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaIDLUtilsTestCase extends TestCase {
+ private Method[] methods;
+ private List<Operation<?>> operations;
+
+ public void testNoParamsFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertEquals("foo", method.getName());
+ assertEquals(0, method.getParameterTypes().length);
+ }
+
+ public void testNoParamsFindOperation() throws Exception {
+ Method method = Foo.class.getMethod("foo");
+ Operation ret = findOperation(method, operations);
+ assertEquals("foo", ret.getName());
+ assertEquals(0, method.getParameterTypes().length);
+ }
+
+ public void testParamsFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<Type> type = new DataType<Type>(String.class, Object.class);
+ types.add(type);
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertEquals("foo", method.getName());
+ assertEquals(String.class, method.getParameterTypes()[0]);
+ }
+
+ public void testParamsFindOperation() throws Exception {
+ Method method = Foo.class.getMethod("foo", String.class);
+ Operation ret = findOperation(method, operations);
+ assertEquals("foo", ret.getName());
+ assertEquals(String.class, method.getParameterTypes()[0]);
+ }
+
+
+ public void testTooManyParamsFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<Type> type = new DataType<Type>(String.class, Object.class);
+ DataType<Type> type2 = new DataType<Type>(String.class, Object.class);
+ types.add(type);
+ types.add(type2);
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertNull(method);
+ }
+
+ public void testDifferentParamsFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<Type> type = new DataType<Type>(Integer.class, Object.class);
+ types.add(type);
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertNull(method);
+ }
+
+ public void testPrimitiveParamNoFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<Type> type = new DataType<Type>(Integer.class, Object.class);
+ types.add(type);
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertNull(method);
+ }
+
+ public void testPrimitiveParamFindMethod() {
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<Type> type = new DataType<Type>(Integer.TYPE, Object.class);
+ types.add(type);
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ Method method = findMethod(operation, methods);
+ assertEquals("foo", method.getName());
+ assertEquals(Integer.TYPE, method.getParameterTypes()[0]);
+ }
+
+ public void testPrimitiveParamFindOperation() throws NoSuchMethodException {
+ Method method = Foo.class.getMethod("foo", Integer.TYPE);
+ Operation<?> operation = findOperation(method, operations);
+ assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical());
+ }
+
+
+ public void testNotFoundMethod() {
+ Operation<Type> operation = new Operation<Type>("not there", null, null, null, false, null, NO_CONVERSATION);
+ assertNull(findMethod(operation, methods));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ methods = Foo.class.getMethods();
+
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+ operations = new ArrayList<Operation<?>>();
+ operations.add(operation);
+
+ List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+ DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ DataType<Type> type = new DataType<Type>(String.class, Object.class);
+ types.add(type);
+ operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ operations.add(operation);
+
+ types = new ArrayList<DataType<Type>>();
+ type = new DataType<Type>(String.class, Object.class);
+ DataType<Type> type2 = new DataType<Type>(String.class, Object.class);
+ types.add(type);
+ types.add(type2);
+ inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ operations.add(operation);
+
+ types = new ArrayList<DataType<Type>>();
+ type = new DataType<Type>(Integer.class, Object.class);
+ types.add(type);
+ inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ operations.add(operation);
+
+ types = new ArrayList<DataType<Type>>();
+ type = new DataType<Type>(Integer.TYPE, Object.class);
+ types.add(type);
+ inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+ operation = new Operation<Type>("foo", inputType, null, null, false, null, NO_CONVERSATION);
+ operations.add(operation);
+
+ }
+
+ private interface Foo {
+ void foo();
+
+ void foo(String foo);
+
+ void foo(int b);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java
new file mode 100644
index 0000000000..18887880fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessorTestCase.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.implementation.java;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyProcessorTestCase extends TestCase {
+
+ private ImplementationProcessor processor;
+
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(null, method, type, null);
+ JavaMappedProperty<?> prop = type.getProperties().get("test");
+ assertNotNull(prop.getDefaultValueFactory());
+ }
+
+ public void testVisitNoParamsMethod() throws Exception {
+ Method method = Foo.class.getMethod("setNoParamsBar");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalPropertyException e) {
+ //expected
+ }
+ }
+
+ public void testVisitNonVoidMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBadBar", String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (IllegalPropertyException e) {
+ //expected
+ }
+ }
+
+ public void testDuplicateMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitMethod(null, method, type, null);
+ try {
+ processor.visitMethod(null, method, type, null);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ //expected
+ }
+ }
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("d");
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitField(null, field, type, null);
+ JavaMappedProperty<?> prop = type.getProperties().get("test");
+ assertNotNull(prop.getDefaultValueFactory());
+ }
+
+ public void testVisitConstructor() throws Exception {
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> type =
+ new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
+ processor.visitConstructor(null, ctor, type, null);
+ ConstructorDefinition def = type.getConstructorDefinition();
+ assertEquals("test", def.getInjectionNames().get(0));
+ assertNotNull(type.getProperties().get("test"));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ ImplementationProcessorService service = EasyMock.createMock(ImplementationProcessorService.class);
+ service.addName(EasyMock.isA(List.class), EasyMock.eq(0), EasyMock.eq("test"));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ ((List<Object>) EasyMock.getCurrentArguments()[0]).add("test");
+ return null;
+ }
+ });
+ EasyMock.replay(service);
+ processor = new TestProcessor(service);
+ }
+
+ @Retention(RUNTIME)
+ private @interface Bar {
+
+ }
+
+ private class TestProcessor extends AbstractPropertyProcessor<Bar> {
+
+ public TestProcessor(ImplementationProcessorService service) {
+ super(Bar.class, service);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> void initProperty(JavaMappedProperty<T> property,
+ Bar annotation,
+ CompositeComponent parent,
+ DeploymentContext context) {
+ property.setDefaultValueFactory(EasyMock.createMock(ObjectFactory.class));
+ property.setName("test");
+ }
+
+ protected String getName(Bar annotation) {
+ return "test";
+ }
+ }
+
+
+ private static class Foo {
+
+ @Bar
+ protected String d;
+
+ public Foo(String a, @Bar String b) {
+ }
+
+ public Foo(@Bar String d) {
+ this.d = d;
+ }
+
+ @Bar
+ public void setBar(String d) {
+ this.d = d;
+ }
+
+ @Bar
+ public void setNoParamsBar() {
+ }
+
+ @Bar
+ public String setBadBar(String d) {
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.java
new file mode 100644
index 0000000000..f8c991f7d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/loader/LoaderExceptionTestCase.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.spi.loader;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LoaderExceptionTestCase extends TestCase {
+
+ public void testResourceURI() throws Exception {
+ LoaderException e = new LoaderException();
+ e.setResourceURI("test");
+ assertEquals("test", e.getResourceURI());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/CompositeComponentTypeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/CompositeComponentTypeTestCase.java
new file mode 100644
index 0000000000..d348d2b3c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/CompositeComponentTypeTestCase.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.spi.model;
+
+import junit.framework.TestCase;
+
+public class CompositeComponentTypeTestCase extends TestCase {
+
+ public void testWireCreationAndRetrieval() throws Exception {
+ WireDefinition wire1 = new WireDefinition();
+ WireDefinition wire2 = new WireDefinition();
+
+ CompositeComponentType composite = new CompositeComponentType();
+ CompositeComponentType includedComposite = new CompositeComponentType();
+ includedComposite.add(wire1);
+ Include compositeInclude = new Include();
+ compositeInclude.setIncluded(includedComposite);
+
+ composite.add(compositeInclude);
+ composite.add(wire1);
+
+ assertEquals(1, composite.getDeclaredWires().size());
+ assertEquals(wire1, composite.getDeclaredWires().get(0));
+ assertEquals(2, composite.getWires().size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
new file mode 100644
index 0000000000..7bd2e61ba4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
@@ -0,0 +1,16 @@
+package org.apache.tuscany.spi.model;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+public class IntentNameTestCase extends TestCase {
+
+ public void testConstructor() throws Exception {
+ String case1 = "sec.confidentiality/message/body";
+ IntentName intentName = new IntentName(case1);
+ assertEquals("sec", intentName.getDomain());
+ assertEquals(case1, intentName.toString());
+ assertTrue(Arrays.equals(new String[]{"confidentiality", "message", "body"}, intentName.getQualifiedNames()));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/OperationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/OperationTestCase.java
new file mode 100644
index 0000000000..de5f1719b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/OperationTestCase.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.spi.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OperationTestCase extends TestCase {
+
+ public void testClone() throws Exception {
+ DataType<Class> stringType = new DataType<Class>("xml:string", String.class, String.class);
+ List<DataType<Class>> inputTypes = new ArrayList<DataType<Class>>();
+ inputTypes.add(stringType);
+ DataType<List<DataType<Class>>> inputType =
+ new DataType<List<DataType<Class>>>("xml:string", Object[].class, inputTypes);
+
+ DataType<Class> faultType = new DataType<Class>("xml:foo", String.class, String.class);
+ List<DataType<Class>> faultTypes = new ArrayList<DataType<Class>>();
+ faultTypes.add(faultType);
+
+ Operation<Class> operation1 =
+ new Operation<Class>("call", inputType, stringType, faultTypes, true, "xml:string", NO_CONVERSATION);
+ Operation<Class> operation2 = operation1.clone();
+ assertEquals(operation1, operation2);
+ assertEquals(NO_CONVERSATION, operation2.getConversationSequence());
+ assertEquals("call", operation2.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.java
new file mode 100644
index 0000000000..a8a88626ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ScopeTestCase.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.spi.model;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeTestCase extends TestCase {
+
+ public void testEquals() throws Exception {
+ Scope scope = new Scope("COMPOSITE");
+ assertTrue(scope.equals(Scope.COMPOSITE));
+ }
+
+ public void testEqualsNew() throws Exception {
+ Scope foo = new Scope("foo");
+ Scope foo2 = new Scope("FOO");
+ assertTrue(foo.equals(foo2));
+ }
+
+ public void testNotEquals() throws Exception {
+ Scope foo = new Scope("BAR");
+ Scope foo2 = new Scope("FOO");
+ assertFalse(foo.equals(foo2));
+ }
+
+ public void testNotEqualsDifferent() throws Exception {
+ Scope foo = new Scope("FOO");
+ assertFalse(foo.equals(new Bar("FOO")));
+ }
+
+ public class Bar {
+ private String scope;
+
+ public Bar(String scope) {
+ this.scope = scope;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java
new file mode 100644
index 0000000000..72f1e954ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.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.spi.model;
+
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.reflect.Type;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceContractTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testAddOperation() throws Exception {
+ ServiceContract<Type> contract = new TestContract();
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("foo", operation);
+ contract.setOperations(ops);
+ assertEquals(contract, operation.getServiceContract());
+ assertFalse(operation.isCallback());
+ }
+
+ public void testAddCallbackOperation() throws Exception {
+ ServiceContract<Type> contract = new TestContract();
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("foo", operation);
+ contract.setCallbackOperations(ops);
+ assertEquals(contract, operation.getServiceContract());
+ assertTrue(operation.isCallback());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testClone() throws Exception {
+ ServiceContract<Type> contract = new TestContract();
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("foo", operation);
+ contract.setOperations(ops);
+
+ operation = new Operation<Type>("bar", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
+ ops.put("bar", operation);
+ contract.setCallbackOperations(callbackOps);
+
+ ServiceContract<Type> copy = (ServiceContract<Type>) contract.clone();
+ assertEquals(contract, copy);
+ }
+
+ public void testGetOperation() throws Exception {
+ ServiceContract<Type> contract = new TestContract();
+ Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null, NO_CONVERSATION);
+ Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
+ ops.put("foo", operation);
+ contract.setOperations(ops);
+ assertEquals(operation, contract.getOperation("foo"));
+ assertNull(contract.getOperation("bla"));
+ }
+
+ private class TestContract extends ServiceContract<Type> {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.java
new file mode 100644
index 0000000000..9c814483bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/SourcePolicyBuilderExtensionTestCase.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.spi.policy;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.AbstractReferenceDefinition;
+import static org.apache.tuscany.spi.policy.PolicyBuilderRegistry.EXTENSION;
+import org.apache.tuscany.spi.wire.OutboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SourcePolicyBuilderExtensionTestCase extends TestCase {
+
+ public void testRegister() throws Exception {
+ PolicyBuilderRegistry registry = EasyMock.createMock(PolicyBuilderRegistry.class);
+ registry.registerSourceBuilder(EasyMock.eq(EXTENSION), EasyMock.isA(MockPolicyBuilderExtension.class));
+ EasyMock.replay(registry);
+ SourcePolicyBuilderExtension extension = new MockPolicyBuilderExtension();
+ extension.setRegistry(registry);
+ extension.init();
+ EasyMock.verify(registry);
+ }
+
+ private static class MockPolicyBuilderExtension extends SourcePolicyBuilderExtension {
+
+ public void build(AbstractReferenceDefinition definition, OutboundWire wire) throws BuilderException {
+
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtensionTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtensionTestCase.java
new file mode 100644
index 0000000000..58488236e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/policy/TargetPolicyBuilderExtensionTestCase.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.spi.policy;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import static org.apache.tuscany.spi.policy.PolicyBuilderRegistry.EXTENSION;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetPolicyBuilderExtensionTestCase extends TestCase {
+
+ public void testRegister() throws Exception {
+ PolicyBuilderRegistry registry = EasyMock.createMock(PolicyBuilderRegistry.class);
+ registry.registerTargetBuilder(EasyMock.eq(EXTENSION), EasyMock.isA(MockPolicyBuilderExtension.class));
+ EasyMock.replay(registry);
+ TargetPolicyBuilderExtension extension = new MockPolicyBuilderExtension();
+ extension.setRegistry(registry);
+ extension.init();
+ EasyMock.verify(registry);
+ }
+
+ private static class MockPolicyBuilderExtension extends TargetPolicyBuilderExtension {
+
+ public void build(ServiceDefinition definition, InboundWire wire) throws BuilderException {
+
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSCAExternalizable.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSCAExternalizable.java
new file mode 100644
index 0000000000..8c85d4eb95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSCAExternalizable.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.spi.util;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.spi.component.ReactivationException;
+import org.apache.tuscany.spi.component.SCAExternalizable;
+import org.apache.tuscany.spi.component.WorkContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"SerializableHasSerializationMethods"})
+public class MockSCAExternalizable implements Serializable, SCAExternalizable {
+ private static final long serialVersionUID = 5071815222959279772L;
+
+ private WorkContext context;
+ private boolean activated;
+
+ public void setWorkContext(WorkContext context) {
+ this.context = context;
+ }
+
+ public WorkContext getContext() {
+ return context;
+ }
+
+ public void reactivate() throws ReactivationException {
+ activated = true;
+ }
+
+ public boolean isActivated() {
+ return activated;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSerializable.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSerializable.java
new file mode 100644
index 0000000000..3f34e1d0c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/MockSerializable.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.spi.util;
+
+import java.io.Serializable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"SerializableHasSerializationMethods"})
+public class MockSerializable implements Serializable {
+ private static final long serialVersionUID = 4013396228070042469L;
+
+ private MockSCAExternalizable externalizable;
+
+ public MockSerializable() {
+ }
+
+ public MockSCAExternalizable getExternalizable() {
+ return externalizable;
+ }
+
+ public void setExternalizable(MockSCAExternalizable externalizable) {
+ this.externalizable = externalizable;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/SCAObjectInputStreamTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/SCAObjectInputStreamTestCase.java
new file mode 100644
index 0000000000..0a34210b6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/SCAObjectInputStreamTestCase.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.spi.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.spi.component.WorkContext;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCAObjectInputStreamTestCase extends TestCase {
+
+ public void testSCAExternalizable() throws Exception {
+ WorkContext context = EasyMock.createMock(WorkContext.class);
+ MockSCAExternalizable ext = new MockSCAExternalizable();
+ MockSerializable serializable = new MockSerializable();
+ serializable.setExternalizable(ext);
+ ByteArrayOutputStream bas = new ByteArrayOutputStream();
+ ObjectOutputStream o = new ObjectOutputStream(bas);
+ o.writeObject(serializable);
+ o.close();
+ ByteArrayInputStream bytes = new ByteArrayInputStream(bas.toByteArray());
+ SCAObjectInputStream stream = new SCAObjectInputStream(bytes, context);
+ MockSerializable deserialized = (MockSerializable) stream.readObject();
+ MockSCAExternalizable deserializedExt = deserialized.getExternalizable();
+ assertTrue(deserializedExt.isActivated());
+ assertEquals(context, deserializedExt.getContext());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/stax/StaxUtilTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/stax/StaxUtilTestCase.java
new file mode 100644
index 0000000000..87be31b23b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/stax/StaxUtilTestCase.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.spi.util.stax;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for StaxHelper
+ *
+ * @version $Revision$ $Date$
+ *
+ */
+public class StaxUtilTestCase extends TestCase {
+
+ public StaxUtilTestCase(String name) {
+ super(name);
+ }
+
+ public void testSerialize() throws XMLStreamException {
+
+ InputStream in = getClass().getClassLoader().getResourceAsStream("test.scdl");
+ XMLStreamReader reader = StaxUtil.createReader(in);
+ StaxUtil.serialize(reader);
+ // TODO Do assertions
+ }
+
+ public void testGetDocumentElementQName() throws XMLStreamException {
+ InputStream in = getClass().getClassLoader().getResourceAsStream("test.scdl");
+ XMLStreamReader reader = StaxUtil.createReader(in);
+ String xml = StaxUtil.serialize(reader);
+ QName qname = StaxUtil.getDocumentElementQName(xml);
+ assertEquals("http://www.osoa.org/xmlns/sca/1.0", qname.getNamespaceURI());
+ assertEquals("composite", qname.getLocalPart());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..39611054e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractInboundInvocationHandlerTestCase.java
@@ -0,0 +1,55 @@
+package org.apache.tuscany.spi.wire;
+
+import java.lang.reflect.Array;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractInboundInvocationHandlerTestCase extends TestCase {
+
+ public void testInvocation() throws Throwable {
+ InvocationHandler handler = new InvocationHandler();
+ Interceptor interceptor = new MockInterceptor();
+ TargetInvoker invoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.replay(invoker);
+ InboundInvocationChain chain = EasyMock.createMock(InboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
+ EasyMock.replay(chain);
+ Object resp = handler.invoke(chain, invoker, new String[]{"foo"});
+ assertEquals("response", resp);
+ }
+
+
+ private class InvocationHandler extends AbstractInboundInvocationHandler {
+
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ assertNotNull(msg.getCorrelationId());
+ assertNotNull(msg.getTargetInvoker());
+ assertNotNull(msg.getMessageId());
+ assertEquals("foo", Array.get(msg.getBody(), 0));
+ msg.setBody("response");
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java
new file mode 100644
index 0000000000..617a055e78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/AbstractOutboundInvocationHandlerTestCase.java
@@ -0,0 +1,102 @@
+package org.apache.tuscany.spi.wire;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.util.LinkedList;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractOutboundInvocationHandlerTestCase extends TestCase {
+
+ public void testInvocation() throws Throwable {
+ InvocationHandler handler = new InvocationHandler();
+ Interceptor interceptor = new MockInterceptor();
+ TargetInvoker invoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.replay(invoker);
+ OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(interceptor);
+ EasyMock.replay(chain);
+ Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<Object>());
+ assertEquals("response", resp);
+ }
+
+ public void testShortCircuitInvocation() throws Throwable {
+ InvocationHandler handler = new InvocationHandler();
+ TargetInvoker invoker = new MockInvoker();
+ OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.expect(chain.getHeadInterceptor()).andReturn(null);
+ EasyMock.expect(chain.getTargetInvoker()).andReturn(invoker);
+ EasyMock.replay(chain);
+ Object resp = handler.invoke(chain, invoker, new String[]{"foo"}, null, new LinkedList<Object>());
+ assertEquals("response", resp);
+ }
+
+
+ private class MockInvoker implements TargetInvoker {
+
+ public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+ assertEquals("foo", Array.get(payload, 0));
+ return "response";
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ fail();
+ return null;
+ }
+
+ public boolean isCacheable() {
+ return false;
+ }
+
+ public void setCacheable(boolean cacheable) {
+
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ }
+
+ private class InvocationHandler extends AbstractOutboundInvocationHandler {
+
+ protected Object getFromAddress() {
+ return new Object();
+ }
+
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ assertNotNull(msg.getCorrelationId());
+ assertNotNull(msg.getTargetInvoker());
+ assertNotNull(msg.getMessageId());
+ assertNotNull(msg.getCallbackRoutingChain());
+ assertEquals("foo", Array.get(msg.getBody(), 0));
+ msg.setBody("response");
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+
+ }
+
+ public Interceptor getNext() {
+ return null;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/OutboundChainHolderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/OutboundChainHolderTestCase.java
new file mode 100644
index 0000000000..cbce805151
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/OutboundChainHolderTestCase.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.spi.wire;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OutboundChainHolderTestCase extends TestCase {
+
+ public void testClone() {
+ OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
+ EasyMock.replay(chain);
+ OutboundChainHolder holder = new OutboundChainHolder(chain);
+ assertNotNull(holder.clone());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/resources/test.scdl b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/resources/test.scdl
new file mode 100644
index 0000000000..a9ee04b7b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/kernel/spi/src/test/resources/test.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Test for stax.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.scdl">
+
+ <component name="test.component">
+ <system:implementation.system class="test.class"/>
+ <property name="testProperty">123</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/pom.xml
new file mode 100644
index 0000000000..08f75605cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/pom.xml
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Project</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <properties>
+ <sca.version>0.1-integration-incubating-SNAPSHOT</sca.version>
+ <scaKernelVersion>0.1-integration-incubating-SNAPSHOT</scaKernelVersion>
+ <axis2Version>1.1.1</axis2Version>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Tuscany Kernel Modules -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- org.osoa.sca API -->
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- javax.servlet API -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- javax.resource API -->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- commonj.work and commonj.timer APIs -->
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api_r1.1</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- java.xml.stream API -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- StAX implementation -->
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Axis2 Implementation -->
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${axis2Version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>addressing</artifactId>
+ <version>${axis2Version}</version>
+ <package>mar</package>
+ <scope>compile</scope>
+ </dependency>
+ -->
+
+ <!-- AXIOM Implementation -->
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Woden implementation -->
+ <dependency>
+ <groupId>incubator-woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>1.0.0M6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- wsdl4j implementation -->
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ <!-- XmlSchema implementation -->
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.1</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>buildtools</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <configLocation>tuscany-checkstyle.xml</configLocation>
+ <suppressionsLocation>tuscany-suppressions.xml</suppressionsLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+ <linkXRef>false</linkXRef>
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <propertyExpansion>${checkstyle.properties}</propertyExpansion>
+ </configuration>
+ <goals>
+ <goal>checkstyle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <rulesets>
+ <ruleset>${basedir}/.ruleset</ruleset>
+ </rulesets>
+ <linkXRef>false</linkXRef>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx128m</argLine>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix.plugins</groupId>
+ <artifactId>maven-osgi-plugin</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <osgiManifest>
+ <bundleName>${pom.name}</bundleName>
+ <bundleDescription>${pom.description}</bundleDescription>
+ <bundleVendor>${pom.organization.name}</bundleVendor>
+ <bundleLocalization>plugin</bundleLocalization>
+ </osgiManifest>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <jdk>1.5</jdk>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>kernel</module>
+ <module>services</module>
+ <module>extensions</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>kernel</module>
+ <module>services</module>
+ <module>extensions</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>kernel</module>
+ <module>services</module>
+ <module>extensions</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/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/services/databinding/databinding-jaxb/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/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/services/databinding/databinding-jaxb/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/pom.xml
new file mode 100755
index 0000000000..c74f701ea1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-jaxb</artifactId>
+ <name>Apache Tuscany Data Binding for JAXB</name>
+ <description>Tuscany JAXB Data Binding</description>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <!-- Set to 2.1 to make jaxws-maven-plugin happy -->
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.4</version>
+ <scope>runtime</scope>
+ <!-- Relacing stax 1.0 with stax 1.0.1 -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jsr173_api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxb-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>com.sun.tools.xjc.maven2</groupId>
+ <artifactId>maven-jaxb-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <generatePackage>com.example.ipo.jaxb</generatePackage>
+ <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
+ <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
+ <includeSchemas>
+ <includeSchema>ipo.xsd</includeSchema>
+ </includeSchemas>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXB2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXB2Node.java
new file mode 100755
index 0000000000..34f3dbbac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXB2Node.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.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+
+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.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class JAXB2Node extends TransformerExtension<Object, Node> implements PullTransformer<Object, Node> {
+
+ public Node transform(Object source, TransformationContext tContext) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
+ Marshaller marshaller = context.createMarshaller();
+ // FIXME: The default Marshaller doesn't support
+ // marshaller.getNode()
+ Document document = DOMHelper.newDocument();
+ JAXBElement<?> jaxbElement = JAXBContextHelper.createJAXBElement(tContext.getSourceDataType(), source);
+ marshaller.marshal(jaxbElement, document);
+ return document;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBContextHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBContextHelper.java
new file mode 100644
index 0000000000..0fc554d785
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBContextHelper.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.jaxb;
+
+import java.beans.Introspector;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+
+public class JAXBContextHelper {
+ // TODO: Do we need to set them for source and target?
+ public static final String JAXB_CLASSES = "jaxb.classes";
+
+ public static final String JAXB_CONTEXT_PATH = "jaxb.contextPath";
+
+ private JAXBContextHelper() {
+ }
+
+ public static JAXBContext createJAXBContext(TransformationContext tContext, boolean source) throws JAXBException {
+ if (tContext == null)
+ throw new TransformationException("JAXB context is not set for the transformation.");
+
+ // FIXME: We should check the context path or classes
+ // FIXME: What should we do if JAXB is an intermediate node?
+ DataType<?> bindingContext = source ? tContext.getSourceDataType() : tContext.getTargetDataType();
+ String contextPath = (String)bindingContext.getMetadata(JAXB_CONTEXT_PATH);
+ if (contextPath == null) {
+ Operation op = (Operation)bindingContext.getOperation();
+ contextPath = op != null ? (String)op.getMetaData().get(JAXB_CONTEXT_PATH) : null;
+ }
+ JAXBContext context = null;
+ if (contextPath != null) {
+ context = JAXBContext.newInstance(contextPath);
+ } else {
+ Class[] classes = (Class[])bindingContext.getMetadata(JAXB_CLASSES);
+ if (classes != null) {
+ context = JAXBContext.newInstance(classes);
+ } else {
+ Type type = bindingContext.getPhysical();
+ if (type instanceof Class) {
+ Class cls = (Class)type;
+ if (cls.getPackage() != null) {
+ contextPath = cls.getPackage().getName();
+ context = JAXBContext.newInstance(contextPath);
+ }
+ }
+ }
+ }
+ if (context == null) {
+ throw new TransformationException("JAXB context is not set for the transformation.");
+ }
+ return context;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static JAXBElement createJAXBElement(DataType dataType, Object value) {
+ if (value instanceof JAXBElement) {
+ return (JAXBElement)value;
+ } else {
+ Class type = (Class)dataType.getPhysical();
+ Object logical = dataType.getLogical();
+ QName elementName = JAXBDataBinding.ROOT_ELEMENT;
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ } else {
+ /**
+ * Set the declared type to Object.class so that xsi:type
+ * will be produced
+ */
+ type = Object.class;
+ }
+ } else {
+ type = Object.class;
+ }
+ return new JAXBElement(elementName, type, value);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Object createReturnValue(DataType dataType, Object value) {
+ Class<?> cls = getJavaType(dataType);
+ if (cls == JAXBElement.class) {
+ return createJAXBElement(dataType, value);
+ } else {
+ if (value instanceof JAXBElement) {
+ return ((JAXBElement)value).getValue();
+ } else {
+ return value;
+ }
+ }
+ }
+
+ public static Class<?> getJavaType(DataType<?> dataType) {
+ if (dataType == null) {
+ return null;
+ }
+ Type type = dataType.getPhysical();
+ if (type instanceof Class) {
+ Class cls = (Class)type;
+ if (JAXBElement.class.isAssignableFrom(cls)) {
+ return null;
+ } else {
+ return cls;
+ }
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ return (Class)pType.getRawType();
+ }
+ return null;
+ }
+
+ public static XMLType getXmlTypeName(Class<?> javaType) {
+ String namespace = null;
+ String name = null;
+ Package pkg = javaType.getPackage();
+ if (pkg != null) {
+ XmlSchema schema = pkg.getAnnotation(XmlSchema.class);
+ if (schema != null) {
+ namespace = schema.namespace();
+ }
+ }
+ XmlType type = javaType.getAnnotation(XmlType.class);
+ if (type != null) {
+ String typeNamespace = type.namespace();
+ String typeName = type.name();
+
+ if (typeNamespace.equals("##default") && typeName.equals("")) {
+ XmlRootElement rootElement = javaType.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ namespace = rootElement.namespace();
+ } else {
+ // FIXME: The namespace should be from the referencing
+ // property
+ namespace = null;
+ }
+ } else if (typeNamespace.equals("##default")) {
+ // namespace is from the package
+ } else {
+ namespace = typeNamespace;
+ }
+
+ if (typeName.equals("##default")) {
+ name = Introspector.decapitalize(javaType.getSimpleName());
+ } else {
+ name = typeName;
+ }
+ } else {
+ XmlEnum xmlEnum = javaType.getAnnotation(XmlEnum.class);
+ if (xmlEnum != null) {
+ name = Introspector.decapitalize(javaType.getSimpleName());
+ }
+ }
+ if (name == null) {
+ return null;
+ }
+ return new XMLType(null, new QName(namespace, name));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBDataBinding.java
new file mode 100644
index 0000000000..6fc8510717
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBDataBinding.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.databinding.jaxb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.ExceptionHandler;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.w3c.dom.Document;
+
+/**
+ * JAXB DataBinding
+ */
+public class JAXBDataBinding extends DataBindingExtension {
+ public static final String NAME = JAXBElement.class.getName();
+ public static final String[] ALIASES = new String[] {"jaxb"};
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/jaxb/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public JAXBDataBinding() {
+ super(NAME, ALIASES, JAXBElement.class);
+ }
+
+ @Override
+ public boolean introspect(DataType dataType, Annotation[] annotations) {
+ Object physical = dataType.getPhysical();
+ if (!(physical instanceof Class)) {
+ return false;
+ }
+ Class javaType = (Class)physical;
+ if (JAXBElement.class.isAssignableFrom(javaType)) {
+ Type type = javaType.getGenericSuperclass();
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = ((ParameterizedType)type);
+ Type rawType = parameterizedType.getRawType();
+ if (rawType == JAXBElement.class) {
+ Type actualType = parameterizedType.getActualTypeArguments()[0];
+ if (actualType instanceof Class) {
+ XMLType xmlType = JAXBContextHelper.getXmlTypeName((Class)actualType);
+ dataType.setLogical(xmlType);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+ }
+ }
+ dataType.setLogical(XMLType.UNKNOWN);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+
+ XMLType xmlType = JAXBContextHelper.getXmlTypeName(javaType);
+ if (xmlType == null) {
+ return false;
+ }
+ dataType.setLogical(xmlType);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg) {
+ try {
+ boolean isElement = false;
+ Class cls = arg.getClass();
+ if (arg instanceof JAXBElement) {
+ isElement = true;
+ cls = ((JAXBElement)arg).getDeclaredType();
+ } else {
+ arg = new JAXBElement(ROOT_ELEMENT, Object.class, arg);
+ }
+ JAXBContext context = JAXBContext.newInstance(cls);
+ Document doc = DOMHelper.newDocument();
+ context.createMarshaller().marshal(arg, doc);
+ JAXBElement<?> element = context.createUnmarshaller().unmarshal(doc, cls);
+ return isElement ? element : element.getValue();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new JAXBExceptionHandler();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandler.java
new file mode 100644
index 0000000000..6b0c7ab10c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandler.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.databinding.jaxb;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
+
+import org.apache.tuscany.spi.databinding.ExceptionHandler;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * JAXB implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXBExceptionHandler implements ExceptionHandler {
+ private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+
+ /**
+ * <ul>
+ * <li>WrapperException(String message, FaultBean faultInfo) <br>
+ * A constructor where WrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean.
+ * <li> WrapperException(String message, FaultBean faultInfo, Throwable
+ * cause) <br>
+ * A constructor whereWrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean. The last argument, cause, may be used to convey
+ * protocol specific fault information
+ * </ul>
+ */
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ Class exceptionClass = (Class)exceptionType.getPhysical();
+ DataType<?> faultBeanType = exceptionType.getLogical();
+ Class faultBeanClass = (Class)faultBeanType.getPhysical();
+ try {
+ Constructor constructor =
+ exceptionClass.getConstructor(new Class[] {String.class, faultBeanClass, Throwable.class});
+ return (Exception)constructor.newInstance(new Object[] {message, faultInfo, cause});
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ try {
+ Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ return method.invoke(exception, (Object[])null);
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public DataType<?> getFaultType(DataType exDataType) {
+ Class<?> exceptionType = (Class) exDataType.getPhysical();
+ WebFault webFault = exceptionType.getAnnotation(WebFault.class);
+ if (webFault == null) {
+ return null;
+ } else {
+ QName element = new QName(webFault.targetNamespace(), webFault.name());
+ // TODO: Need to determine the fault bean class
+ // String faultBean = webFault.faultBean();
+ Class faultBeanClass = null;
+ try {
+ Method method = exceptionType.getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ faultBeanClass = method.getReturnType();
+ } catch (NoSuchMethodException e) {
+ faultBeanClass = null;
+ }
+ // The logical type of a fault is the QName of the element that the
+ // only part in
+ // the fault message references
+ DataType<XMLType> faultType =
+ new DataType<XMLType>(JAXBDataBinding.NAME, faultBeanClass, new XMLType(element, null));
+ // faultType.setMetadata(ElementInfo.class.getName(), new
+ // ElementInfo(element, null));
+ return faultType;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java
new file mode 100644
index 0000000000..449fc4c75e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.jaxb;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+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.idl.ElementInfo;
+
+/**
+ * JAXB WrapperHandler implementation
+ */
+public class JAXBWrapperHandler implements WrapperHandler<JAXBElement<?>> {
+
+ public JAXBElement<?> create(ElementInfo element, TransformationContext context) {
+ try {
+ // FIXME: How do we map the global element to a factory?
+ String packageName = null;
+ String factoryClassName = packageName + ".ObjectFactory";
+ ClassLoader classLoader = context != null ? context.getClassLoader() : null;
+ if (classLoader == null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader);
+ assert factoryClass.isAnnotationPresent(XmlRegistry.class);
+ Object factory = factoryClass.newInstance();
+ QName elementName = element.getQName();
+ Method method = null;
+ for (Method m : factoryClass.getMethods()) {
+ XmlElementDecl xmlElement = m.getAnnotation(XmlElementDecl.class);
+ QName name = new QName(xmlElement.namespace(), xmlElement.name());
+ if (xmlElement != null && name.equals(elementName)) {
+ method = m;
+ break;
+ }
+ }
+ if (method != null) {
+ Class typeClass = method.getParameterTypes()[0];
+ Object value = typeClass.newInstance();
+ return (JAXBElement<?>)method.invoke(factory, new Object[] {value});
+ } else {
+ throw new TransformationException("ObjectFactory cannot be resolved.");
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public void setChild(JAXBElement<?> wrapper, int i, ElementInfo childElement, Object value) {
+ Object wrapperValue = wrapper.getValue();
+ Class<?> wrapperClass = wrapperValue.getClass();
+
+ XmlType xmlType = wrapperClass.getAnnotation(XmlType.class);
+ String[] properties = xmlType.propOrder();
+ String property = properties[i];
+
+ try {
+ for (Method m : wrapperClass.getMethods()) {
+ if (m.getName().equals("set" + capitalize(property))) {
+ m.invoke(wrapperValue, new Object[] {value});
+ return;
+ }
+ }
+ } catch (Throwable e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ private static String capitalize(String name) {
+ char first = Character.toUpperCase(name.charAt(0));
+ return first + name.substring(1);
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.WrapperHandler#getChildren(java.lang.Object)
+ */
+ public List getChildren(JAXBElement<?> wrapper) {
+ Object wrapperValue = wrapper.getValue();
+ Class<?> wrapperClass = wrapperValue.getClass();
+
+ XmlType xmlType = wrapperClass.getAnnotation(XmlType.class);
+ String[] properties = xmlType.propOrder();
+ List<Object> elements = new ArrayList<Object>();
+ for (String p : properties) {
+ try {
+ Method method = wrapperClass.getMethod("get" + capitalize(p), (Class[])null);
+ Object value = method.invoke(wrapperValue, (Object[])null);
+ elements.add(value);
+ } catch (Throwable e) {
+ throw new TransformationException(e);
+ }
+ }
+ return elements;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..8ad3d38b82
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessor.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.jaxb;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.apache.tuscany.spi.idl.ElementInfo;
+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;
+import org.apache.tuscany.spi.model.WrapperInfo;
+
+/**
+ * The databinding annotation processor for java interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXWSJavaInterfaceProcessor extends JavaInterfaceProcessorExtension {
+
+ public JAXWSJavaInterfaceProcessor() {
+ super();
+ }
+
+ public void visitInterface(Class<?> clazz, Class<?> callbackClass, JavaServiceContract contract)
+ throws InvalidServiceContractException {
+ if (!contract.isRemotable()) {
+ return;
+ }
+ Map<String, Operation<Type>> operations = contract.getOperations();
+ processInterface(clazz, contract, operations);
+ if (callbackClass != null) {
+ Map<String, Operation<Type>> callbackOperations = contract.getCallbackOperations();
+ processInterface(callbackClass, contract, callbackOperations);
+ }
+ }
+
+ private static String getValue(String value, String defaultValue) {
+ return "".equals(value) ? defaultValue : value;
+ }
+
+ private void processInterface(Class<?> clazz, JavaServiceContract contract, Map<String, Operation<Type>> operations) {
+
+ for (Method method : clazz.getMethods()) {
+ Operation<?> operation = operations.get(method.getName());
+
+ WebMethod webMethod = method.getAnnotation(WebMethod.class);
+ if (webMethod == null) {
+ return;
+ }
+
+ String operationName = getValue(webMethod.operationName(), operation.getName());
+
+ RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class);
+ ResponseWrapper responseWrapper = method.getAnnotation(ResponseWrapper.class);
+ if (requestWrapper == null) {
+ return;
+ }
+
+ WebService webService = clazz.getAnnotation(WebService.class);
+ String tns = "";
+ if (webService != null) {
+ tns = webService.targetNamespace();
+ }
+
+ String ns = getValue(requestWrapper.targetNamespace(), tns);
+ String name = getValue(requestWrapper.localName(), operationName);
+ QName inputWrapper = new QName(ns, name);
+
+ ns = getValue(responseWrapper.targetNamespace(), tns);
+ name = getValue(responseWrapper.localName(), operationName + "Response");
+
+ QName outputWrapper = new QName(ns, name);
+
+ WrapperInfo wrapperInfo =
+ new WrapperInfo(JAXBDataBinding.NAME, new ElementInfo(inputWrapper, null),
+ new ElementInfo(outputWrapper, null), null, null);
+ operation.setWrapperStyle(true);
+ operation.setWrapper(wrapperInfo);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Node2JAXB.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Node2JAXB.java
new file mode 100755
index 0000000000..301e316889
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Node2JAXB.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.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+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;
+
+@Service(Transformer.class)
+public class Node2JAXB extends TransformerExtension<Node, Object> implements PullTransformer<Node, Object> {
+
+ public Node2JAXB() {
+ super();
+ }
+
+ public Object transform(Node source, TransformationContext context) {
+ if (source == null)
+ return null;
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Object result = unmarshaller.unmarshal(source);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Reader2JAXB.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Reader2JAXB.java
new file mode 100644
index 0000000000..273c15db1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/Reader2JAXB.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.jaxb;
+
+import java.io.Reader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+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;
+
+@Service(Transformer.class)
+public class Reader2JAXB extends TransformerExtension<Reader, Object> implements
+ PullTransformer<Reader, Object> {
+
+ public Object transform(final Reader source, final TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ StreamSource streamSource = new StreamSource(source);
+ Object result = unmarshaller.unmarshal(streamSource);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/XMLStreamReader2JAXB.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/XMLStreamReader2JAXB.java
new file mode 100755
index 0000000000..3f6a2f64d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/XMLStreamReader2JAXB.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.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+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;
+
+@Service(Transformer.class)
+public class XMLStreamReader2JAXB extends TransformerExtension<XMLStreamReader, Object> implements
+ PullTransformer<XMLStreamReader, Object> {
+
+ public XMLStreamReader2JAXB() {
+ super();
+ }
+
+ public Object transform(XMLStreamReader source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Object result = unmarshaller.unmarshal(source);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/databinding.jaxb.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/databinding.jaxb.scdl
new file mode 100644
index 0000000000..13a33a935c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/databinding.jaxb.scdl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.jaxb.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-jaxb</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.jaxb">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXBDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB" />
+ </component>
+
+ <component name="transformer.Node2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Node2JAXB" />
+ </component>
+
+ <component name="transformer.JAXB2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXB2Node" />
+ </component>
+
+ <component name="transformer.Reader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Reader2JAXB" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..00f321922e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.jaxb">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-jaxb</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="databinding.jaxb">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXBDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB" />
+ </component>
+
+ <component name="transformer.Node2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Node2JAXB" />
+ </component>
+
+ <component name="transformer.JAXB2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXB2Node" />
+ </component>
+
+ <component name="transformer.Reader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Reader2JAXB" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..36f0d251bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.jaxb">
+ <include name="org.apache.tuscany.databinding.jaxb.include" scdlLocation="databinding.jaxb.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
new file mode 100644
index 0000000000..ac12d2f2a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.jaxb;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.jaxb.USAddress;
+import com.example.ipo.jaxb.USState;
+
+/**
+ *
+ */
+public class JAXBDataBindingTestCase extends TestCase {
+ private JAXBDataBinding binding;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new JAXBDataBinding();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Annotation)}.
+ */
+ public final void testIntrospect() {
+ DataType dataType = new DataType(JAXBElement.class, null);
+ boolean yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertTrue(dataType.getPhysical() == JAXBElement.class && dataType.getLogical() == XMLType.UNKNOWN);
+ dataType = new DataType(MockJAXBElement.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(MockJAXBElement.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataType(USAddress.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(USAddress.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataType(USState.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertEquals(USState.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USState"), ((XMLType)dataType.getLogical()).getTypeName());
+
+ }
+
+ private static class MockJAXBElement extends JAXBElement<PurchaseOrderType> {
+
+ private static final long serialVersionUID = -2767569071002707973L;
+
+ /**
+ * @param elementName
+ * @param type
+ * @param value
+ */
+ public MockJAXBElement(QName elementName, Class<PurchaseOrderType> type, PurchaseOrderType value) {
+ super(elementName, type, value);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopy() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> po = factory.createPurchaseOrder(poType);
+ JAXBElement<PurchaseOrderType> copy = (JAXBElement<PurchaseOrderType>)binding.copy(po);
+ assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getName());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonElement() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ poType.setComment("Comment");
+ PurchaseOrderType copy = (PurchaseOrderType)binding.copy(poType);
+ assertTrue(copy instanceof PurchaseOrderType);
+ assertEquals("Comment", ((PurchaseOrderType)copy).getComment());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonRoot() {
+ ObjectFactory factory = new ObjectFactory();
+ USAddress address = factory.createUSAddress();
+ address.setCity("San Jose");
+ USAddress copy = (USAddress)binding.copy(address);
+ assertTrue(copy instanceof USAddress);
+ assertEquals("San Jose", ((USAddress)copy).getCity());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..62990e38a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.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.databinding.jaxb;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault;
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault_Exception;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBExceptionHandlerTestCase extends TestCase {
+ private static final QName ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
+ private JAXBExceptionHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBExceptionHandler();
+ }
+
+ public void testGetFaultType() {
+ DataType exType = new DataType<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> dataType = handler.getFaultType(exType);
+ assertEquals(InvalidSymbolFault.class, dataType.getPhysical());
+ assertEquals(ELEMENT, ((XMLType) dataType.getLogical()).getElementName());
+ assertEquals(JAXBDataBinding.NAME, dataType.getDataBinding());
+ }
+
+ public void testCreate() {
+ DataType execType = new DataType<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> faultType = handler.getFaultType(execType);
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ DataType<DataType> exType = new DataType<DataType>(InvalidSymbolFault_Exception.class, faultType);
+ Exception ex = handler.createException(exType, "Invalid symbol", fault, null);
+ assertTrue(ex instanceof InvalidSymbolFault_Exception);
+ InvalidSymbolFault_Exception exception = (InvalidSymbolFault_Exception)ex;
+ assertEquals("Invalid symbol", exception.getMessage());
+ assertSame(fault, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ InvalidSymbolFault_Exception exception = new InvalidSymbolFault_Exception("Invalid symbol", fault);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(fault, faultInfo);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java
new file mode 100755
index 0000000000..08583d9729
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.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.databinding.jaxb;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+import org.w3c.dom.Node;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+public class JAXBTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ DataType targetDataType = new DataType<Class>(Object.class, null);
+ targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataType<Class>(Object.class, null);
+ sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform2() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ QName root = new QName("http://www.example.com/IPO", "purchaseOrder");
+ DataType targetDataType = new DataType<QName>(PurchaseOrderType.class, root);
+ // targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataType<QName>(PurchaseOrderType.class, root);
+ // sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform3() throws Exception {
+
+ DataType sourceDataType = new DataType<Class>(PurchaseOrderType.class, null);
+ sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ PurchaseOrderType po = new ObjectFactory().createPurchaseOrderType();
+ Node node = t1.transform(po, tContext1);
+
+ Assert.assertNotNull(node);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..d6267013fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.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.databinding.jaxb;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.ElementInfo;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBWrapperHandlerTestCase extends TestCase {
+ private static final QName ELEMENT = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private JAXBWrapperHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBWrapperHandler();
+ }
+
+ public void testCreate() {
+ // ElementInfo element = new ElementInfo(ELEMENT, null);
+ // JAXBElement<?> jaxbElement = handler.create(element, null);
+ }
+
+ public void testSetChild() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ handler.setChild(wrapper, 2, null, "Comment");
+ }
+
+ public void testGetChildren() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ po.setComment("Comment");
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ List children = handler.getChildren(wrapper);
+ assertNotNull(children);
+ assertEquals(4, children.size());
+ assertEquals("Comment", children.get(2));
+ assertNull(children.get(0));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java
new file mode 100644
index 0000000000..240ffaea7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java
@@ -0,0 +1,59 @@
+package org.apache.tuscany.databinding.jaxb.fault;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>
+ * Java class for anonymous complex type.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"message", "symbol"})
+@XmlRootElement(name = "InvalidSymbolFault")
+public class InvalidSymbolFault {
+
+ @XmlElement(required = true)
+ protected String message;
+ @XmlElement(required = true)
+ protected String symbol;
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+ /**
+ * Gets the value of the symbol property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getSymbol() {
+ return symbol;
+ }
+
+ /**
+ * Sets the value of the symbol property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSymbol(String value) {
+ this.symbol = value;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..4a7d8d8660
--- /dev/null
+++ b/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
@@ -0,0 +1,44 @@
+package org.apache.tuscany.databinding.jaxb.fault;
+
+import javax.xml.ws.WebFault;
+
+/**
+ * This class was generated by the JAXWS SI. JAX-WS RI 2.1-02/02/2007 09:55
+ * AM(vivekp)-FCS Generated source version: 2.1
+ */
+@WebFault(name = "InvalidSymbolFault", targetNamespace = "http://www.example.com/stock")
+public class InvalidSymbolFault_Exception extends Exception {
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @param faultInfo
+ * @param message
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-jaxb/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/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/services/databinding/databinding-json/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/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/services/databinding/databinding-json/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/pom.xml
new file mode 100644
index 0000000000..9ebe626bd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-json</artifactId>
+ <name>Apache Tuscany Data Binding for JSON</name>
+ <description>Tuscany JSON Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0-beta-1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.java
new file mode 100644
index 0000000000..e48e8dbf27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSON2XMLStreamReader.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.json;
+
+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.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class JSON2XMLStreamReader extends TransformerExtension<JSONObject, XMLStreamReader> implements
+ PullTransformer<JSONObject, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return JSONObject.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(JSONObject source, TransformationContext context) {
+ try {
+ return new BadgerFishXMLStreamReader(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.java
new file mode 100644
index 0000000000..2cc8c1da37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/JSONDataBinding.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.databinding.json;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.json.JSONObject;
+
+/**
+ * JAXB DataBinding
+ */
+public class JSONDataBinding extends DataBindingExtension {
+ public static final String NAME = JSONObject.class.getName();
+ public static final String[] ALIASES = new String[] {"json"};
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/json/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public JSONDataBinding() {
+ super(NAME, ALIASES, JSONObject.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg) {
+ try {
+ JSONObject src = (JSONObject)arg;
+ return new JSONObject(src.toString());
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.java
new file mode 100644
index 0000000000..872fe1cff3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamReader2JSON.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.databinding.json;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class XMLStreamReader2JSON extends TransformerExtension<XMLStreamReader, JSONObject> implements
+ PullTransformer<XMLStreamReader, JSONObject> {
+
+ @Override
+ protected Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return JSONObject.class;
+ }
+
+ public JSONObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(source, jsonWriter);
+ return new JSONObject(writer.toString());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java
new file mode 100644
index 0000000000..74c39cba0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/XMLStreamSerializer.java
@@ -0,0 +1,272 @@
+package org.apache.tuscany.databinding.json;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * The XMLStreamSerializer pulls events from the XMLStreamReader and dumps into the XMLStreamWriter
+ */
+public class XMLStreamSerializer implements XMLStreamConstants {
+ public static final String NAMESPACE_PREFIX = "ns";
+ private static int namespaceSuffix;
+
+ /*
+ * The behavior of the serializer is such that it returns when it encounters the starting element for the second
+ * time. The depth variable tracks the depth of the serilizer and tells it when to return. Note that it is assumed
+ * that this serialization starts on an Element.
+ */
+
+ /**
+ * Field depth
+ */
+ private int depth;
+
+ /**
+ * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
+ *
+ * @param nsCtxt
+ * @return string
+ */
+ private String generateUniquePrefix(NamespaceContext nsCtxt) {
+ String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ // null should be returned if the prefix is not bound!
+ while (nsCtxt.getNamespaceURI(prefix) != null) {
+ prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+ }
+
+ return prefix;
+ }
+
+ /**
+ * Method serialize.
+ *
+ * @param node
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void serialize(XMLStreamReader node, XMLStreamWriter writer) throws XMLStreamException {
+ serializeNode(node, writer);
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeAttributes(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ int count = reader.getAttributeCount();
+ String prefix;
+ String namespaceName;
+ String writerPrefix;
+ for (int i = 0; i < count; i++) {
+ prefix = reader.getAttributePrefix(i);
+ namespaceName = reader.getAttributeNamespace(i);
+ /*
+ * Due to parser implementations returning null as the namespace URI (for the empty namespace) we need to
+ * make sure that we deal with a namespace name that is not null. The best way to work around this issue is
+ * to set the namespace uri to "" if it is null
+ */
+ if (namespaceName == null) {
+ namespaceName = "";
+ }
+
+ writerPrefix = writer.getNamespaceContext().getPrefix(namespaceName);
+
+ if (!"".equals(namespaceName)) {
+ // prefix has already being declared but this particular
+ // attrib has a
+ // no prefix attached. So use the prefix provided by the
+ // writer
+ if (writerPrefix != null && (prefix == null || prefix.equals(""))) {
+ writer.writeAttribute(writerPrefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // writer prefix is available but different from the
+ // current
+ // prefix of the attrib. We should be decalring the new
+ // prefix
+ // as a namespace declaration
+ } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) {
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+
+ // prefix is null (or empty), but the namespace name is
+ // valid! it has not
+ // being written previously also. So we need to generate
+ // a prefix
+ // here
+ } else if (prefix == null || prefix.equals("")) {
+ prefix = generateUniquePrefix(writer.getNamespaceContext());
+ writer.writeNamespace(prefix, namespaceName);
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ } else {
+ writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
+ .getAttributeValue(i));
+ }
+ } else {
+ // empty namespace is equal to no namespace!
+ writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i));
+ }
+
+ }
+ }
+
+ /**
+ * Method serializeCData.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeCData(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCData(reader.getText());
+ }
+
+ /**
+ * Method serializeComment.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeComment(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeComment(reader.getText());
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeElement(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix = reader.getPrefix();
+ String nameSpaceName = reader.getNamespaceURI();
+ if (nameSpaceName != null) {
+ String writerPrefix = writer.getPrefix(nameSpaceName);
+ if (writerPrefix != null) {
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ } else {
+ if (prefix != null) {
+ writer.writeStartElement(prefix, reader.getLocalName(), nameSpaceName);
+ writer.writeNamespace(prefix, nameSpaceName);
+ writer.setPrefix(prefix, nameSpaceName);
+ } else {
+ // [rfeng] We need to set default NS 1st before calling writeStateElement
+ writer.setDefaultNamespace(nameSpaceName);
+ writer.writeStartElement(nameSpaceName, reader.getLocalName());
+ writer.writeDefaultNamespace(nameSpaceName);
+ }
+ }
+ } else {
+ writer.writeStartElement(reader.getLocalName());
+ }
+
+ // add the namespaces
+ int count = reader.getNamespaceCount();
+ String namespacePrefix;
+ for (int i = 0; i < count; i++) {
+ namespacePrefix = reader.getNamespacePrefix(i);
+ // [rfeng] The following is commented out to allow to default ns
+ // if (namespacePrefix != null && namespacePrefix.length() == 0) {
+ // continue;
+ // }
+
+ serializeNamespace(namespacePrefix, reader.getNamespaceURI(i), writer);
+ }
+
+ // add attributes
+ serializeAttributes(reader, writer);
+
+ }
+
+ /**
+ * Method serializeEndElement.
+ *
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeEndElement(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ /**
+ * Method serializeNamespace.
+ *
+ * @param prefix
+ * @param uri
+ * @param writer
+ * @throws XMLStreamException
+ */
+ private void serializeNamespace(String prefix, String uri, XMLStreamWriter writer) throws XMLStreamException {
+ String prefix1 = writer.getPrefix(uri);
+ if (prefix1 == null) {
+ writer.writeNamespace(prefix, uri);
+ writer.setPrefix(prefix, uri);
+ }
+ }
+
+ /**
+ * Method serializeNode.
+ *
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ // TODO We get the StAXWriter at this point and uses it hereafter
+ // assuming that this is the only entry point
+ // to this class.
+ // If there can be other classes calling methodes of this we might
+ // need to change methode signatures to
+ // OMOutputer
+ while (true) {
+ int event = reader.getEventType();
+ if (event == START_ELEMENT) {
+ serializeElement(reader, writer);
+ depth++;
+ } else if (event == ATTRIBUTE) {
+ serializeAttributes(reader, writer);
+ } else if (event == CHARACTERS) {
+ serializeText(reader, writer);
+ } else if (event == COMMENT) {
+ serializeComment(reader, writer);
+ } else if (event == CDATA) {
+ serializeCData(reader, writer);
+ } else if (event == END_ELEMENT) {
+ serializeEndElement(writer);
+ depth--;
+ } else if (event == START_DOCUMENT) {
+ depth++; // if a start document is found then increment
+ writer.writeStartDocument();
+ // the depth
+ } else if (event == END_DOCUMENT) {
+ if (depth != 0) {
+ depth--; // for the end document - reduce the depth
+ }
+ writer.writeEndDocument();
+ }
+ if (depth == 0) {
+ break;
+ }
+ if (reader.hasNext()) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ }
+
+ /**
+ * @param reader
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeCharacters(reader.getText());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.java
new file mode 100644
index 0000000000..3ad5cca3f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSON2OMElement.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.databinding.json.axiom;
+
+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.databinding.json.JSONDataBinding;
+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.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class JSON2OMElement extends TransformerExtension<JSONObject, OMElement> implements
+ PullTransformer<JSONObject, OMElement> {
+
+ private OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ @Override
+ protected Class getSourceType() {
+ return JSONObject.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public OMElement transform(JSONObject source, TransformationContext context) {
+ try {
+ String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
+ String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
+ if (context != null) {
+ DataType<?> dataType = context.getTargetDataType();
+ Object logical = dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement()) {
+ ns = xmlType.getElementName().getNamespaceURI();
+ name = xmlType.getElementName().getLocalPart();
+ }
+ }
+ }
+ JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(source);
+ OMNamespace namespace = factory.createOMNamespace(ns, "");
+ return factory.createOMElement(ds, name, namespace);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.java
new file mode 100644
index 0000000000..22476b10af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONBadgerfishDataSource.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.databinding.json.axiom;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Badgerfish" JSON convention.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class JSONBadgerfishDataSource extends JSONDataSource {
+
+ public JSONBadgerfishDataSource(JSONObject json) {
+ super(json);
+ }
+
+ /**
+ * Gives the StAX reader using the "Badgerfish" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+ public javax.xml.stream.XMLStreamReader getReader() throws XMLStreamException {
+ try {
+ return new BadgerFishXMLStreamReader(json);
+ } catch (JSONException e) {
+ throw new XMLStreamException(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java
new file mode 100644
index 0000000000..744c5a407e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/java/org/apache/tuscany/databinding/json/axiom/JSONDataSource.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.databinding.json.axiom;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMOutputFormat;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+
+/**
+ * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
+ * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
+ * This uses the "Mapped" JSON convention.
+ */
+
+public class JSONDataSource implements OMDataSource {
+ protected JSONObject json;
+
+ public JSONDataSource(JSONObject json) {
+ this.json = json;
+ }
+
+ /**
+ * Writes JSON into the output stream. As this should write JSON, it directly gets the JSON string and writes it
+ * without expanding the tree.
+ *
+ * @param outputStream the stream to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message in to the output
+ * stream.
+ */
+ public void serialize(OutputStream outputStream, OMOutputFormat omOutputFormat)
+ throws javax.xml.stream.XMLStreamException {
+ try {
+ String encoding = omOutputFormat == null ? "UTF-8" : omOutputFormat.getCharSetEncoding();
+ outputStream.write(getJSONString().getBytes(encoding));
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes JSON through the writer. As this should write JSON, it directly gets the JSON string and writes it without
+ * expanding the tree.
+ *
+ * @param writer Writer to be written into
+ * @param omOutputFormat format of the message, this is ignored.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the writer.
+ */
+ public void serialize(Writer writer, OMOutputFormat omOutputFormat) throws javax.xml.stream.XMLStreamException {
+ try {
+ writer.write(getJSONString());
+ } catch (IOException e) {
+ throw new OMException();
+ }
+ }
+
+ /**
+ * Writes XML through the XMLStreamWriter. As the input data source is JSON, this method needs to get a StAX reader
+ * from that JSON String. Therefore this uses the getReader() method to get the StAX reader writes the events into
+ * the XMLStreamWriter.
+ *
+ * @param xmlStreamWriter StAX writer to be written into
+ * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the StAX
+ * writer.
+ */
+ public void serialize(javax.xml.stream.XMLStreamWriter xmlStreamWriter) throws javax.xml.stream.XMLStreamException {
+ XMLStreamReader reader = getReader();
+ xmlStreamWriter.writeStartDocument();
+ while (reader.hasNext()) {
+ int x = reader.next();
+ switch (x) {
+ case XMLStreamConstants.START_ELEMENT:
+ xmlStreamWriter.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader
+ .getNamespaceURI());
+ int namespaceCount = reader.getNamespaceCount();
+ for (int i = namespaceCount - 1; i >= 0; i--) {
+ xmlStreamWriter.writeNamespace(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
+ }
+ int attributeCount = reader.getAttributeCount();
+ for (int i = 0; i < attributeCount; i++) {
+ xmlStreamWriter.writeAttribute(reader.getAttributePrefix(i),
+ reader.getAttributeNamespace(i),
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
+ }
+ break;
+ case XMLStreamConstants.START_DOCUMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ xmlStreamWriter.writeCharacters(reader.getText());
+ break;
+ case XMLStreamConstants.CDATA:
+ xmlStreamWriter.writeCData(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ xmlStreamWriter.writeEndElement();
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ xmlStreamWriter.writeEndDocument();
+ break;
+ case XMLStreamConstants.SPACE:
+ break;
+ case XMLStreamConstants.COMMENT:
+ xmlStreamWriter.writeComment(reader.getText());
+ break;
+ case XMLStreamConstants.DTD:
+ xmlStreamWriter.writeDTD(reader.getText());
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ xmlStreamWriter.writeProcessingInstruction(reader.getPITarget(), reader.getPIData());
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ xmlStreamWriter.writeEntityRef(reader.getLocalName());
+ break;
+ default:
+ throw new OMException();
+ }
+ }
+ xmlStreamWriter.writeEndDocument();
+ }
+
+ /**
+ * Gives the StAX reader using the "Mapped" formatted input JSON String.
+ *
+ * @return The XMLStreamReader according to the JSON String.
+ * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
+ */
+
+ public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException {
+
+ Map<String, String> nsMap = new HashMap<String, String>();
+ nsMap.put("", "");
+
+ // input factory for "Mapped" convention
+ MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
+ String jsonString = this.getJSONString();
+ return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
+ }
+
+ // returns the json string by consuming the JSON input stream.
+ protected String getJSONString() {
+ return json.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl
new file mode 100644
index 0000000000..d8994b3058
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/databinding.json.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.json.include">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.json.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..52bd695f67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.json">
+ <include name="org.apache.tuscany.databinding.json.include" scdlLocation="databinding.json.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java
new file mode 100644
index 0000000000..6d7b5a8aed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/java/org/apache/tuscany/databinding/json/JSONTransformerTestCase.java
@@ -0,0 +1,91 @@
+package org.apache.tuscany.databinding.json;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.databinding.json.axiom.JSON2OMElement;
+import org.json.JSONObject;
+import org.junit.Test;
+
+public class JSONTransformerTestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private static final String JSON_STR =
+ "{\"xsl:root\":{\"@xmlns\":{\"xsl\":\"http://foo.com\"},\"data\":{\"$\":\"my json string\"}}}";
+
+ @Test
+ public void testXML2JSON() throws Exception {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2JSON t1 = new XMLStreamReader2JSON();
+ JSONObject json = t1.transform(reader, null);
+ Assert.assertNotNull(json);
+
+ // Cannot round-trip as we hit a bug in Jettison
+
+ JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
+ XMLStreamReader reader2 = t2.transform(json, null);
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ new XMLStreamSerializer().serialize(reader2, streamWriter);
+ streamWriter.flush();
+ System.out.println(sw.toString());
+
+ }
+
+ @Test
+ public void testJSON2XML() throws Exception {
+ JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
+ XMLStreamReader reader2 = t2.transform(new JSONObject(JSON_STR), null);
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
+ new XMLStreamSerializer().serialize(reader2, streamWriter);
+ streamWriter.flush();
+ Assert.assertEquals("<xsl:root xmlns:xsl=\"http://foo.com\"><data>my json string</data></xsl:root>", sw
+ .toString());
+ }
+
+ @Test
+ public void testJSON2OMElement() throws Exception {
+ JSON2OMElement t1 = new JSON2OMElement();
+ OMElement element = t1.transform(new JSONObject(JSON_STR), null);
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ System.out.println(writer.toString());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-json/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.checkstyle
new file mode 100644
index 0000000000..142759d295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.checkstyle
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/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/services/databinding/databinding-sdo-axiom/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/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/services/databinding/databinding-sdo-axiom/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/pom.xml
new file mode 100644
index 0000000000..b0c7107d5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/pom.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-sdo-axiom</artifactId>
+ <name>Apache Tuscany Data Binding for SDO</name>
+ <description>Data Binding based on SDO.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-po-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
+ <javaPackage>com.example.ipo.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-stock-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ <prefix>Stock</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElement.java
new file mode 100644
index 0000000000..4d9a2688d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElement.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.databinding.sdo2om;
+
+import static org.apache.tuscany.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
+
+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.databinding.sdo.SDOContextHelper;
+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.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * SDO DataObject --> AXIOM OMElement transformer
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class DataObject2OMElement extends TransformerExtension<DataObject, OMElement> implements
+ PullTransformer<DataObject, OMElement> {
+
+ public OMElement transform(DataObject source, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ SDODataSource dataSource = new SDODataSource(source, helperContext);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ OMNamespace namespace = null;
+ String localName = ROOT_ELEMENT.getLocalPart();
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement()) {
+ namespace =
+ factory.createOMNamespace(xmlType.getElementName().getNamespaceURI(), xmlType.getElementName()
+ .getPrefix());
+ localName = xmlType.getElementName().getLocalPart();
+ }
+ }
+ }
+ if (namespace == null) {
+ namespace =
+ factory.createOMNamespace(ROOT_ELEMENT.getNamespaceURI(), ROOT_ELEMENT.getPrefix());
+ }
+
+ OMElement element = factory.createOMElement(dataSource, localName, namespace);
+ return element;
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObjectSerializer.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObjectSerializer.java
new file mode 100644
index 0000000000..7997d72002
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/DataObjectSerializer.java
@@ -0,0 +1,408 @@
+package org.apache.tuscany.databinding.sdo2om;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sdo.impl.AttributeImpl;
+import org.apache.tuscany.sdo.impl.ReferenceImpl;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XSDHelper;
+
+public class DataObjectSerializer {
+ private static final String ELEMENT_TEXT = "Text Element";
+
+ // static final String ELEMENT_TEXT = "Element Text";
+ private static final QName XSI_TYPE_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "type", "xsi");
+
+ private Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
+
+ private NameSpaceContextImpl namespaceContext = new NameSpaceContextImpl();
+
+ private DataObject rootDataObject;
+
+ private String rootElementName;
+
+ private String rootElementURI;
+
+ private XMLStreamWriter xmlWriter;
+
+ private XSDHelper xsdHelper;
+
+ public DataObjectSerializer(DataObject rootObject,
+ XMLStreamWriter xmlWriter,
+ HelperContext helperCtx,
+ TransformationContext context) {
+ this.xmlWriter = xmlWriter;
+ this.rootDataObject = rootObject;
+ this.xsdHelper = helperCtx.getXSDHelper();
+ this.rootElementName = xsdHelper.getLocalName(rootObject.getType());
+ this.rootElementURI = rootDataObject.getType().getURI();
+
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object targetQName = dataType == null ? null : dataType.getLogical();
+ if (targetQName instanceof QName) {
+ QName name = (QName)targetQName;
+ this.rootElementName = name.getLocalPart();
+ this.rootElementURI = name.getNamespaceURI();
+ }
+ }
+
+ }
+
+ // private void serializeNamespace(String prefix, String URI,
+ // XMLStreamWriter writer) throws XMLStreamException {
+ // String prefix1 = writer.getPrefix(URI);
+ // if (prefix1 == null) {
+ // writer.writeNamespace(prefix, URI);
+ // writer.setPrefix(prefix, URI);
+ // }
+ // }
+
+ public DataObjectSerializer(XMLDocument sourceDocument, XMLStreamWriter xmlWriter, HelperContext helperCtx) {
+ this.xmlWriter = xmlWriter;
+ this.rootDataObject = sourceDocument.getRootObject();
+ this.rootElementName = sourceDocument.getRootElementName();
+ this.rootElementURI = sourceDocument.getRootElementURI();
+ this.xsdHelper = helperCtx.getXSDHelper();
+ }
+
+ protected class NameSpaceContextImpl implements NamespaceContext {
+ private int counter;
+
+ private Map<String, String> prefixToNamespaceMapping = new HashMap<String, String>();
+
+ public NameSpaceContextImpl() {
+ prefixToNamespaceMapping.put("xml", "http://www.w3.org/XML/1998/namespace");
+ prefixToNamespaceMapping.put("xmlns", "http://www.w3.org/2000/xmlns/");
+ prefixToNamespaceMapping.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ }
+
+ public synchronized QName createQName(String nsURI, String name) {
+ String prefix = nsURI != null ? (String)getPrefix(nsURI) : null;
+ if (prefix == null && nsURI != null && !nsURI.equals("")) {
+ prefix = "p" + (counter++);
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ if (nsURI != null) {
+ prefixToNamespaceMapping.put(prefix, nsURI);
+ declaredNamespaceMap.put(prefix, nsURI);
+ }
+ return new QName(nsURI, name, prefix);
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ }
+
+ String ns = (String)prefixToNamespaceMapping.get(prefix);
+ if (ns != null) {
+ return ns;
+ } else {
+ return null;
+ }
+ }
+
+ public String getPrefix(String nsURI) {
+ if (nsURI == null) {
+ throw new IllegalArgumentException("Namespace is null");
+ }
+ for (Iterator i = prefixToNamespaceMapping.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry)i.next();
+ if (entry.getValue().equals(nsURI)) {
+ return (String)entry.getKey();
+ }
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(String nsURI) {
+ List prefixList = new ArrayList();
+ for (Iterator i = prefixToNamespaceMapping.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry)i.next();
+ if (entry.getValue().equals(nsURI)) {
+ prefixList.add(entry.getKey());
+ }
+ }
+ return prefixList.iterator();
+ }
+
+ public void registerMapping(String prefix, String nsURI) {
+ prefixToNamespaceMapping.put(prefix, nsURI);
+ }
+
+ public void removeMapping(String prefix) {
+ prefixToNamespaceMapping.remove(prefix);
+ }
+ }
+
+ protected static class NameValuePair implements Map.Entry {
+ private Object key;
+
+ private Object value;
+
+ public NameValuePair(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ Object v = this.value;
+ this.value = value;
+ return v;
+ }
+
+ }
+
+ private static boolean isTransient(Property property, Object type) {
+ // HACK: We need some SDOUtil extension to understand a property is
+ // derived
+ EStructuralFeature feature = (EStructuralFeature)property;
+ if (ExtendedMetaData.INSTANCE.getGroup(feature) != null) {
+ return false;
+ }
+ feature = ExtendedMetaData.INSTANCE.getAffiliation((EClass)type, feature);
+ if (feature != null && feature != property) {
+ return false;
+ }
+ if (property instanceof ReferenceImpl) {
+ ReferenceImpl r = (ReferenceImpl)property;
+ if (r.isTransient()) {
+ return true;
+ }
+ EReference opposite = r.getEOpposite();
+ if (opposite != null && opposite.isContainment()) {
+ return true;
+ }
+ } else if (property instanceof AttributeImpl) {
+ AttributeImpl a = (AttributeImpl)property;
+ if (a.isTransient()) {
+ return true;
+ }
+ EDataType d = (EDataType)a.getEType();
+ if (!d.isSerializable()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addListValue(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ List objList) throws XMLStreamException {
+ if (objList != null) {
+ for (int j = 0; j < objList.size(); j++) {
+ Object object = objList.get(j);
+ addSingleValue(propertyList, children, property, object);
+ }
+ }
+ }
+
+ private void addProperty(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ Object value,
+ DataObject dataObject) throws XMLStreamException {
+
+ if (property.isMany() && property.getContainingType().isOpen() && value instanceof Sequence) {
+ addSequenceValue(propertyList, children, (Sequence)value);
+ } else if (SDOUtil.isMany(property, dataObject) && value instanceof List) {
+ addListValue(propertyList, children, property, (List)value);
+ } else {
+ // Complex Type
+ addSingleValue(propertyList, children, property, value);
+ }
+ }
+
+ private void addSequenceValue(List<NameValuePair> elements, List<DataObject> children, Sequence seq)
+ throws XMLStreamException {
+ if (seq != null && seq.size() > 0) {
+ for (int j = 0; j < seq.size(); j++) {
+ Object o = seq.getValue(j);
+ Property p = seq.getProperty(j);
+ addSingleValue(elements, children, p, o);
+ }
+ }
+ }
+
+ private void addSingleValue(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ Object value) throws XMLStreamException {
+ String uri = xsdHelper.getNamespaceURI(property);
+ String name = xsdHelper.getLocalName(property);
+ QName qname = namespaceContext.createQName(uri, name);
+ Type propertyType = property.getType();
+
+ if (property.getName().equals("value") && uri == null && name.equals(":0")) {
+ propertyList.add(new NameValuePair(ELEMENT_TEXT, value.toString()));
+ } else if (value == null) {
+ NameValuePair entry = new NameValuePair(qname, null);
+ propertyList.add(entry);
+ } else if (propertyType.isDataType()) {
+ NameValuePair entry = new NameValuePair(qname, SDOUtil.convertToString(propertyType, value));
+ propertyList.add(entry);
+ } else {
+ children.add((DataObject)value);
+ }
+ }
+
+ private void registerNamespace(String prefix, String uri) {
+ if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
+ namespaceContext.registerMapping(prefix, uri);
+ declaredNamespaceMap.put(prefix, uri);
+ }
+ }
+
+ public void serialize() throws XMLStreamException {
+ xmlWriter.setNamespaceContext(namespaceContext);
+ writeDataObject(rootDataObject, rootElementName, rootElementURI);
+ xmlWriter.flush();
+ }
+
+ private void writeDataObject(DataObject obj, String elementName, String elementURI) throws XMLStreamException {
+ List<NameValuePair> elementList = new ArrayList<NameValuePair>();
+ List<DataObject> children = new ArrayList<DataObject>();
+ List<NameValuePair> attributes = new ArrayList<NameValuePair>();
+
+ String typeName;
+ QName realTypeName = null;
+
+ if (elementName != null) {
+ realTypeName = namespaceContext.createQName(elementURI, elementName);
+ String typeQName = realTypeName.getPrefix() + ":" + realTypeName.getLocalPart();
+ declaredNamespaceMap.put(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+ attributes.add(new NameValuePair(XSI_TYPE_QNAME, typeQName));
+ registerNamespace(XSI_TYPE_QNAME.getPrefix(), XSI_TYPE_QNAME.getNamespaceURI());
+ } else {
+
+ typeName = xsdHelper.getLocalName(obj.getContainmentProperty());
+ realTypeName = namespaceContext.createQName(obj.getType().getURI(), typeName);
+ registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+ }
+
+ registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+
+ if (obj.getType().isSequenced()) {
+ Sequence sequence = obj.getSequence();
+ for (int i = 0; i < sequence.size(); i++) {
+ Property property = sequence.getProperty(i);
+ Object value = sequence.getValue(i);
+ if (property == null) {
+ elementList.add(new NameValuePair(ELEMENT_TEXT, value));
+ } else {
+ addProperty(elementList, children, property, value, obj);
+ }
+ }
+
+ // Attributes are not in the sequence
+ List properties = obj.getInstanceProperties();
+ for (Iterator i = properties.iterator(); i.hasNext();) {
+ Property property = (Property)i.next();
+ if (xsdHelper.isAttribute(property) && obj.isSet(property) && !isTransient(property, obj.getType())) {
+ Object value = obj.get(property);
+ QName name =
+ namespaceContext.createQName(xsdHelper.getNamespaceURI(property), xsdHelper
+ .getLocalName(property));
+ attributes.add(new NameValuePair(name, SDOUtil.convertToString(property.getType(), value)));
+ }
+ }
+ } else {
+ Iterator i = obj.getInstanceProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property)i.next();
+ if (obj.isSet(p) && !isTransient(p, obj.getType())) {
+ Object value = obj.get(p);
+ if (xsdHelper.isAttribute(p)) {
+ QName name =
+ namespaceContext.createQName(xsdHelper.getNamespaceURI(p), xsdHelper.getLocalName(p));
+ attributes.add(new NameValuePair(name, SDOUtil.convertToString(p.getType(), value)));
+ } else {
+ addProperty(elementList, children, p, value, obj);
+ }
+ }
+ }
+ }
+
+ String prefix = realTypeName.getPrefix();
+ String nameSpaceName = realTypeName.getNamespaceURI();
+
+ if (nameSpaceName != null) {
+ String writerPrefix = xmlWriter.getPrefix(nameSpaceName);
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(nameSpaceName, realTypeName.getLocalPart());
+ } else {
+ if (prefix != null) {
+ xmlWriter.writeStartElement(prefix, realTypeName.getLocalPart(), nameSpaceName);
+ xmlWriter.writeNamespace(prefix, nameSpaceName);
+ xmlWriter.setPrefix(prefix, nameSpaceName);
+ } else {
+ xmlWriter.writeStartElement(nameSpaceName, realTypeName.getLocalPart());
+ xmlWriter.writeDefaultNamespace(nameSpaceName);
+ xmlWriter.setDefaultNamespace(nameSpaceName);
+ }
+ }
+ } else {
+ xmlWriter.writeStartElement(realTypeName.getLocalPart());
+ }
+
+ for (NameValuePair pair : attributes) {
+ QName name = (QName)pair.getKey();
+ assert namespaceContext.getPrefix(name.getPrefix()).equals(name.getNamespaceURI());
+ xmlWriter.writeAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), (String)pair
+ .getValue());
+ }
+
+ for (NameValuePair pair : elementList) {
+ if (ELEMENT_TEXT.equals(pair.getKey().toString())) {
+ xmlWriter.writeCharacters((String)pair.getValue());
+ } else {
+ QName name = (QName)pair.getKey();
+ xmlWriter.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
+ xmlWriter.writeCharacters((String)pair.getValue());
+ xmlWriter.writeEndElement();
+ }
+ }
+
+ for (DataObject child : children) {
+ writeDataObject(child, null, null);
+ }
+ xmlWriter.writeEndElement();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/SDODataSource.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/SDODataSource.java
new file mode 100644
index 0000000000..0eebcbf54b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/SDODataSource.java
@@ -0,0 +1,66 @@
+package org.apache.tuscany.databinding.sdo2om;
+
+import static org.apache.tuscany.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class SDODataSource implements OMDataSource {
+ private HelperContext helperContext;
+ private XMLDocument sourceDocument;
+
+ public SDODataSource(XMLDocument source, HelperContext helperContext) {
+ this.sourceDocument = source;
+ this.helperContext = helperContext;
+ }
+
+ public SDODataSource(DataObject obj, HelperContext helperContext) {
+ this.helperContext = helperContext;
+ this.sourceDocument =
+ helperContext.getXMLHelper().createDocument(obj,
+ ROOT_ELEMENT.getNamespaceURI(),
+ ROOT_ELEMENT.getLocalPart());
+ }
+
+ public XMLStreamReader getReader() throws XMLStreamException {
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.createXMLStreamReader(sourceDocument);
+ }
+
+ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+ StreamingOMSerializer serializer = new StreamingOMSerializer();
+ serializer.serialize(getReader(), xmlWriter);
+ }
+
+ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+ try {
+ helperContext.getXMLHelper().save(sourceDocument, output, null);
+ } catch (Exception e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
+ try {
+ helperContext.getXMLHelper().save(sourceDocument, writer, null);
+ } catch (IOException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElement.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElement.java
new file mode 100644
index 0000000000..389c6b4d79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElement.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.sdo2om;
+
+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.databinding.sdo.SDOContextHelper;
+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;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * SDO XMLDocument --> AXIOM OMElement transformer
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class XMLDocument2OMElement extends TransformerExtension<XMLDocument, OMElement> implements
+ PullTransformer<XMLDocument, OMElement> {
+
+ public OMElement transform(XMLDocument source, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ SDODataSource dataSource = new SDODataSource(source, helperContext);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = factory.createOMNamespace(source.getRootElementURI(), source.getRootElementName());
+ OMElement element = factory.createOMElement(dataSource, source.getRootElementName(), namespace);
+ return element;
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/databinding.sdo-axiom.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/databinding.sdo-axiom.scdl
new file mode 100644
index 0000000000..5be48ed134
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/databinding.sdo-axiom.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ SDO databinding extension
+
+ This is the copy to be included by other extensions
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo-axiom.include">
+
+ <component name="transformer.DataObject2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2OMElement"/>
+ </component>
+
+ <component name="transformer.XMLDocument2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2OMElement"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..be4b5fe07e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.sdo">
+ <include name="org.apache.tuscany.databinding.sdo-axiom.include" scdlLocation="databinding.sdo-axiom.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElementTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElementTestCase.java
new file mode 100644
index 0000000000..18703dd087
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/DataObject2OMElementTestCase.java
@@ -0,0 +1,38 @@
+package org.apache.tuscany.databinding.sdo2om;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataType<XMLType>(DataObject.class.getName(), DataObject.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataType<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ OMElement element = new DataObject2OMElement().transform(dataObject, context);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/MockTransformationContext.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/MockTransformationContext.java
new file mode 100644
index 0000000000..d132ad66e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/MockTransformationContext.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.databinding.sdo2om;
+
+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 MockTransformationContext implements TransformationContext {
+ private DataType sourceDataType;
+
+ private DataType targetDataType;
+
+ private final Map<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+
+ private WeakReference<ClassLoader> classLoaderRef;
+
+ public MockTransformationContext() {
+ super();
+ setClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+
+ public MockTransformationContext(DataType sourceDataType,
+ DataType targetDataType,
+ ClassLoader classLoader,
+ Map<Class<?>, 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>(classLoader);
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoaderRef.get();
+ }
+
+ public Map<Class<?>, Object> getMetadata() {
+ return metadata;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/SDOTransformerTestCaseBase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..2c5950d058
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/SDOTransformerTestCaseBase.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.databinding.sdo2om;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * The base class for SDO-related test cases
+ */
+public abstract class SDOTransformerTestCaseBase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+
+ protected HelperContext helperContext;
+ protected String binding = DataObject.class.getName();
+ protected TransformationContext context;
+ protected TransformationContext reversedContext;
+ protected DataObject dataObject;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ helperContext = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(helperContext);
+
+ context = new MockTransformationContext();
+ context.setSourceDataType(getSourceDataType());
+ context.setTargetDataType(getTargetDataType());
+
+ reversedContext = new MockTransformationContext();
+ reversedContext.setSourceDataType(getTargetDataType());
+ reversedContext.setTargetDataType(getSourceDataType());
+
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ address.setStreet("123 ABC St");
+ address.setState("CA");
+ address.setStreet("95131");
+ po.setBillTo(address);
+ dataObject = (DataObject) po;
+ }
+
+ protected abstract DataType<?> getSourceDataType();
+
+ protected abstract DataType<?> getTargetDataType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElementTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElementTestCase.java
new file mode 100644
index 0000000000..f473eb86d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/java/org/apache/tuscany/databinding/sdo2om/XMLDocument2OMElementTestCase.java
@@ -0,0 +1,45 @@
+package org.apache.tuscany.databinding.sdo2om;
+
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataType<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataType<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLDocument document =
+ helperContext.getXMLHelper().createDocument(dataObject,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ OMElement element = new XMLDocument2OMElement().transform(document, context);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/stock.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo-axiom/src/test/resources/stock.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="string" />
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.checkstyle b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.checkstyle
new file mode 100644
index 0000000000..142759d295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.checkstyle
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/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/services/databinding/databinding-sdo/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/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/services/databinding/databinding-sdo/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/pom.xml
new file mode 100755
index 0000000000..1b8b334358
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/pom.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-sdo</artifactId>
+ <name>Apache Tuscany Data Binding for SDO</name>
+ <description>Data Binding based on SDO.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-po-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
+ <javaPackage>com.example.ipo.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-stock-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ <prefix>Stock</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java
new file mode 100755
index 0000000000..c188e94f3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.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.databinding.sdo;
+
+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.TransformationException;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+@Service(Transformer.class)
+public class DataObject2String extends TransformerExtension<DataObject, String> implements
+ PullTransformer<DataObject, String> {
+
+ public String transform(DataObject source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
+ return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java
new file mode 100755
index 0000000000..9c93d75adf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.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.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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 commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+@Service(Transformer.class)
+public class DataObject2XMLStreamReader extends TransformerExtension<DataObject, XMLStreamReader> implements
+ PullTransformer<DataObject, XMLStreamReader> {
+
+ public XMLStreamReader transform(DataObject source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ XMLDocument document =
+ xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ return streamHelper.createXMLStreamReader(document);
+ } catch (XMLStreamException e) {
+ // TODO: Add context to the exception
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.java
new file mode 100755
index 0000000000..25793d1777
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObjectLoader.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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.EagerInit;
+import org.osoa.sca.annotations.Property;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * A SDO model-based Loader to load DataObject from the XML stream
+ */
+@EagerInit
+public class DataObjectLoader extends LoaderExtension<ModelDataObject> {
+ private QName elementName;
+
+ public DataObjectLoader(@Autowire LoaderRegistry registry,
+ @Property(name = "namespace", required = true) String namespace,
+ @Property(name = "name", required = true) String name) {
+ super(registry);
+ this.elementName = new QName(namespace, name);
+ }
+
+ public ModelDataObject load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert elementName.equals(reader.getName());
+ HelperContext helperContext = SDOContextHelper.getHelperContext(object);
+ TypeHelper typeHelper = helperContext.getTypeHelper();
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
+ DataObject dataObject = streamHelper.loadObject(reader);
+ // TODO: Is it required that the object always extends from ModelObject?
+ return new ModelDataObject(dataObject);
+ }
+
+ @Override
+ public QName getXMLType() {
+ return elementName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDO.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDO.java
new file mode 100644
index 0000000000..8d14773b88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDO.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * The model object for import.sdo
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportSDO extends ModelObject {
+ public static final QName IMPORT_SDO =
+ new QName("http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0", "import.sdo");
+
+ private HelperContext helperContext;
+
+ public ImportSDO(HelperContext helperContext) {
+ super();
+ this.helperContext = helperContext;
+ }
+
+ public HelperContext getHelperContext() {
+ return helperContext;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOBuilder.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOBuilder.java
new file mode 100644
index 0000000000..31f17860b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOBuilder.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.databinding.sdo;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.ComponentRegistrationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.GenericBuilderExtension;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOBuilder extends GenericBuilderExtension<SCAObject, ImportSDO> {
+
+ @Override
+ protected Class<ImportSDO> getModelType() {
+ return ImportSDO.class;
+ }
+
+ public SCAObject build(SCAObject parent, ImportSDO modelObject, DeploymentContext deploymentContext)
+ throws BuilderException {
+ if (parent instanceof CompositeComponent) {
+ CompositeComponent component = (CompositeComponent)parent;
+ SDOHelperContext obj = new SDOHelperContext(component, modelObject.getHelperContext());
+ try {
+ component.registerJavaObject(obj.getName(), HelperContext.class, obj.getHelperContext());
+ } catch (ComponentRegistrationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ return obj;
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java
new file mode 100755
index 0000000000..f115fc78ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdo;
+
+import static org.apache.tuscany.databinding.sdo.ImportSDO.IMPORT_SDO;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URI;
+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.model.ModelObject;
+import org.osoa.sca.annotations.Constructor;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Loader that handles &lt;import.sdo&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOLoader extends LoaderExtension {
+
+ @Constructor( {"registry"})
+ public ImportSDOLoader(@Autowire
+ LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPORT_SDO;
+ }
+
+ public ModelObject load(CompositeComponent parent,
+ ModelObject object,
+ XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert IMPORT_SDO.equals(reader.getName());
+
+ // FIXME: [rfeng] How to associate the TypeHelper with deployment
+ // context?
+ HelperContext helperContext = SDOContextHelper.getHelperContext(object);
+
+ importFactory(reader, deploymentContext, helperContext);
+ importWSDL(reader, deploymentContext, helperContext);
+ LoaderUtil.skipToEndElement(reader);
+ return new ImportSDO(helperContext);
+ }
+
+ private void importFactory(XMLStreamReader reader, DeploymentContext deploymentContext, HelperContext helperContext)
+ throws LoaderException {
+ String factoryName = reader.getAttributeValue(null, "factory");
+ if (factoryName != null) {
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
+ // set TCCL as SDO needs it
+ ClassLoader cl = deploymentContext.getClassLoader();
+ Thread.currentThread().setContextClassLoader(cl);
+ Class<?> factoryClass = cl.loadClass(factoryName);
+ register(factoryClass, helperContext);
+ } catch (Exception e) {
+ throw new LoaderException(e.getMessage(), e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ }
+ }
+
+ private static void register(Class factoryClass, HelperContext helperContext) throws Exception {
+ Field field = factoryClass.getField("INSTANCE");
+ Object factory = field.get(null);
+ Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
+ method.invoke(factory, new Object[] {helperContext});
+
+ // FIXME: How do we associate the application HelperContext with the one
+ // imported by the composite
+ HelperContext defaultContext = HelperProvider.getDefaultContext();
+ method.invoke(factory, new Object[] {defaultContext});
+ }
+
+ private void importWSDL(XMLStreamReader reader, DeploymentContext deploymentContext, HelperContext helperContext)
+ throws LoaderException {
+ String location = reader.getAttributeValue(null, "location");
+ if (location == null) {
+ location = reader.getAttributeValue(null, "wsdlLocation");
+ }
+ if (location != null) {
+ try {
+ URL wsdlURL = null;
+ URI uri = URI.create(location);
+ if (uri.isAbsolute()) {
+ wsdlURL = uri.toURL();
+ }
+ wsdlURL = deploymentContext.getClassLoader().getResource(location);
+ if (null == wsdlURL) {
+ LoaderException loaderException = new LoaderException("WSDL location error");
+ loaderException.setResourceURI(location);
+ throw loaderException;
+ }
+ InputStream xsdInputStream = wsdlURL.openStream();
+ try {
+ XSDHelper xsdHelper = helperContext.getXSDHelper();
+ xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
+ } finally {
+ xsdInputStream.close();
+ }
+ // FIXME: How do we associate the application HelperContext with the one
+ // imported by the composite
+ HelperContext defaultContext = HelperProvider.getDefaultContext();
+ xsdInputStream = wsdlURL.openStream();
+ try {
+ XSDHelper xsdHelper = defaultContext.getXSDHelper();
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
+ // set TCCL as SDO needs it
+ ClassLoader cl = deploymentContext.getClassLoader();
+ Thread.currentThread().setContextClassLoader(cl);
+ xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+ } finally {
+ xsdInputStream.close();
+ }
+ } catch (IOException e) {
+ LoaderException sfe = new LoaderException(e.getMessage());
+ sfe.setResourceURI(location);
+ throw sfe;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.java
new file mode 100755
index 0000000000..ba171af498
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/ModelDataObject.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.databinding.sdo;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Wrapper of DataObject as a ModelObject
+ *
+ * @version $Rev$ $Date$
+ */
+public class ModelDataObject extends ModelObject {
+ private DataObject dataObject;
+
+ public ModelDataObject(DataObject dataObject) {
+ super();
+ this.dataObject = dataObject;
+ }
+
+ public DataObject getDataObject() {
+ return dataObject;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOContextHelper.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOContextHelper.java
new file mode 100644
index 0000000000..9d37c79228
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOContextHelper.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.ModelObject;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Helper class to get TypeHelper from the context
+ */
+public final class SDOContextHelper {
+ private SDOContextHelper() {
+ }
+
+ public static HelperContext getHelperContext(TransformationContext context) {
+ if (context == null || context.getMetadata() == null) {
+ return getDefaultHelperContext();
+ }
+ HelperContext helperContext = null;
+ CompositeComponent composite = (CompositeComponent)context.getMetadata().get(CompositeComponent.class);
+ if (composite != null) {
+// SDOHelperContext sdoContext =
+// (SDOHelperContext)composite.getExtensions().get(HelperContext.class.getName());
+// if (sdoContext != null) {
+// helperContext = sdoContext.getHelperContext();
+// }
+ AtomicComponent child = (AtomicComponent)composite.getSystemChild(HelperContext.class.getName());
+ try {
+ // The child can be null if no import.sdo is declared
+ if (child != null) {
+ helperContext = (HelperContext)child.getTargetInstance();
+ }
+ } catch (TargetResolutionException e) {
+ helperContext = null;
+ }
+ }
+ if (helperContext == null) {
+ return getDefaultHelperContext();
+ } else {
+ return helperContext;
+ }
+ }
+
+ public static HelperContext getHelperContext(ModelObject model) {
+ HelperContext helperContext = null;
+ if (model instanceof CompositeComponentType) {
+ // HACK: Retrieve the SDO HelperContext from the
+ // CompositeComponentType
+ // extensions
+ helperContext = (HelperContext)model.getExtensions().get(ImportSDO.IMPORT_SDO);
+ if (helperContext == null) {
+ helperContext = SDOUtil.createHelperContext();
+ ((CompositeComponentType<?, ?, ?>)model).getDeclaredExtensions().put(ImportSDO.IMPORT_SDO,
+ helperContext);
+ }
+ }
+
+ if (helperContext == null) {
+ helperContext = getDefaultHelperContext();
+ }
+
+ return helperContext;
+ }
+
+ protected static HelperContext getDefaultHelperContext() {
+ // SDOUtil.createHelperContext();
+ return HelperProvider.getDefaultContext();
+ }
+
+ public static QName getElement(DataType<?> dataType) {
+ Object logical = dataType.getLogical();
+ QName elementName = SDODataBinding.ROOT_ELEMENT;
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ }
+ }
+ return elementName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java
new file mode 100644
index 0000000000..4178ee9f63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdo;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.ExceptionHandler;
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.WrapperHandler;
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * SDO Databinding
+ *
+ * @version $Reve$ $Date$
+ */
+public class SDODataBinding extends DataBindingExtension {
+ public static final String NAME = DataObject.class.getName();
+ public static final String[] ALIASES = new String[] {"sdo"};
+
+ public static final String ROOT_NAMESPACE = "commonj.sdo";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "dataObject");
+
+ private WrapperHandler<Object> wrapperHandler;
+
+ public SDODataBinding() {
+ super(NAME, ALIASES, DataObject.class);
+ wrapperHandler = new SDOWrapperHandler();
+ }
+
+ @Override
+ public boolean introspect(DataType dataType, Annotation[] annotations) {
+ Object physical = dataType.getPhysical();
+ if (!(physical instanceof Class)) {
+ return false;
+ }
+ Class javaType = (Class)physical;
+ HelperContext context = HelperProvider.getDefaultContext();
+ // FIXME: Need a better to test dynamic SDO
+ if (DataObject.class.isAssignableFrom(javaType)) {
+ // Dynamic SDO
+ dataType.setDataBinding(getName());
+ dataType.setLogical(XMLType.UNKNOWN);
+ return true;
+ }
+ // FIXME: We need to access HelperContext
+ Type type = context.getTypeHelper().getType(javaType);
+ if (type == null) {
+ return false;
+ }
+ if (type.isDataType()) {
+ // FIXME: Ignore simple types?
+ return false;
+ }
+ String namespace = type.getURI();
+ String name = context.getXSDHelper().getLocalName(type);
+ QName xmlType = new QName(namespace, name);
+ dataType.setDataBinding(getName());
+ dataType.setLogical(new XMLType(null, xmlType));
+ return true;
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return wrapperHandler;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SDOSimpleTypeMapper();
+ }
+
+ @Override
+ public Object copy(Object arg) {
+ HelperContext context = HelperProvider.getDefaultContext();
+ CopyHelper copyHelper = context.getCopyHelper();
+ if (arg instanceof XMLDocument) {
+ XMLDocument document = (XMLDocument)arg;
+ DataObject dataObject = copyHelper.copy(document.getRootObject());
+ return context.getXMLHelper().createDocument(dataObject,
+ document.getRootElementURI(),
+ document.getRootElementName());
+ } else if (arg instanceof DataObject) {
+ return context.getCopyHelper().copy((DataObject)arg);
+ } else {
+ return super.copy(arg);
+ }
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new SDOExceptionHandler();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandler.java
new file mode 100644
index 0000000000..28a36ea2c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandler.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.ExceptionHandler;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * SDO implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class SDOExceptionHandler implements ExceptionHandler {
+ private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+
+ // FIXME: Need a way to pass in the HelperContext
+ private HelperContext helperContext = HelperProvider.getDefaultContext();
+
+ /**
+ * <ul>
+ * <li>WrapperException(String message, FaultBean faultInfo) <br>
+ * A constructor where WrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean.
+ * <li> WrapperException(String message, FaultBean faultInfo, Throwable
+ * cause) <br>
+ * A constructor whereWrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean. The last argument, cause, may be used to convey
+ * protocol specific fault information
+ * </ul>
+ */
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ Class exceptionClass = (Class)exceptionType.getPhysical();
+ DataType<?> faultBeanType = exceptionType.getLogical();
+ Class faultBeanClass = (Class)faultBeanType.getPhysical();
+ try {
+ Constructor constructor =
+ exceptionClass.getConstructor(new Class[] {String.class, faultBeanClass, Throwable.class});
+ return (Exception)constructor.newInstance(new Object[] {message, faultInfo, cause});
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ try {
+ Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ return method.invoke(exception, (Object[])null);
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public DataType<?> getFaultType(DataType exceptionDataType) {
+ Class exceptionType = (Class) exceptionDataType.getPhysical();
+ Class faultBeanClass = null;
+ try {
+ Method method = exceptionType.getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ faultBeanClass = method.getReturnType();
+ } catch (NoSuchMethodException e) {
+ faultBeanClass = null;
+ }
+ if (faultBeanClass == null) {
+ return null;
+ }
+
+ QName faultElement = null;
+ try {
+ Field field = exceptionType.getField("FAULT_ELEMENT");
+ faultElement = (QName)field.get(null);
+ } catch (NoSuchFieldException e) {
+ // Fall back to type inspection
+ Type type = helperContext.getTypeHelper().getType(faultBeanClass);
+ if (type != null) {
+ String ns = type.getURI();
+ String name = helperContext.getXSDHelper().getLocalName(type);
+ faultElement = new QName(ns, name);
+ }
+ } catch (Throwable e) {
+ // Ignore
+ }
+ if (faultElement == null) {
+ return null;
+ }
+ DataType<XMLType> faultType =
+ new DataType<XMLType>(SDODataBinding.NAME, faultBeanClass, new XMLType(faultElement, null));
+ return faultType;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOHelperContext.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOHelperContext.java
new file mode 100644
index 0000000000..3091d7ec8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOHelperContext.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.databinding.sdo;
+
+import org.apache.tuscany.spi.component.AbstractSCAObject;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.model.Scope;
+
+import commonj.sdo.helper.HelperContext;
+
+public class SDOHelperContext extends AbstractSCAObject {
+ private HelperContext helperContext;
+
+ /**
+ * @param name
+ * @param parent
+ */
+ public SDOHelperContext(CompositeComponent parent, HelperContext helperContext) {
+ super(HelperContext.class.getName(), parent);
+ this.helperContext = helperContext;
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+ public HelperContext getHelperContext() {
+ return helperContext;
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.java
new file mode 100644
index 0000000000..3b57323c73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOSimpleTypeMapper.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.tuscany.spi.databinding.SimpleTypeMapper;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * SDO Java/XML mapping for simple XSD types
+ */
+public class SDOSimpleTypeMapper implements SimpleTypeMapper {
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+
+ public SDOSimpleTypeMapper() {
+ super();
+ }
+
+ public Object toJavaObject(QName typeName, String value, TransformationContext context) {
+ Type type = null;
+ if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
+ type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
+ } else {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ TypeHelper typeHelper = helperContext.getTypeHelper();
+ type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
+ }
+ return SDOUtil.createFromString(type, value);
+ }
+
+ public String toXMLLiteral(QName typeName, Object obj, TransformationContext context) {
+ Type type = null;
+ if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
+ type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
+ } else {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ TypeHelper typeHelper = helperContext.getTypeHelper();
+ type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
+ }
+ return SDOUtil.convertToString(type, obj);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java
new file mode 100644
index 0000000000..dfbf7dabce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java
@@ -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.
+ */
+
+package org.apache.tuscany.databinding.sdo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.WrapperHandler;
+import org.apache.tuscany.spi.idl.ElementInfo;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+/**
+ * SDO Wrapper Handler
+ */
+public class SDOWrapperHandler implements WrapperHandler<Object> {
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.WrapperHandler#create(ElementInfo, TransformationContext)
+ */
+ public Object create(ElementInfo element, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ QName typeName = element.getType().getQName();
+ DataFactory dataFactory = helperContext.getDataFactory();
+ DataObject root = dataFactory.create(typeName.getNamespaceURI(), typeName.getLocalPart());
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ return xmlHelper.createDocument(root, element.getQName().getNamespaceURI(), element.getQName().getLocalPart());
+ }
+
+ /**
+ * @see org.apache.tuscany.spi.databinding.WrapperHandler#setChild(java.lang.Object, int, ElementInfo,
+ * java.lang.Object)
+ */
+ public void setChild(Object wrapper, int i, ElementInfo childElement, Object value) {
+ DataObject wrapperDO =
+ (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
+ wrapperDO.set(i, value);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getChildren(Object wrapper) {
+ DataObject wrapperDO =
+ (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
+ List<Property> properties = wrapperDO.getInstanceProperties();
+ List<Object> elements = new ArrayList<Object>();
+ Type type = wrapperDO.getType();
+ if (type.isSequenced()) {
+ // Add values in the sequence
+ Sequence sequence = wrapperDO.getSequence();
+ for (int i = 0; i < sequence.size(); i++) {
+ // Skip mixed text
+ if (sequence.getProperty(i) != null) {
+ elements.add(sequence.getValue(i));
+ }
+ }
+ } else {
+ for (Property p : properties) {
+ Object child = wrapperDO.get(p);
+ if (p.isMany()) {
+ for (Object c : (Collection<?>)child) {
+ elements.add(c);
+ }
+ } else {
+ elements.add(child);
+ }
+ }
+ }
+ return elements;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java
new file mode 100755
index 0000000000..bd288c74e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.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.databinding.sdo;
+
+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 commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+@Service(Transformer.class)
+public class String2DataObject extends TransformerExtension<String, DataObject> implements
+ PullTransformer<String, DataObject> {
+
+ public DataObject transform(String source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ return xmlHelper.load(source).getRootObject();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
new file mode 100644
index 0000000000..38f48cebee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.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.sdo;
+
+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.Transformer;
+import org.apache.tuscany.spi.databinding.extension.TransformerExtension;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+@Service(Transformer.class)
+public class XMLDocument2String extends TransformerExtension<XMLDocument, String> implements
+ PullTransformer<XMLDocument, String> {
+
+ public String transform(XMLDocument source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ StringWriter writer = new StringWriter();
+ xmlHelper.save(source, writer, null);
+ return writer.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java
new file mode 100755
index 0000000000..bd20089001
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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 commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+@Service(Transformer.class)
+public class XMLDocument2XMLStreamReader extends TransformerExtension<XMLDocument, XMLStreamReader> implements
+ PullTransformer<XMLDocument, XMLStreamReader> {
+ /**
+ * @param source
+ * @param context
+ * @return
+ */
+ public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.createXMLStreamReader(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java
new file mode 100755
index 0000000000..c29413101d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.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.sdo;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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 commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+@Service(Transformer.class)
+public class XMLStreamReader2DataObject extends TransformerExtension<XMLStreamReader, DataObject> implements
+ PullTransformer<XMLStreamReader, DataObject> {
+
+ public DataObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ // The XMLStreamHelper requires that the reader is posistioned at
+ // START_ELEMENT
+ while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) {
+ source.next();
+ }
+ return streamHelper.loadObject(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java
new file mode 100755
index 0000000000..ff9e0aa2e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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 commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+@Service(Transformer.class)
+public class XMLStreamReader2XMLDocument extends TransformerExtension<XMLStreamReader, XMLDocument> implements
+ PullTransformer<XMLStreamReader, XMLDocument> {
+
+ public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.load(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XMLDocument.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl
new file mode 100644
index 0000000000..e23b3f80bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/databinding.sdo.scdl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ SDO databinding extension
+
+ This is the copy to be included by other extensions
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-sdo</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+ <component name="sdotype.builder">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOBuilder"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..2b2040c148
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ SDO databinding extension
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.databinding</group>
+ <name>databinding-sdo</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..a9104cc401
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.sdo">
+ <include name="org.apache.tuscany.databinding.sdo.include" scdlLocation="databinding.sdo.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java
new file mode 100644
index 0000000000..8c4f243df5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.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 com.example.stock.sdo.fault;
+
+import javax.xml.namespace.QName;
+
+import com.example.stock.sdo.InvalidSymbolFault;
+
+/**
+ * Hand-crafted java exception for SDO fault
+ *
+ */
+public class InvalidSymbolFault_Exception extends Exception {
+ /**
+ * Generated QName for the fault element
+ */
+ public static final QName FAULT_ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @param faultInfo
+ * @param message
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.java
new file mode 100644
index 0000000000..182156c7ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2StringTestCase.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.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2StringTestCase extends SDOTransformerTestCaseBase {
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataType<QName>(binding, PurchaseOrderType.class, ORDER_QNAME);
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataType<Class<String>>(String.class, String.class);
+ }
+
+ public final void testTransform() {
+ String xml = new DataObject2String().transform(dataObject, context);
+ Assert.assertTrue(xml.indexOf("<city>San Jose</city>") != -1);
+ DataObject po = new String2DataObject().transform(xml, reversedContext);
+ Assert.assertTrue(po instanceof PurchaseOrderType);
+ PurchaseOrderType orderType = (PurchaseOrderType)po;
+ Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
+ }
+
+ public final void testXML() {
+ String xml =
+ "<foo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:ipo=\"http://www.example.com/IPO\" xsi:type=\"ipo:USAddress\"/>";
+ DataObject dataObject = new String2DataObject().transform(xml, reversedContext);
+ context.setSourceDataType(new DataType<QName>(DataObject.class.getName(), DataObject.class, null));
+ xml = new DataObject2String().transform(dataObject, context);
+ Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\""));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..7a1f03e36f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReaderTestCase.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+
+/**
+ *
+ */
+public class DataObject2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataType<QName>(binding, PurchaseOrderType.class, ORDER_QNAME);
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataType<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context);
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ break;
+ }
+ }
+ new XMLStreamReader2DataObject().transform(reader, reversedContext);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java
new file mode 100755
index 0000000000..f38e0426cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/DataObjectLoaderTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+import commonj.sdo.helper.XSDHelper;
+
+public class DataObjectLoaderTestCase extends TestCase {
+
+ private XSDHelper xsdHelper = XSDHelper.INSTANCE;
+
+ private QName name = new QName("http://www.osoa.org/xmlns/mock/0.9", "implementation.mock");
+
+ private String xml =
+ "<module name=\"m\" xmlns=\"http://www.osoa.org/xmlns/sca/0.9\" " + "xmlns:mock=\"http://www.osoa.org/xmlns/mock/0.9\" "
+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xsi:schemaLocation=\"http://www.osoa.org/xmlns/mock/0.9 "
+ + "sca-implementation-mock.xsd http://www.osoa.org/xmlns/sca/0.9 sca-core.xsd \">"
+ + "<component name=\"c\"><mock:implementation.mock myAttr=\"helloworld.HelloWorldImpl\" />"
+ + "</component></module>";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ URL url = getClass().getClassLoader().getResource("model/sca-implementation-mock.xsd");
+ // URL url =
+ // getClass().getClassLoader().getResource("model/sca-core.xsd");
+ xsdHelper.define(url.openStream(), url.toExternalForm());
+ }
+
+ public void testLoader() throws Exception {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
+ int event = reader.getEventType();
+ while (!(event == XMLStreamConstants.START_ELEMENT && reader.getName().equals(name)) && reader.hasNext()) {
+ event = reader.nextTag();
+ }
+ DataObjectLoader loader = new DataObjectLoader(null, name.getNamespaceURI(), name.getLocalPart());
+ DeploymentContext context =
+ new RootDeploymentContext(getClass().getClassLoader(), inputFactory, new CompositeScopeContainer(null),
+ null);
+ ModelDataObject modelObject = (ModelDataObject)loader.load(null, null, reader, context);
+ Assert.assertNotNull(modelObject.getDataObject());
+ Assert.assertTrue(modelObject.getDataObject().getString("myAttr").equals("helloworld.HelloWorldImpl"));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java
new file mode 100755
index 0000000000..e87526bb9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.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 org.apache.tuscany.databinding.sdo;
+
+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.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+
+import com.example.ipo.sdo.SdoFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOLoaderTestCase extends TestCase {
+ private static boolean inited;
+
+ private ImportSDOLoader loader;
+ private XMLInputFactory xmlFactory;
+ private DeploymentContext deploymentContext;
+
+ public void testMinimal() throws XMLStreamException, LoaderException {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.load(null, null, reader, deploymentContext) instanceof ImportSDO);
+ }
+
+ public void testLocation() throws XMLStreamException, LoaderException {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' location='ipo.xsd'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.load(null, null, reader, deploymentContext) instanceof ImportSDO);
+ }
+
+ public void testFactory() throws XMLStreamException, LoaderException {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' "
+ + "factory='org.apache.tuscany.databinding.sdo.ImportSDOLoaderTestCase$MockFactory'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertFalse(inited);
+ assertTrue(loader.load(null, null, reader, deploymentContext) instanceof ImportSDO);
+ assertTrue(inited);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ loader = new ImportSDOLoader(null);
+ xmlFactory = XMLInputFactory.newInstance();
+ deploymentContext = new RootDeploymentContext(getClass().getClassLoader(), xmlFactory, null, null);
+ }
+
+ protected XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ public static class MockFactory {
+ public static final Object INSTANCE = SdoFactory.INSTANCE;
+
+ static {
+ ImportSDOLoaderTestCase.inited = true;
+ }
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java
new file mode 100644
index 0000000000..e2145f1a5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDODataBindingTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ *
+ */
+public class SDODataBindingTestCase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private SDODataBinding binding;
+ private HelperContext context;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new SDODataBinding();
+ context = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(context);
+ }
+
+ public final void testIntrospect() {
+ DataType dataType = new DataType(DataObject.class, null);
+ boolean yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertTrue(dataType.getPhysical() == DataObject.class && dataType.getLogical() == XMLType.UNKNOWN);
+ dataType = new DataType(PurchaseOrderType.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(PurchaseOrderType.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataType(USAddress.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(USAddress.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ }
+
+ public final void testCopyRoot() {
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ po.setComment("Comment");
+ Object copy = binding.copy(po);
+ assertTrue(copy instanceof PurchaseOrderType);
+ assertTrue(po != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)po, (DataObject)copy));
+ assertEquals("Comment", ((PurchaseOrderType)copy).getComment());
+ }
+
+ public final void testCopyNonRoot() {
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ Object copy = binding.copy(address);
+ assertTrue(copy instanceof USAddress);
+ assertTrue(address != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)address, (DataObject)copy));
+ assertEquals("San Jose", ((USAddress)copy).getCity());
+ }
+
+ public final void testCopyXMLDocument() {
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ po.setComment("Comment");
+ XMLDocument doc =
+ context.getXMLHelper().createDocument((DataObject)po,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ Object copy = binding.copy(doc);
+ assertTrue(copy instanceof XMLDocument);
+ XMLDocument docCopy = (XMLDocument)copy;
+ assertTrue(doc != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)po, docCopy.getRootObject()));
+ assertEquals("Comment", ((PurchaseOrderType)docCopy.getRootObject()).getComment());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..8226891c35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOExceptionHandlerTestCase.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.databinding.sdo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.stock.sdo.InvalidSymbolFault;
+import com.example.stock.sdo.StockFactory;
+import com.example.stock.sdo.fault.InvalidSymbolFault_Exception;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Test case for SDOExceptionHandler
+ */
+public class SDOExceptionHandlerTestCase extends TestCase {
+ // FIXME: Tuscany SDO impl uses _._type for anonymouse type, by the SDO
+ // spec, it should be same as the
+ // enclosing element/attribute name
+ private SDOExceptionHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new SDOExceptionHandler();
+ StockFactory.INSTANCE.register(HelperProvider.getDefaultContext());
+ }
+
+ public void testGetFaultType() {
+ DataType execType = new DataType<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> dataType = handler.getFaultType(execType);
+ assertEquals(InvalidSymbolFault.class, dataType.getPhysical());
+ assertEquals(InvalidSymbolFault_Exception.FAULT_ELEMENT, ((XMLType) dataType.getLogical()).getElementName());
+ assertEquals(SDODataBinding.NAME, dataType.getDataBinding());
+ }
+
+ public void testCreate() {
+ DataType execType = new DataType<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> faultType = handler.getFaultType(execType);
+ InvalidSymbolFault fault = StockFactory.INSTANCE.createInvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ DataType<DataType> exType = new DataType<DataType>(InvalidSymbolFault_Exception.class, faultType);
+ Exception ex = handler.createException(exType, "Invalid symbol", fault, null);
+ assertTrue(ex instanceof InvalidSymbolFault_Exception);
+ InvalidSymbolFault_Exception exception = (InvalidSymbolFault_Exception)ex;
+ assertEquals("Invalid symbol", exception.getMessage());
+ assertSame(fault, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ InvalidSymbolFault fault = StockFactory.INSTANCE.createInvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ InvalidSymbolFault_Exception exception = new InvalidSymbolFault_Exception("Invalid symbol", fault);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(fault, faultInfo);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..58a05fcf9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOTransformerTestCaseBase.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * The base class for SDO-related test cases
+ */
+public abstract class SDOTransformerTestCaseBase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+
+ protected HelperContext helperContext;
+ protected String binding = DataObject.class.getName();
+ protected TransformationContext context;
+ protected TransformationContext reversedContext;
+ protected DataObject dataObject;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ helperContext = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(helperContext);
+
+ context = new TransformationContextImpl();
+ context.setSourceDataType(getSourceDataType());
+ context.setTargetDataType(getTargetDataType());
+
+ reversedContext = new TransformationContextImpl();
+ reversedContext.setSourceDataType(getTargetDataType());
+ reversedContext.setTargetDataType(getSourceDataType());
+
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ address.setStreet("123 ABC St");
+ address.setState("CA");
+ address.setStreet("95131");
+ po.setBillTo(address);
+ dataObject = (DataObject) po;
+ }
+
+ protected abstract DataType<?> getSourceDataType();
+
+ protected abstract DataType<?> getTargetDataType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandlerTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..3ddd1c85dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandlerTestCase.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.databinding.sdo;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.List;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SDOWrapperHandlerTestCase {
+ private HelperContext context;
+ private SDOWrapperHandler handler;
+
+ @Before
+ public void setUp() throws Exception {
+ context = SDOUtil.createHelperContext();
+ handler = new SDOWrapperHandler();
+ }
+
+ @Test
+ public void testWrapperAnyType() throws Exception {
+ XMLHelper xmlHelper = context.getXMLHelper();
+ XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
+ List children = handler.getChildren(document);
+ assertEquals(5, children.size());
+ }
+
+ @Test
+ public void testWrapper() throws Exception {
+ XSDHelper xsdHelper = context.getXSDHelper();
+ xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
+ XMLHelper xmlHelper = context.getXMLHelper();
+ XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
+ List children = handler.getChildren(document);
+ assertEquals(5, children.size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..c58636decc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.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.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.spi.model.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataType<QName>(XMLDocument.class.getName(), XMLDocument.class, ORDER_QNAME);
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataType<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLDocument document =
+ helperContext.getXMLHelper().createDocument(dataObject,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ XMLStreamReader reader = new XMLDocument2XMLStreamReader().transform(document, context);
+ XMLDocument document2 = new XMLStreamReader2XMLDocument().transform(reader, reversedContext);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), document2.getRootElementURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), document2.getRootElementName());
+ Assert.assertTrue(document2.getRootObject() instanceof PurchaseOrderType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
new file mode 100644
index 0000000000..8f4ee4be3e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd
new file mode 100755
index 0000000000..56c6977254
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-core.xsd
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="required" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:Module"/>
+ <complexType name="Module">
+ <complexContent>
+ <extension base="sca:ModuleFragment"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..n sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 1..n or 0..n sample
+ <reference>StockQuoteComponent1</reference> - type must be URI
+ <reference>StockQuoteComponent2</reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding">
+ <attribute name="uri" type="anyURI" use="optional"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 1..n or 0..n sample
+ <references>
+ <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI
+ <v:stockQuote>StockQuoteComponent2</v:stockQuote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="target" type="anyType"/>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target"/>
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target"/>
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="1..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="OverrideOptions">
+ <restriction base="string">
+ <enumeration value="no"/>
+ <enumeration value="may"/>
+ <enumeration value="must"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd
new file mode 100755
index 0000000000..bbaf58f00c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/mock/0.9"
+ elementFormDefault="qualified"
+ xmlns:mock="http://www.osoa.org/xmlns/mock/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/0.9"
+ schemaLocation="sca-core.xsd" />
+
+ <element name="implementation.mock" type="mock:MockImplementation"
+ substitutionGroup="sca:implementation" />
+ <complexType name="MockImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="myAttr" type="NCName" use="required" />
+ <anyAttribute namespace="##any" processContents="lax" />
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/stock.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/stock.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="string" />
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xml
new file mode 100644
index 0000000000..3e7fe81817
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<p:op xmlns:p="http://www.example.com/wrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.com/wrapper wrapper.xsd ">
+ <message>message</message>
+ <symbol>symbol</symbol>
+ <message>message1</message>
+ <symbol>symbol1</symbol>
+ <symbol>symbol2</symbol>
+</p:op>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xsd
new file mode 100644
index 0000000000..ea4dc5f7f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-sdo/src/test/resources/wrapper.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema targetNamespace="http://www.example.com/wrapper" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="op">
+ <complexType>
+ <sequence maxOccurs="unbounded">
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" maxOccurs="3" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="opResponse">
+ <complexType>
+ <sequence maxOccurs="1">
+ <element name="price" minOccurs="1" maxOccurs="unbounded" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/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/services/databinding/databinding-xmlbeans/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/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/services/databinding/databinding-xmlbeans/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/pom.xml
new file mode 100755
index 0000000000..ba111fc774
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>databinding-xmlbeans</artifactId>
+ <name>Apache Tuscany Data Binding for XmlBeans</name>
+ <description>Tuscany XmlBeans Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.2.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/xmlbeans-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-xmlbeans</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
+ classpathref="maven.compile.classpath" />
+ <xmlbean schema="${basedir}/src/test/resources" classpathref="maven.compile.classpath"
+ destfile="${project.build.directory}/ipo-xmlbeans.jar"
+ srcgendir="${project.build.directory}/xmlbeans-source" javasource="1.5"
+ classgendir="${project.build.directory}/test-classes" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.java
new file mode 100755
index 0000000000..0b4da53473
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/Node2XmlObject.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.databinding.xmlbeans;
+
+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.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class Node2XmlObject extends TransformerExtension<Node, XmlObject> implements
+ PullTransformer<Node, XmlObject> {
+ // private XmlOptions options;
+
+ public XmlObject transform(Node source, TransformationContext context) {
+ try {
+ return XmlObject.Factory.parse(source);
+ } catch (XmlException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.java
new file mode 100644
index 0000000000..12057982e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLBeansDataBinding.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.databinding.xmlbeans;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * XMLBeans DataBinding
+ */
+public class XMLBeansDataBinding extends DataBindingExtension {
+ public static final String NAME = XmlObject.class.getName();
+
+ public XMLBeansDataBinding() {
+ super(NAME, XmlObject.class);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.java
new file mode 100755
index 0000000000..0e61bd9571
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XMLStreamReader2XmlObject.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.databinding.xmlbeans;
+
+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.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+
+@Service(Transformer.class)
+public class XMLStreamReader2XmlObject extends TransformerExtension<XMLStreamReader, XmlObject> implements PullTransformer<XMLStreamReader, XmlObject> {
+ // private XmlOptions options;
+
+ public XmlObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ return XmlObject.Factory.parse(source);
+ } catch (XmlException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.java
new file mode 100755
index 0000000000..8fc1e58bd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2Node.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.databinding.xmlbeans;
+
+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.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class XmlObject2Node extends TransformerExtension<XmlObject, Node> implements
+ PullTransformer<XmlObject, Node> {
+ // private XmlOptions options;
+
+ public Node transform(XmlObject source, TransformationContext context) {
+ if (source == null)
+ return null;
+ return source.newDomNode();
+ }
+
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.java
new file mode 100755
index 0000000000..8a12cf34f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/java/org/apache/tuscany/databinding/xmlbeans/XmlObject2XMLStreamReader.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.databinding.xmlbeans;
+
+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.extension.TransformerExtension;
+import org.apache.xmlbeans.XmlObject;
+
+public class XmlObject2XMLStreamReader extends TransformerExtension<XmlObject, XMLStreamReader> implements PullTransformer<XmlObject, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public XMLStreamReader transform(XmlObject source, TransformationContext context) {
+ return source.newXMLStreamReader();
+ }
+
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl
new file mode 100644
index 0000000000..9c53d427e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/databinding.xmlbeans.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.xmlbeans.include">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..eee36ea6d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.xmlbeans">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..40a6b56c01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.databinding.xmlbeans">
+ <include name="org.apache.tuscany.databinding.xmlbeans.include" scdlLocation="databinding.xmlbeans.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java
new file mode 100755
index 0000000000..57fbae7e35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/java/org/apache/tuscany/databinding/xmlbeans/XmlObjectTestCase.java
@@ -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.
+ */
+package org.apache.tuscany.databinding.xmlbeans;
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+import com.example.ipo.xmlbeans.PurchaseOrderDocument;
+
+public class XmlObjectTestCase extends TestCase {
+ private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + " <name>Helen Zoe</name>" + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>" + " <postcode>CB1 1JR</postcode>" + " </shipTo>" + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>" + " <street>8 Oak Avenue</street>" + " <city>Old Town</city>" + " <state>PA</state>"
+ + " <zip>95819</zip>" + " </billTo>" + " <items>" + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>" + " <quantity>1</quantity>" + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>" + " <shipDate>1999-12-05</shipDate>" + " </item>" + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testXmlObject() throws Exception {
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ XmlObject object2 = t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ public void testGeneratedXmlObject() throws Exception {
+ // URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ PurchaseOrderDocument object = PurchaseOrderDocument.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ PurchaseOrderDocument object2 = (PurchaseOrderDocument) t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ PurchaseOrderDocument object3 = (PurchaseOrderDocument) t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsdconfig b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
new file mode 100755
index 0000000000..a397182672
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
@@ -0,0 +1,21 @@
+<!-- Copyright 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <xb:namespace uri="http://www.example.com/IPO">
+ <xb:package>com.example.ipo.xmlbeans</xb:package>
+ </xb:namespace>
+
+</xb:config>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/pom.xml
new file mode 100644
index 0000000000..c92daa2a1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/databinding/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Data Bindings</name>
+
+ <profiles>
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>databinding-jaxb</module>
+ <module>databinding-sdo</module>
+ <module>databinding-sdo-axiom</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>databinding-jaxb</module>
+ <module>databinding-sdo</module>
+ <module>databinding-xmlbeans</module>
+ <module>databinding-sdo-axiom</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>databinding-jaxb</module>
+ <module>databinding-sdo</module>
+ <module>databinding-xmlbeans</module>
+ <module>databinding-sdo-axiom</module>
+ <module>databinding-json</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/pom.xml
new file mode 100644
index 0000000000..e66179bdc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Interface Definition Languages</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>wsdl</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/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/services/idl/wsdl/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/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/services/idl/wsdl/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/pom.xml
new file mode 100644
index 0000000000..595632a3de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-wsdl</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany WSDL</name>
+ <description>Tuscany WSDL Support.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.java
new file mode 100644
index 0000000000..1b9326acab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospector.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.idl.wsdl;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * Introspector for creating WSDLServiceContract definitions from WSDL PortTypes.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceWSDLIntrospector {
+
+ /**
+ * Introspect a WSDL portType and return a service contract definition.
+ *
+ * @param type the portType to inspect
+ * @return a WSDLServiceContract corresponding to the WSDL portType
+ */
+ WSDLServiceContract introspect(PortType portType) throws InvalidServiceContractException;
+
+ /**
+ * Introspect a WSDL portType and return a service contract definition.
+ *
+ * @param type the portType to inspect
+ * @param callback the callback portType to inspec
+ * @return a WSDLServiceContract corresponding to the WSDL portType
+ */
+ WSDLServiceContract introspect(PortType type, PortType callback) throws InvalidServiceContractException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
new file mode 100644
index 0000000000..b705413fe1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Introspector for creating WSDLServiceContract definitions from WSDL PortTypes.
+ */
+public class InterfaceWSDLIntrospectorImpl implements InterfaceWSDLIntrospector {
+ private WSDLDefinitionRegistry wsdlDefinitionRegistry;
+
+ /**
+ * @param wsdlDefinitionRegistry
+ */
+ @Constructor("wsdlDefinitionRegistry")
+ public InterfaceWSDLIntrospectorImpl(@Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) {
+ super();
+ this.wsdlDefinitionRegistry = wsdlDefinitionRegistry;
+ }
+
+ // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec?
+ protected Map<String, org.apache.tuscany.spi.model.Operation<XMLType>> introspectOperations(PortType portType)
+ throws InvalidServiceContractException {
+ Map<String, org.apache.tuscany.spi.model.Operation<XMLType>> operations =
+ new HashMap<String, org.apache.tuscany.spi.model.Operation<XMLType>>();
+ for (Object op : portType.getOperations()) {
+ Operation wsdlOp = (Operation) op;
+ operations.put(wsdlOp.getName(), introspectOperation(wsdlOp));
+ }
+ return operations;
+ }
+
+ protected org.apache.tuscany.spi.model.Operation<XMLType> introspectOperation(Operation wsdlOp)
+ throws InvalidServiceContractException {
+
+ WSDLOperation op = new WSDLOperation(wsdlOp, null, wsdlDefinitionRegistry.getSchemaRegistry());
+ return op.getOperation();
+ }
+
+ /**
+ * @see org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector#introspect(javax.wsdl.PortType)
+ */
+ public WSDLServiceContract introspect(PortType portType) throws InvalidServiceContractException {
+ WSDLServiceContract contract = new WSDLServiceContract();
+ contract.setPortType(portType);
+ contract.setInterfaceName(portType.getQName().getLocalPart());
+ contract.setOperations(introspectOperations(portType));
+ // FIXME: set to Non-conversational for now
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ return contract;
+ }
+
+ /**
+ * @see org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector#introspect(javax.wsdl.PortType, javax.wsdl.PortType)
+ */
+ public WSDLServiceContract introspect(PortType portType, PortType callbackPortType)
+ throws InvalidServiceContractException {
+ assert portType != null : "PortType cannot be null";
+ WSDLServiceContract contract = new WSDLServiceContract();
+ // FIXME: set to Non-conversational for now
+ contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
+ contract.setPortType(portType);
+ contract.setInterfaceName(portType.getQName().getLocalPart());
+ contract.setOperations(introspectOperations(portType));
+ if (callbackPortType != null) {
+ contract.setCallbackPortType(callbackPortType);
+ contract.setCallbackName(callbackPortType.getQName().getLocalPart());
+ contract.setCallbackOperations(introspectOperations(callbackPortType));
+ }
+ return contract;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java
new file mode 100644
index 0000000000..8ebf086091
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLLoader.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.idl.InvalidServiceContractException;
+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.MissingResourceException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * Loads a WSDL interface definition from an XML-based assembly file
+ *
+ * @version $Rev$ $Date$
+ */
+public class InterfaceWSDLLoader extends LoaderExtension {
+ public static final QName INTERFACE_WSDL = new QName(SCA_NS, "interface.wsdl");
+
+ private static final String WSDLI = "http://www.w3.org/2006/01/wsdl-instance";
+
+ private static final String WSDLI_LOCATION = "wsdlLocation";
+
+ private WSDLDefinitionRegistry wsdlRegistry;
+
+ private InterfaceWSDLIntrospector introspector;
+
+ @Constructor({"registry", "wsdlRegistry", "introspector"})
+ public InterfaceWSDLLoader(@Autowire LoaderRegistry registry,
+ @Autowire WSDLDefinitionRegistry wsdlRegistry,
+ @Autowire InterfaceWSDLIntrospector introspector) {
+ super(registry);
+ this.wsdlRegistry = wsdlRegistry;
+ this.introspector = introspector;
+ }
+
+ public QName getXMLType() {
+ return INTERFACE_WSDL;
+ }
+
+ public WSDLServiceContract load(
+ CompositeComponent parent,
+ ModelObject object, XMLStreamReader reader,
+ DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+ assert INTERFACE_WSDL.equals(reader.getName());
+
+ String interfaceURI = reader.getAttributeValue(null, "interface");
+ if (interfaceURI == null) {
+ throw new InvalidValueException("interface");
+ }
+
+ String callbackURI = reader.getAttributeValue(null, "callbackInterface");
+ String wsdlLocation = reader.getAttributeValue(WSDLI, WSDLI_LOCATION);
+
+ Map<Class<?>, ModelObject> extensions = new HashMap<Class<?>, ModelObject>();
+ while (true) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ ModelObject mo = registry.load(parent, null, reader, deploymentContext);
+ if (mo != null) {
+ extensions.put(mo.getClass(), mo);
+ }
+ } else if (event == XMLStreamConstants.END_ELEMENT) {
+ if (reader.getName().equals(INTERFACE_WSDL)) {
+ break;
+ }
+ }
+ }
+ // FIXME set the interaction scope
+ // serviceContract.setInteractionScope(StAXUtil.interactionScope(reader.getAttributeValue(null, "scope")));
+
+ if (wsdlLocation != null) {
+ try {
+ wsdlRegistry.loadDefinition(wsdlLocation, deploymentContext.getClassLoader());
+ } catch (IOException e) {
+ throw new LoaderException(wsdlLocation, e);
+ } catch (WSDLException e) {
+ throw new LoaderException(wsdlLocation, e);
+ }
+ }
+
+ PortType portType = getPortType(interfaceURI);
+ if (portType == null) {
+ throw new MissingResourceException(interfaceURI);
+ }
+ PortType callback = null;
+ if (callbackURI != null) {
+ callback = getPortType(callbackURI);
+ }
+ try {
+ WSDLServiceContract contract = introspector.introspect(portType, callback);
+ DataType<?> dataType = (DataType<?>) extensions.get(DataType.class);
+ if (dataType != null) {
+ contract.setDataBinding(dataType.getDataBinding());
+ }
+ contract.getExtensions().putAll(extensions);
+ return contract;
+ } catch (InvalidServiceContractException e) {
+ throw new LoaderException(wsdlLocation, e);
+ }
+ }
+
+ protected PortType getPortType(String uri) {
+ // Syntax: <WSDL-namespace-URI>#wsdl.interface(<portTypeOrInterface-name>)
+ int index = uri.indexOf('#');
+ String namespace = uri.substring(0, index);
+ String name = uri.substring(index + 1);
+ name = name.substring("wsdl.interface(".length(), name.length() - 1);
+ QName qname = new QName(namespace, name);
+ return wsdlRegistry.getPortType(qname);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.java
new file mode 100644
index 0000000000..a629ff4fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidFragmentException.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.idl.wsdl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidFragmentException extends WSDLLoaderException {
+
+ public InvalidFragmentException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLContributionException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLContributionException.java
new file mode 100644
index 0000000000..dedcf352ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLContributionException.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.idl.wsdl;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidWSDLContributionException extends DeploymentException {
+
+ protected InvalidWSDLContributionException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidWSDLContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.java
new file mode 100644
index 0000000000..a22ab92863
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLException.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.idl.wsdl;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * An exception to indicate the WSDL definition is invalid
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidWSDLException extends InvalidServiceContractException {
+
+ public InvalidWSDLException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.java
new file mode 100644
index 0000000000..b2d77bf52f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InvalidWSDLLocationException.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.idl.wsdl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvalidWSDLLocationException extends WSDLLoaderException {
+
+ public InvalidWSDLLocationException(String message) {
+ super(message);
+ }
+
+ public InvalidWSDLLocationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.java
new file mode 100644
index 0000000000..04cea4cefd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/NotSupportedWSDLException.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.idl.wsdl;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+
+/**
+ * An exception to indicate some WSDL styles that we don't support
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotSupportedWSDLException extends InvalidServiceContractException {
+
+ public NotSupportedWSDLException(String message) {
+ super(message);
+ }
+
+ public NotSupportedWSDLException(String message, String identifier) {
+ super(message, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.java
new file mode 100644
index 0000000000..afb4ed3d40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/UnresolveableResourceException.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.idl.wsdl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UnresolveableResourceException extends WSDLLoaderException {
+
+ public UnresolveableResourceException(String message) {
+ super(message);
+ }
+
+ public UnresolveableResourceException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessor.java
new file mode 100644
index 0000000000..e438cd37cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessor.java
@@ -0,0 +1,263 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+import org.xml.sax.InputSource;
+
+/**
+ * The WSDL processor
+ * @version $Rev$ $Date$
+ */
+public class WSDLContributionProcessor extends ContributionProcessorExtension {
+
+ private final WSDLFactory wsdlFactory;
+
+ private final ExtensionRegistry extensionRegistry;
+
+ private final Map<String, List<Definition>> definitionsByNamespace = new HashMap<String, List<Definition>>();
+
+ private Monitor monitor;
+
+ private XMLSchemaRegistry schemaRegistry;
+
+ private ArtifactResolverRegistry artifactResolverRegistry;
+
+ public WSDLContributionProcessor() throws WSDLException {
+ wsdlFactory = WSDLFactory.newInstance();
+ extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
+ }
+
+ @Autowire
+ public void setSchemaRegistry(XMLSchemaRegistry schemaRegistry) {
+ this.schemaRegistry = schemaRegistry;
+ }
+
+ @org.apache.tuscany.api.annotation.Monitor
+ public void setMonitor(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public ExtensionRegistry getExtensionRegistry() {
+ return extensionRegistry;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Definition loadDefinition(Contribution contribution, String namespace, URI location, InputStream inputStream)
+ throws IOException, WSDLException, DeploymentException {
+ if (monitor != null) {
+ monitor.readingWSDL(namespace, location);
+ }
+
+ WSDLReader reader = wsdlFactory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setExtensionRegistry(extensionRegistry);
+
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(contribution, location, inputStream);
+ Definition definition = reader.readWSDL(locator);
+ String definitionNamespace = definition.getTargetNamespace();
+ if (namespace != null && !namespace.equals(definitionNamespace)) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != "
+ + definition.getTargetNamespace());
+ }
+
+ // Load inline schemas
+ registry.processModel(contribution, location, definition);
+ for (Object i : definition.getImports().values()) {
+ List<Import> imps = (List<Import>)i;
+ for (Import imp : imps) {
+ Definition imported = imp.getDefinition();
+ if (imported != null) {
+ // TODO:
+ registry.processModel(contribution, URI.create(imp.getDefinition().getDocumentBaseURI()), definition);
+ }
+ }
+ }
+
+ if (monitor != null) {
+ monitor.cachingDefinition(definitionNamespace, location);
+ }
+ List<Definition> definitions = definitionsByNamespace.get(definitionNamespace);
+ if (definitions == null) {
+ definitions = new ArrayList<Definition>();
+ definitionsByNamespace.put(definitionNamespace, definitions);
+ }
+ definitions.add(definition);
+
+ DeployedArtifact artifact = contribution.getArtifact(location);
+ artifact.addModelObject(Definition.class, definition.getTargetNamespace(), definition);
+
+ return definition;
+ }
+
+ public PortType getPortType(QName name) {
+ String namespace = name.getNamespaceURI();
+ List<Definition> definitions = definitionsByNamespace.get(namespace);
+ if (definitions == null) {
+ return null;
+ }
+ for (Definition definition : definitions) {
+ PortType portType = definition.getPortType(name);
+ if (portType != null) {
+ return portType;
+ }
+ }
+ return null;
+ }
+
+ public Service getService(QName name) {
+ String namespace = name.getNamespaceURI();
+ List<Definition> definitions = definitionsByNamespace.get(namespace);
+ if (definitions == null) {
+ return null;
+ }
+ for (Definition definition : definitions) {
+ Service service = definition.getService(name);
+ if (service != null) {
+ return service;
+ }
+ }
+ return null;
+ }
+
+ public static interface Monitor {
+ /**
+ * Monitor event emitted immediately before an attempt is made to read
+ * WSDL for the supplied namespace from the supplied location.
+ *
+ * @param namespace the target namespace expected in the WSDL; may be
+ * null
+ * @param location the location where we will attempt to read the WSDL
+ * definition from
+ */
+ void readingWSDL(String namespace, URI location);
+
+ /**
+ * Monitor event emitted immediately before registering a WSDL
+ * definition in the cache.
+ *
+ * @param namespace the target namespace for the WSDL
+ * @param location the location where the WSDL definition was read from
+ */
+ void cachingDefinition(String namespace, URI location);
+ }
+
+ public XMLSchemaRegistry getSchemaRegistry() {
+ if (schemaRegistry == null) {
+ // Default
+ schemaRegistry = new XMLSchemaRegistryImpl();
+ }
+ return schemaRegistry;
+ }
+
+ public class WSDLLocatorImpl implements WSDLLocator {
+ private Contribution contribution;
+ private InputStream inputStream;
+ private String baseURI;
+ private URI latestImportURI;
+
+ public WSDLLocatorImpl(Contribution contribution, URI baseURI, InputStream is) {
+ this.contribution = contribution;
+ this.baseURI = baseURI.toString();
+ this.inputStream = is;
+ }
+
+ public void close() {
+ // inputStream.close();
+ }
+
+ public InputSource getBaseInputSource() {
+ return new InputSource(inputStream);
+ }
+
+ public String getBaseURI() {
+ return baseURI;
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String importLocation) {
+ try {
+ URL url = artifactResolverRegistry.resolve(contribution, null, importLocation, parentLocation);
+ latestImportURI = url.toURI();
+ return new InputSource(url.openStream());
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI.toString();
+ }
+
+ }
+
+ public String getContentType() {
+ return "application/vnd.tuscany.wsdl";
+ }
+
+ /**
+ * @param artifactResolverRegistry the artifactResolverRegistry to set
+ */
+ @Autowire
+ public void setArtifactResolverRegistry(ArtifactResolverRegistry artifactResolverRegistry) {
+ this.artifactResolverRegistry = artifactResolverRegistry;
+ }
+
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ throws DeploymentException, IOException {
+ try {
+ loadDefinition(contribution, null, source, inputStream);
+ } catch (WSDLException e) {
+ throw new InvalidWSDLContributionException(contribution.getArtifact(source).getLocation().toExternalForm(), e);
+ }
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.java
new file mode 100644
index 0000000000..f7fd7de5ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistry.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.idl.wsdl;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.xml.namespace.QName;
+
+/**
+ * A service for caching WSDLs
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface WSDLDefinitionRegistry {
+ /**
+ * Loads and registers a WSDL Definition.
+ *
+ * @param namespace the expected namespace, or null if any namespace should be allowed
+ * @param location the location to load the definition from
+ * @return the loaded Definition
+ * @throws IOException if there was a problem reading the document
+ * @throws WSDLException if there was a problem parsing the definition
+ */
+ Definition loadDefinition(String namespace, URL location) throws IOException, WSDLException;
+
+ /**
+ * Load and register a WSDL definition as specified in a WSDL2.0 wsdlLocation attribute.
+ *
+ * @param wsdlLocation the value of the wsdlLocation attribute
+ * @param classLoader application classloader used to support relative locations
+ * @return the loaded Definition
+ * @throws IOException if there was a problem reading the document
+ * @throws WSDLException if there was a problem parsing the definition
+ */
+ Definition loadDefinition(String wsdlLocation, ClassLoader classLoader) throws IOException, WSDLException;
+
+ /**
+ * Returns the PortType with the supplied qualified name, or null if no such port has been defined.
+ *
+ * @param name the qualified name of the WSDL portType
+ * @return the PortType for the supplied name, or null if none has been defined
+ */
+ PortType getPortType(QName name);
+
+ /**
+ * Returns the ServiceDefinition with the supplied qualified name, or null if no such service has been defined.
+ *
+ * @param name the qualified name of the WSDL service
+ * @return the ServiceDefinition for the supplied name, or null if none has been defined
+ */
+ Service getService(QName name);
+
+
+ /**
+ * Returns the ExtensionRegistry that is used when parsing WSDL documents during the loadDefinition call.
+ *
+ * @return the ExtensionRegistry that is used when parsing WSDL documents.
+ */
+ ExtensionRegistry getExtensionRegistry();
+
+ /**
+ * Get the XMLSchemaRegistry
+ *
+ * @return
+ */
+ XMLSchemaRegistry getSchemaRegistry();
+
+ Definition getDefinition(String wsdlNamespace);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java
new file mode 100644
index 0000000000..de0accd459
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryImpl.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+
+/**
+ * The default implementation of the runtime WSDL registry
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionRegistryImpl implements WSDLDefinitionRegistry {
+ private final WSDLFactory wsdlFactory;
+
+ private final ExtensionRegistry registry;
+
+ private final Map<URL, Definition> definitionsByLocation = new HashMap<URL, Definition>();
+
+ private final Map<String, List<Definition>> definitionsByNamespace = new HashMap<String, List<Definition>>();
+
+ private Monitor monitor;
+
+ private XMLSchemaRegistry schemaRegistry;
+
+ public WSDLDefinitionRegistryImpl() throws WSDLException {
+ wsdlFactory = WSDLFactory.newInstance();
+ registry = wsdlFactory.newPopulatedExtensionRegistry();
+ }
+
+ @Autowire
+ public void setSchemaRegistry(XMLSchemaRegistry schemaRegistry) {
+ this.schemaRegistry = schemaRegistry;
+ }
+
+ @org.apache.tuscany.api.annotation.Monitor
+ public void setMonitor(Monitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public ExtensionRegistry getExtensionRegistry() {
+ return registry;
+ }
+
+ public Definition loadDefinition(String wsdlLocation, ClassLoader classLoader) throws IOException, WSDLException {
+ int index = wsdlLocation.indexOf(' ');
+ if (index == -1) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation);
+ }
+ String namespace = wsdlLocation.substring(0, index).trim();
+ URL url;
+ URI uri;
+ try {
+ uri = new URI(wsdlLocation.substring(index + 1).trim());
+ } catch (URISyntaxException e) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation);
+ }
+ if (uri.isAbsolute()) {
+ url = uri.toURL();
+ } else {
+ url = classLoader.getResource(uri.toString());
+ if (url == null) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Resource not found: " + uri);
+ }
+ }
+ return loadDefinition(namespace, url);
+ }
+
+ public Definition loadDefinition(String namespace, URL location) throws IOException, WSDLException {
+ Definition definition = definitionsByLocation.get(location);
+ if (definition != null) {
+ // return cached copy
+ return definition;
+ }
+
+ if (monitor != null) {
+ monitor.readingWSDL(namespace, location);
+ }
+ WSDLReader reader = wsdlFactory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setExtensionRegistry(registry);
+
+ definition = reader.readWSDL(location.toString());
+ String definitionNamespace = definition.getTargetNamespace();
+ if (namespace != null && !namespace.equals(definitionNamespace)) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != "
+ + definition.getTargetNamespace());
+ }
+
+ // Load inline schemas
+ getSchemaRegistry().loadSchemas(definition);
+ for (Object i : definition.getImports().values()) {
+ Import imp = (Import) i;
+ Definition imported = imp.getDefinition();
+ if (imported != null) {
+ getSchemaRegistry().loadSchemas(imported);
+ }
+ }
+
+ if (monitor != null) {
+ monitor.cachingDefinition(definitionNamespace, location);
+ }
+ definitionsByLocation.put(location, definition);
+ List<Definition> definitions = definitionsByNamespace.get(definitionNamespace);
+ if (definitions == null) {
+ definitions = new ArrayList<Definition>();
+ definitionsByNamespace.put(definitionNamespace, definitions);
+ }
+ definitions.add(definition);
+
+ return definition;
+ }
+
+ public PortType getPortType(QName name) {
+ String namespace = name.getNamespaceURI();
+ List<Definition> definitions = definitionsByNamespace.get(namespace);
+ if (definitions == null) {
+ return null;
+ }
+ for (Definition definition : definitions) {
+ PortType portType = definition.getPortType(name);
+ if (portType != null) {
+ return portType;
+ }
+ }
+ return null;
+ }
+
+ public Service getService(QName name) {
+ String namespace = name.getNamespaceURI();
+ List<Definition> definitions = definitionsByNamespace.get(namespace);
+ if (definitions == null) {
+ return null;
+ }
+ for (Definition definition : definitions) {
+ Service service = definition.getService(name);
+ if (service != null) {
+ return service;
+ }
+ }
+ return null;
+ }
+
+ public static interface Monitor {
+ /**
+ * Monitor event emitted immediately before an attempt is made to read WSDL for the supplied namespace from the
+ * supplied location.
+ *
+ * @param namespace the target namespace expected in the WSDL; may be null
+ * @param location the location where we will attempt to read the WSDL definition from
+ */
+ void readingWSDL(String namespace, URL location);
+
+ /**
+ * Monitor event emitted immediately before registering a WSDL definition in the cache.
+ *
+ * @param namespace the target namespace for the WSDL
+ * @param location the location where the WSDL definition was read from
+ */
+ void cachingDefinition(String namespace, URL location);
+ }
+
+ public XMLSchemaRegistry getSchemaRegistry() {
+ if (schemaRegistry == null) {
+ // Default
+ schemaRegistry = new XMLSchemaRegistryImpl();
+ }
+ return schemaRegistry;
+ }
+
+ public Definition getDefinition(String wsdlNamespace) {
+ List<Definition> definitions = definitionsByNamespace.get(wsdlNamespace);
+ if (definitions == null || definitions.size() < 1) {
+ return null;
+ } else {
+ return definitions.get(0);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java
new file mode 100644
index 0000000000..fb90e839f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoader.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.idl.wsdl;
+
+import java.net.URI;
+import java.util.Collection;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+/**
+ * Interface for implementations that allow WSDL definitions to be loaded. Currently we do not have a complete solution
+ * for handling both WSDL2.0 and WSDL1.1 definitions so the current implementation only deals with loading WSDL1.1. This
+ * will change in the near future (for example when Woden supports both forms) so all WSDL1.1 specific methods are
+ * deprecated.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLLoader {
+ /**
+ * Load a WSDL 1.1 Definition for a namespace from one of specified locations.
+ *
+ * @param namespace the namespace whose definition should be loaded
+ * @param locations a set of possible locations to load from
+ * @return the loaded Definition
+ * @throws WSDLException if there was a problem loading the definition
+ */
+ @Deprecated
+ Definition loadDefinition(String namespace, Collection<WSDLLocation> locations)
+ throws WSDLException, UnresolveableResourceException;
+
+ /**
+ * Load a WSDL 1.1 Definition from the specified location
+ *
+ * @param location the location to load from
+ * @return the loaded Definition
+ * @throws WSDLException if there was a problem loading the definition
+ */
+ @Deprecated
+ Definition loadDefinition(WSDLLocation location) throws WSDLException;
+
+ /**
+ * Return the WSDL1.1 PortType for the specified interface IRI.
+ *
+ * @param interfaceIRI the WSDL2.0 interface IRI
+ * @param wsdlLocation the location of the WSDL instance
+ * @param base a Classloader from which to load
+ * @return the specified port type
+ */
+ @Deprecated
+ PortType loadPortType(URI interfaceIRI, String wsdlLocation, ClassLoader base)
+ throws WSDLLoaderException, WSDLException;
+
+ /**
+ * Parses a WSDL2.0 wsdlLocation attribute definition and returns a Collection of all locations it contains.
+ *
+ * @param wsdlLocation a list of namespace/location pairs as specified by WSDL2.0
+ * @param base a ClassLoader to use to resolve relative URLs
+ * @return a collection of locations parsed from the string
+ * @throws InvalidWSDLLocationException
+ */
+ Collection<WSDLLocation> getLocations(String wsdlLocation, ClassLoader base) throws InvalidWSDLLocationException;
+
+ /**
+ * Returns the fully qualified name of a WSDL interface parsed from a IRI as defined by WSDL2.0. The value of the
+ * IRI defines the namespace, the fragment specifies the interface component; for example
+ * <code>http://example.org/TicketAgent.wsdl20#wsdl.interface(TicketAgent)</code>
+ *
+ * @param interfaceIRI the IRI for the interface
+ * @return the qualified name of the interface
+ * @throws UnresolveableResourceException if the URI is relative
+ * @throws InvalidFragmentException if the fragment is incorrectly formed
+ */
+ QName getInterfaceName(URI interfaceIRI) throws UnresolveableResourceException, InvalidFragmentException;
+
+ /**
+ * Returns an interface parsed from a wsdl.interface fragment.
+ *
+ * @param fragment the fragment value
+ * @return the interface name
+ * @throws InvalidFragmentException if the fragment is incorrectly formed
+ */
+ String getInterfaceName(String fragment) throws InvalidFragmentException;
+
+ /**
+ * Returns a namespace parsed from an IRI. This is the URI with any fragment removed.
+ *
+ * @param iri the IRI
+ * @return a namespace created by stripping fragment information from the URI
+ * @throws UnresolveableResourceException if the URI is relative
+ */
+ String getNamespace(URI iri) throws UnresolveableResourceException;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.java
new file mode 100644
index 0000000000..1fececa62c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderException.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.idl.wsdl;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class WSDLLoaderException extends TuscanyException {
+ protected WSDLLoaderException() {
+ }
+
+ protected WSDLLoaderException(String message) {
+ super(message);
+ }
+
+ protected WSDLLoaderException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected WSDLLoaderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected WSDLLoaderException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.java
new file mode 100644
index 0000000000..ebf8cafedc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImpl.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.idl.wsdl;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLLoaderImpl implements WSDLLoader {
+ private final WSDLFactory wsdlFactory;
+
+ private final ExtensionRegistry registry;
+
+ public WSDLLoaderImpl() throws WSDLException {
+ wsdlFactory = WSDLFactory.newInstance();
+ registry = wsdlFactory.newPopulatedExtensionRegistry();
+ }
+
+ public PortType loadPortType(URI interfaceIRI, String wsdlLocation, ClassLoader base)
+ throws WSDLLoaderException, WSDLException {
+ Collection<WSDLLocation> locations = getLocations(wsdlLocation, base);
+ QName interfaceName = getInterfaceName(interfaceIRI);
+
+ Definition definition = loadDefinition(interfaceName.getNamespaceURI(), locations);
+ return definition.getPortType(interfaceName);
+ }
+
+ public Definition loadDefinition(String namespace, Collection<WSDLLocation> locations)
+ throws WSDLException, UnresolveableResourceException {
+ for (WSDLLocation location : locations) {
+ if (namespace.equals(location.getNamespace()) && location.getLocation() != null) {
+ return loadDefinition(location);
+ }
+ }
+ throw new UnresolveableResourceException(namespace);
+ }
+
+ public Definition loadDefinition(WSDLLocation location) throws WSDLException {
+ String namespace = location.getNamespace();
+
+ WSDLReader reader = wsdlFactory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setExtensionRegistry(registry);
+
+ Definition definition = reader.readWSDL(location.getLocation().toString());
+ String definitionNamespace = definition.getTargetNamespace();
+ if (namespace != null && !namespace.equals(definitionNamespace)) {
+ throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != "
+ + definition.getTargetNamespace());
+ }
+ return definition;
+ }
+
+ public Collection<WSDLLocation> getLocations(String wsdlLocation, ClassLoader base)
+ throws InvalidWSDLLocationException {
+ String parts[] = wsdlLocation.split("\\s");
+ // check the number of parts is a multiple of two
+ if ((parts.length & 1) != 0) {
+ throw new InvalidWSDLLocationException(wsdlLocation);
+ }
+ List<WSDLLocation> locations = new ArrayList<WSDLLocation>(parts.length >>> 1);
+ for (int i = 0; i < parts.length; i += 2) {
+ URL url;
+ try {
+ URI uri = new URI(parts[i + 1]);
+ if (uri.isAbsolute()) {
+ url = uri.toURL();
+ } else {
+ url = base.getResource(uri.toString());
+ }
+ } catch (MalformedURLException e) {
+ throw new InvalidWSDLLocationException(e);
+ } catch (URISyntaxException e) {
+ throw new InvalidWSDLLocationException(e);
+ }
+ WSDLLocation location = new WSDLLocation(parts[i], url);
+ locations.add(location);
+ }
+ return locations;
+ }
+
+ public QName getInterfaceName(URI interfaceIRI) throws UnresolveableResourceException, InvalidFragmentException {
+ String namespace = getNamespace(interfaceIRI);
+ String interfaceName = getInterfaceName(interfaceIRI.getFragment());
+ return new QName(namespace, interfaceName);
+ }
+
+ public String getInterfaceName(String fragment) throws InvalidFragmentException {
+ if (fragment == null) {
+ throw new InvalidFragmentException("missing fragment");
+ }
+ String[] parts = fragment.split("\\s");
+ for (String part : parts) {
+ if (part.startsWith("wsdl.interface(") && part.charAt(part.length() - 1) == ')') {
+ return part.substring(15, part.length() - 1);
+ }
+ }
+ throw new InvalidFragmentException(fragment);
+ }
+
+ public String getNamespace(URI iri) throws UnresolveableResourceException {
+ if (!iri.isAbsolute()) {
+ throw new UnresolveableResourceException("No namespace defined in", iri.toString());
+ }
+ StringBuilder s = new StringBuilder();
+ s.append(iri.getScheme());
+ s.append(':');
+ s.append(iri.getSchemeSpecificPart());
+ return s.toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.java
new file mode 100644
index 0000000000..a124294c3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLLocation.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.idl.wsdl;
+
+import java.net.URL;
+
+/**
+ * A location where the WSDL for a namespace can be found.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLLocation {
+ private final String namespace;
+ private final URL location;
+
+ /**
+ * Constructor specifying a namespace and where its WSDL can be found.
+ *
+ * @param namespace the target namespace
+ * @param location the location of the WSDL
+ */
+ public WSDLLocation(String namespace, URL location) {
+ this.namespace = namespace;
+ this.location = location;
+ }
+
+ /**
+ * Returns the target namespace.
+ *
+ * @return the target namespace
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * Returns the location where the WSDL definition can be found.
+ *
+ * @return the location where the WSDL definition can be found
+ */
+ public URL getLocation() {
+ return location;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
new file mode 100644
index 0000000000..2cc501ac9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
@@ -0,0 +1,525 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.databinding.DataBinding;
+import org.apache.tuscany.spi.idl.ElementInfo;
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.ServiceFaultException;
+import org.apache.tuscany.spi.idl.TypeInfo;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.WrapperInfo;
+import org.apache.tuscany.spi.model.DataType;
+
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * Metadata for a WSDL operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLOperation {
+ protected XMLSchemaRegistry schemaRegistry;
+ protected Operation operation;
+ protected org.apache.tuscany.spi.model.Operation<XMLType> operationModel;
+ protected DataType<List<DataType<XMLType>>> inputType;
+ protected DataType<XMLType> outputType;
+ protected List<DataType<XMLType>> faultTypes;
+ private String dataBinding;
+
+ /**
+ * @param operation The WSDL4J operation
+ * @param dataBinding The default databinding
+ * @param schemaRegistry The XML Schema registry
+ */
+ public WSDLOperation(Operation operation, String dataBinding, XMLSchemaRegistry schemaRegistry) {
+ super();
+ this.operation = operation;
+ this.dataBinding = dataBinding;
+ this.schemaRegistry = schemaRegistry;
+ this.wrapper = new Wrapper();
+ }
+
+ private Wrapper wrapper;
+
+ private Boolean wrapperStyle;
+
+ /**
+ * Test if the operation qualifies wrapper style as defined by the JAX-WS
+ * 2.0 spec
+ *
+ * @return true if the operation qualifies wrapper style, otherwise false
+ */
+ public boolean isWrapperStyle() throws InvalidWSDLException {
+ if (wrapperStyle == null) {
+ wrapperStyle =
+ wrapper.getInputChildElements() != null && (operation.getOutput() == null || wrapper
+ .getOutputChildElements() != null);
+ }
+ return wrapperStyle;
+ }
+
+ public Wrapper getWrapper() throws InvalidWSDLException {
+ if (!isWrapperStyle()) {
+ throw new IllegalStateException("The operation is not wrapper style.");
+ } else {
+ return wrapper;
+ }
+ }
+
+ /**
+ * @return
+ * @throws InvalidServiceContractException
+ */
+ public DataType<List<DataType<XMLType>>> getInputType() throws InvalidServiceContractException {
+ if (inputType == null) {
+ Input input = operation.getInput();
+ Message message = (input == null) ? null : input.getMessage();
+ inputType = getMessageType(message);
+ inputType.setDataBinding(DataBinding.IDL_INPUT);
+ }
+ return inputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public DataType<XMLType> getOutputType() throws InvalidServiceContractException {
+ if (outputType == null) {
+ Output output = operation.getOutput();
+ Message outputMsg = (output == null) ? null : output.getMessage();
+
+ List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null);
+ if (outputParts != null && outputParts.size() > 0) {
+ if (outputParts.size() > 1) {
+ // We don't support output with multiple parts
+ throw new NotSupportedWSDLException("Multi-part output is not supported");
+ }
+ Part part = (Part)outputParts.get(0);
+ outputType = new WSDLPart(part, Object.class).getDataType();
+ // outputType.setMetadata(WSDLOperation.class.getName(), this);
+ }
+ }
+ return outputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public List<DataType<XMLType>> getFaultTypes() throws InvalidServiceContractException {
+ if (faultTypes == null) {
+ Collection faults = operation.getFaults().values();
+ faultTypes = new ArrayList<DataType<XMLType>>();
+ for (Object f : faults) {
+ Fault fault = (Fault)f;
+ Message faultMsg = fault.getMessage();
+ List faultParts = faultMsg.getOrderedParts(null);
+ if (faultParts.size() != 1) {
+ throw new NotSupportedWSDLException("The fault message MUST have a single part");
+ }
+ Part part = (Part)faultParts.get(0);
+ WSDLPart wsdlPart = new WSDLPart(part, ServiceFaultException.class);
+ faultTypes.add(wsdlPart.getDataType());
+ }
+ }
+ return faultTypes;
+ }
+
+ private DataType<List<DataType<XMLType>>> getMessageType(Message message) throws InvalidServiceContractException {
+ List<DataType<XMLType>> partTypes = new ArrayList<DataType<XMLType>>();
+ if (message != null) {
+ Collection parts = message.getOrderedParts(null);
+ for (Object p : parts) {
+ WSDLPart part = new WSDLPart((Part)p, Object.class);
+ DataType<XMLType> partType = part.getDataType();
+ partTypes.add(partType);
+ }
+ }
+ return new DataType<List<DataType<XMLType>>>(dataBinding, Object[].class, partTypes);
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public org.apache.tuscany.spi.model.Operation<XMLType> getOperation() throws InvalidServiceContractException {
+ if (operationModel == null) {
+ boolean oneway = (operation.getOutput() == null);
+ operationModel =
+ new org.apache.tuscany.spi.model.Operation<XMLType>(
+ operation.getName(),
+ getInputType(),
+ getOutputType(),
+ getFaultTypes(),
+ oneway,
+ dataBinding,
+ org.apache.tuscany.spi.model.Operation.NO_CONVERSATION);
+ operationModel.setWrapperStyle(isWrapperStyle());
+ // operationModel.setMetaData(WSDLOperation.class.getName(), this);
+ if (isWrapperStyle()) {
+ WrapperInfo wrapperInfo = getWrapper().getWrapperInfo();
+ operationModel.setWrapper(wrapperInfo);
+ // Register the operation with the types
+ for (DataType<?> d : wrapperInfo.getUnwrappedInputType().getLogical()) {
+ d.setOperation(operationModel);
+ }
+ if (wrapperInfo.getUnwrappedOutputType() != null) {
+ wrapperInfo.getUnwrappedOutputType().setOperation(operationModel);
+ }
+ }
+ }
+ inputType.setOperation(operationModel);
+ if (outputType != null) {
+ outputType.setOperation(operationModel);
+ }
+ return operationModel;
+ }
+
+ /**
+ * Metadata for a WSDL part
+ */
+ public class WSDLPart {
+ private Part part;
+
+ private XmlSchemaElement element;
+
+ private DataType<XMLType> dataType;
+
+ public WSDLPart(Part part, Class javaType) throws InvalidWSDLException {
+ this.part = part;
+ QName elementName = part.getElementName();
+ if (elementName != null) {
+ element = schemaRegistry.getElement(elementName);
+ if (element == null) {
+ throw new InvalidWSDLException("Element cannot be resolved", elementName.toString());
+ }
+ } else {
+ // Create an faked XSD element to host the metadata
+ element = new XmlSchemaElement();
+ element.setName(part.getName());
+ element.setQName(new QName(null, part.getName()));
+ QName typeName = part.getTypeName();
+ if (typeName != null) {
+ XmlSchemaType type = schemaRegistry.getType(typeName);
+ if (type == null) {
+ throw new InvalidWSDLException("Type cannot be resolved", typeName.toString());
+ }
+ element.setSchemaType(type);
+ element.setSchemaTypeName(type.getQName());
+ }
+ }
+ dataType = new DataType<XMLType>(dataBinding, javaType, new XMLType(getElementInfo(element)));
+ // dataType.setMetadata(WSDLPart.class.getName(), this);
+ // dataType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ }
+
+ /**
+ * @return the element
+ */
+ public XmlSchemaElement getElement() {
+ return element;
+ }
+
+ /**
+ * @return the part
+ */
+ public Part getPart() {
+ return part;
+ }
+
+ /**
+ * @return the dataType
+ */
+ public DataType<XMLType> getDataType() {
+ return dataType;
+ }
+ }
+
+ /**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for
+ * XML-Based Web Services (JAX-WS) 2.0 specification, section 2.3.1.2
+ * Wrapper Style. <p/> A WSDL operation qualifies for wrapper style mapping
+ * only if the following criteria are met:
+ * <ul>
+ * <li>(i) The operation’s input and output messages (if present) each
+ * contain only a single part
+ * <li>(ii) The input message part refers to a global element declaration
+ * whose localname is equal to the operation name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(iv) The elements referred to by the input and output message parts
+ * (henceforth referred to as wrapper elements) are both complex types
+ * defined using the xsd:sequence compositor
+ * <li>(v) The wrapper elements only contain child elements, they must not
+ * contain other structures such as wildcards (element or attribute),
+ * xsd:choice, substitution groups (element references are not permitted) or
+ * attributes; furthermore, they must not be nillable.
+ * </ul>
+ */
+ public class Wrapper {
+ private XmlSchemaElement inputWrapperElement;
+
+ private XmlSchemaElement outputWrapperElement;
+
+ private List<XmlSchemaElement> inputElements;
+
+ private List<XmlSchemaElement> outputElements;
+
+ private DataType<List<DataType<XMLType>>> unwrappedInputType;
+
+ private DataType<XMLType> unwrappedOutputType;
+
+ private transient WrapperInfo wrapperInfo;
+
+ private List<XmlSchemaElement> getChildElements(XmlSchemaElement element) throws InvalidWSDLException {
+ if (element == null) {
+ return null;
+ }
+ if (element.isNillable()) {
+ // Wrapper element cannot be nillable
+ return null;
+ }
+ XmlSchemaType type = element.getSchemaType();
+ if (type == null) {
+ String qName = element.getQName().toString();
+ throw new InvalidWSDLException("The XML schema element does not have a type", qName);
+ }
+ if (!(type instanceof XmlSchemaComplexType)) {
+ // Has to be a complexType
+ return null;
+ }
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
+ if (complexType.getAttributes().getCount() != 0 || complexType.getAnyAttribute() != null) {
+ // No attributes
+ return null;
+ }
+ XmlSchemaParticle particle = complexType.getParticle();
+ if (particle == null) {
+ // No particle
+ return Collections.emptyList();
+ }
+ if (!(particle instanceof XmlSchemaSequence)) {
+ return null;
+ }
+ XmlSchemaSequence sequence = (XmlSchemaSequence)complexType.getParticle();
+ XmlSchemaObjectCollection items = sequence.getItems();
+ List<XmlSchemaElement> childElements = new ArrayList<XmlSchemaElement>();
+ for (int i = 0; i < items.getCount(); i++) {
+ XmlSchemaObject schemaObject = items.getItem(i);
+ if (!(schemaObject instanceof XmlSchemaElement)) {
+ return null;
+ }
+ XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
+ if (childElement.getName() == null || childElement.getRefName() != null) {
+ return null;
+ }
+ // TODO: Do we support maxOccurs >1 ?
+ if (childElement.getMaxOccurs() > 1) {
+ return null;
+ }
+ childElements.add(childElement);
+ }
+ return childElements;
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped request element
+ *
+ * @return a list of child XSD elements or null if if the request
+ * element is not wrapped
+ */
+ public List<XmlSchemaElement> getInputChildElements() throws InvalidWSDLException {
+ if (inputElements != null) {
+ return inputElements;
+ }
+ Input input = operation.getInput();
+ if (input != null) {
+ Message inputMsg = input.getMessage();
+ Collection parts = inputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part)parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ return null;
+ }
+ if (!operation.getName().equals(elementName.getLocalPart())) {
+ return null;
+ }
+ inputWrapperElement = schemaRegistry.getElement(elementName);
+ if (inputWrapperElement == null) {
+ throw new InvalidWSDLException("The element is not declared in a XML schema", elementName
+ .toString());
+ }
+ inputElements = getChildElements(inputWrapperElement);
+ return inputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped response
+ * element
+ *
+ * @return a list of child XSD elements or null if if the response
+ * element is not wrapped
+ */
+ public List<XmlSchemaElement> getOutputChildElements() throws InvalidWSDLException {
+ if (outputElements != null) {
+ return outputElements;
+ }
+ Output output = operation.getOutput();
+ if (output != null) {
+ Message outputMsg = output.getMessage();
+ Collection parts = outputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part)parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ throw new InvalidWSDLException("The element is not declared in the XML schema", part.getName());
+ }
+ outputWrapperElement = schemaRegistry.getElement(elementName);
+ if (outputWrapperElement == null) {
+ return null;
+ }
+ outputElements = getChildElements(outputWrapperElement);
+ // FIXME: Do we support multiple child elements for the
+ // response?
+ return outputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the inputWrapperElement
+ */
+ public XmlSchemaElement getInputWrapperElement() {
+ return inputWrapperElement;
+ }
+
+ /**
+ * @return the outputWrapperElement
+ */
+ public XmlSchemaElement getOutputWrapperElement() {
+ return outputWrapperElement;
+ }
+
+ /*
+ public DataType<List<DataType<XMLType>>> getUnwrappedInputType() throws InvalidWSDLException {
+ if (unwrappedInputType == null) {
+ List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
+ for (XmlSchemaElement element : getInputChildElements()) {
+ DataType<XMLType> type =
+ new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
+ // type.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ childTypes.add(type);
+ }
+ unwrappedInputType =
+ new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ public DataType<XMLType> getUnwrappedOutputType() throws InvalidServiceContractException {
+ if (unwrappedOutputType == null) {
+ List<XmlSchemaElement> elements = getOutputChildElements();
+ if (elements != null && elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new NotSupportedWSDLException("Multi-part output is not supported");
+ }
+ XmlSchemaElement element = elements.get(0);
+ unwrappedOutputType =
+ new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
+ // unwrappedOutputType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ }
+ }
+ return unwrappedOutputType;
+ }
+ */
+
+ public WrapperInfo getWrapperInfo() throws InvalidServiceContractException {
+ if (wrapperInfo == null) {
+ ElementInfo in = getElementInfo(getInputWrapperElement());
+ ElementInfo out = getElementInfo(getOutputWrapperElement());
+ List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
+ for (XmlSchemaElement e : getInputChildElements()) {
+ inChildren.add(getElementInfo(e));
+ }
+ List<ElementInfo> outChildren = new ArrayList<ElementInfo>();
+ if (out != null) {
+ for (XmlSchemaElement e : getOutputChildElements()) {
+ outChildren.add(getElementInfo(e));
+ }
+ }
+ wrapperInfo =
+ new WrapperInfo(dataBinding, in, out, inChildren, outChildren);
+ }
+ return wrapperInfo;
+ }
+ }
+
+ private static ElementInfo getElementInfo(XmlSchemaElement element) {
+ if (element == null) {
+ return null;
+ }
+ return new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType()));
+ }
+
+ private static TypeInfo getTypeInfo(XmlSchemaType type) {
+ if (type == null) {
+ return null;
+ }
+ XmlSchemaType baseType = (XmlSchemaType)type.getBaseSchemaType();
+ QName name = type.getQName();
+ boolean simple = (type instanceof XmlSchemaSimpleType);
+ if (baseType == null) {
+ return new TypeInfo(name, simple, null);
+ } else {
+ return new TypeInfo(name, simple, getTypeInfo(baseType));
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.java
new file mode 100644
index 0000000000..f498dc66ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLServiceContract.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.idl.wsdl;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.ServiceContract;
+
+/**
+ * Represents a service contract specified by a WSDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLServiceContract extends ServiceContract<XMLType> {
+ private PortType portType;
+ private PortType callbackPortType;
+
+ /**
+ *
+ */
+ public WSDLServiceContract() {
+ super();
+ this.remotable = true; // WSDL interface is always remotable by the SCA spec
+ }
+
+
+ public PortType getPortType() {
+ return portType;
+ }
+
+ public void setPortType(PortType portType) {
+ this.portType = portType;
+ }
+
+ public PortType getCallbackPortType() {
+ return callbackPortType;
+ }
+
+ public void setCallbackPortType(PortType callbackPortType) {
+ this.callbackPortType = callbackPortType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.java
new file mode 100644
index 0000000000..681e08be4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistry.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 org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaException;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * A service for caching XML Schemas
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XMLSchemaRegistry {
+ /**
+ * Load all inline schemas from the WSDL definition
+ *
+ * @param definition The WSDL defintion whose types element contains a list of schemas
+ * @return A list of inline schemas
+ */
+ List<XmlSchema> loadSchemas(Definition definition);
+
+ /**
+ * Loads and registers a XML schema.
+ *
+ * @param namespace the expected namespace, or null if any namespace should be allowed
+ * @param location the location to load the schema from
+ * @return the loaded Definition
+ * @throws IOException if there was a problem reading the document
+ * @throws XmlSchemaException if there was a problem parsing the schema
+ */
+ XmlSchema loadSchema(String namespace, URL location) throws IOException, XmlSchemaException;
+
+ /**
+ * Load and register a XML schema as specified in a XSD schemaLocation attribute.
+ *
+ * @param schemaLocation the value of the schemaLocation attribute
+ * @param classLoader application classloader used to support relative locations
+ * @return the loaded schema
+ * @throws IOException if there was a problem reading the document
+ * @throws XmlSchemaException if there was a problem parsing the schema
+ */
+ XmlSchema loadSchema(String schemaLocation, ClassLoader classLoader) throws IOException, XmlSchemaException;
+
+ /**
+ * Returns the XSD Element with the supplied qualified name, or null if no such element has been defined.
+ *
+ * @param name the qualified name of the XSD element
+ * @return the XSD element for the supplied name, or null if none has been defined
+ */
+ XmlSchemaElement getElement(QName name);
+
+ /**
+ * Returns the XmlSchemaType with the supplied qualified name, or null if no such type has been defined.
+ *
+ * @param name the qualified name of the XSD type
+ * @return the XSD type for the supplied name, or null if none has been defined
+ */
+ XmlSchemaType getType(QName name);
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java
new file mode 100644
index 0000000000..08600e4b7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.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.idl.wsdl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.schema.Schema;
+import javax.xml.namespace.QName;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaException;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Element;
+
+/**
+ * Default implementation of XMLSchemaRegistry
+ */
+@Service(XMLSchemaRegistry.class)
+public class XMLSchemaRegistryImpl implements XMLSchemaRegistry {
+ private final XmlSchemaCollection collection;
+
+ /**
+ * @param collection
+ */
+ public XMLSchemaRegistryImpl(XmlSchemaCollection collection) {
+ super();
+ this.collection = collection;
+ }
+
+ public XMLSchemaRegistryImpl() {
+ super();
+ this.collection = new XmlSchemaCollection();
+ }
+
+ public XmlSchemaElement getElement(QName name) {
+ return collection.getElementByQName(name);
+ }
+
+ public XmlSchemaType getType(QName name) {
+ return collection.getTypeByQName(name);
+ }
+
+ public List<XmlSchema> loadSchemas(Definition definition) {
+ Types types = definition.getTypes();
+ if (types == null) {
+ return Collections.emptyList();
+ }
+ List<XmlSchema> schemas = new ArrayList<XmlSchema>();
+ for (Object ext : types.getExtensibilityElements()) {
+ if (ext instanceof Schema) {
+ Element element = ((Schema) ext).getElement();
+ XmlSchema s = collection.read(element, element.getBaseURI());
+ schemas.add(s);
+ }
+ }
+ return schemas;
+ }
+
+ public XmlSchema loadSchema(String namespace, URL location) throws IOException, XmlSchemaException {
+ XmlSchema schema;
+ XmlSchema[] schemaList = collection.getXmlSchema(location.toExternalForm());
+ if (schemaList != null && schemaList.length > 0) {
+ schema = schemaList[0];
+ } else {
+ InputStream is = location.openStream();
+ schema = collection.read(new InputStreamReader(is), null);
+ is.close();
+ }
+ if (namespace != null && schema != null && !namespace.equals(schema.getTargetNamespace())) {
+ throw new XmlSchemaException(namespace + " != " + schema.getTargetNamespace());
+ }
+ return schema;
+ }
+
+ public XmlSchema loadSchema(String schemaLocation, ClassLoader classLoader) throws IOException, XmlSchemaException {
+ int index = schemaLocation.indexOf(' ');
+ if (index == -1) {
+ throw new XmlSchemaException("Invalid schemaLocation: " + schemaLocation);
+ }
+ String namespace = schemaLocation.substring(0, index).trim();
+ URL url;
+ URI uri;
+ try {
+ uri = new URI(schemaLocation.substring(index + 1).trim());
+ } catch (URISyntaxException e) {
+ throw new XmlSchemaException("Invalid schemaLocation: " + schemaLocation);
+ }
+ if (uri.isAbsolute()) {
+ url = uri.toURL();
+ } else {
+ url = classLoader.getResource(uri.toString());
+ if (url == null) {
+ throw new XmlSchemaException("Resource cannot be resolved: schemaLocation: " + schemaLocation);
+ }
+ }
+ return loadSchema(namespace, url);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessor.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessor.java
new file mode 100644
index 0000000000..43c5c05ea4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessor.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.schema.Schema;
+
+import org.apache.tuscany.host.deployment.DeploymentException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.extension.ContributionProcessorExtension;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaException;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+/**
+ * The XSD processor
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDContributionProcessor extends ContributionProcessorExtension {
+
+ private ArtifactResolverRegistry artifactResolverRegistry;
+
+ public XSDContributionProcessor() throws WSDLException {
+ }
+
+ /**
+ * URI resolver implementation for xml schema
+ */
+ protected class URIResolverImpl implements URIResolver {
+ private Contribution contribution;
+
+ public URIResolverImpl(Contribution contriution) {
+ this.contribution = contriution;
+ }
+
+ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
+ java.lang.String schemaLocation,
+ java.lang.String baseUri) {
+ try {
+ URL url = artifactResolverRegistry.resolve(contribution, targetNamespace, schemaLocation, baseUri);
+ return new InputSource(url.openStream());
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public XmlSchema loadSchema(Contribution contribution, String namespace, URI location, InputStream inputStream)
+ throws IOException, DeploymentException {
+ XmlSchemaCollection collection = new XmlSchemaCollection();
+ collection.setSchemaResolver(new URIResolverImpl(contribution));
+ XmlSchema schema = collection.read(new InputStreamReader(inputStream), null);
+
+ if (namespace != null && schema != null && !namespace.equals(schema.getTargetNamespace())) {
+ throw new XmlSchemaException(namespace + " != " + schema.getTargetNamespace());
+ }
+
+ DeployedArtifact artifact = contribution.getArtifact(location);
+ artifact.addModelObject(XmlSchema.class, schema.getTargetNamespace(), schema);
+ return schema;
+ }
+
+ public void loadSchemas(Contribution contribution, URI source, Definition definition) {
+ Types types = definition.getTypes();
+ if (types != null) {
+ DeployedArtifact artifact = contribution.getArtifact(source);
+ XmlSchemaCollection collection = new XmlSchemaCollection();
+ for (Object ext : types.getExtensibilityElements()) {
+ if (ext instanceof Schema) {
+ Element element = ((Schema)ext).getElement();
+ XmlSchema s = collection.read(element, element.getBaseURI());
+ artifact.addModelObject(XmlSchema.class, s.getTargetNamespace(), s);
+ }
+ }
+ }
+ }
+
+ public String getContentType() {
+ return "application/vnd.tuscany.xsd";
+ }
+
+ /**
+ * @param artifactResolverRegistry the artifactResolverRegistry to set
+ */
+ @Autowire
+ public void setArtifactResolverRegistry(ArtifactResolverRegistry artifactResolverRegistry) {
+ this.artifactResolverRegistry = artifactResolverRegistry;
+ }
+
+ public void processContent(Contribution contribution, URI source, InputStream inputStream)
+ throws DeploymentException, IOException {
+ loadSchema(contribution, null, source, inputStream);
+ }
+
+ public void processModel(Contribution contribution, URI source, Object modelObject) throws DeploymentException,
+ IOException {
+ if (modelObject instanceof Definition) {
+ loadSchemas(contribution, source, (Definition)modelObject);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..266b74ffe1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ IDL WSDL extension
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.wsdl">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.idl</group>
+ <name>wsdl</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/extension.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/extension.composite
new file mode 100644
index 0000000000..e689b1f23e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/extension.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.idl.wsdl">
+ <include name="org.apache.tuscany.idl.wsdl.include" scdlLocation="idl.wsdl.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl
new file mode 100644
index 0000000000..666f5f9bcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/main/resources/META-INF/sca/idl.wsdl.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ IDL WSDL extension
+
+ This is a copy to be included by other extensions
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.wsdl.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services.idl</group>
+ <name>wsdl</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java
new file mode 100644
index 0000000000..7cc17d6e65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.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.idl.wsdl;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.spi.model.Operation;
+
+/**
+ * Test case for InterfaceWSDLIntrospectorImpl
+ */
+public class InterfaceWSDLIntrospectorImplTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDefinitionRegistryImpl registry;
+ private PortType portType;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDefinitionRegistryImpl();
+ registry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ URL url = getClass().getResource("stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ portType = definition.getPortType(PORTTYPE_NAME);
+ }
+
+ public final void testIntrospectPortType() throws InvalidServiceContractException {
+ InterfaceWSDLIntrospector introspector = new InterfaceWSDLIntrospectorImpl(registry);
+ WSDLServiceContract contract = introspector.introspect(portType);
+ Assert.assertEquals(contract.getInterfaceName(), "StockQuotePortType");
+ Map<String, Operation<XMLType>> operations = contract.getOperations();
+ Assert.assertEquals(1, operations.size());
+ Operation<XMLType> operation = operations.get("getLastTradePrice");
+ Assert.assertNotNull(operation);
+ DataType<List<DataType<XMLType>>> inputType = operation.getInputType();
+ Assert.assertEquals(1, inputType.getLogical().size());
+ DataType<XMLType> returnType = operation.getOutputType();
+ Assert.assertNotNull(returnType);
+ Assert.assertEquals(0, operation.getFaultTypes().size());
+ Assert.assertEquals(1, operation.getWrapper().getInputChildElements().size());
+ Assert.assertEquals(1, operation.getWrapper().getOutputChildElements().size());
+ }
+
+ public final void testIntrospectPortTypePortType() throws InvalidServiceContractException {
+ InterfaceWSDLIntrospector introspector = new InterfaceWSDLIntrospectorImpl(registry);
+ WSDLServiceContract contract = introspector.introspect(portType, portType);
+ Assert.assertEquals("StockQuotePortType", contract.getInterfaceName());
+ Assert.assertEquals("StockQuotePortType", contract.getCallbackName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessorTestCase.java
new file mode 100644
index 0000000000..ee4143af48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLContributionProcessorTestCase.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.idl.wsdl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.replay;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLContributionProcessorTestCase extends TestCase {
+ private WSDLContributionProcessor processor;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new WSDLContributionProcessor();
+ ArtifactResolverRegistry registry = createMock(ArtifactResolverRegistry.class);
+ URL url = getClass().getResource("test2.wsdl");
+ expect(registry.resolve(isA(Contribution.class),
+ (String)isNull(),
+ isA(String.class),
+ isA(String.class))).andReturn(url).anyTimes();
+ processor.setArtifactResolverRegistry(registry);
+ replay(registry);
+
+ ContributionProcessorRegistry processorRegistry = createMock(ContributionProcessorRegistry.class);
+ processorRegistry.processModel(isA(Contribution.class), isA(URI.class), isA(Definition.class));
+ expectLastCall().anyTimes();
+ replay(processorRegistry);
+ processor.setContributionProcessorRegistry(processorRegistry);
+ }
+
+ public void testLoad() throws Exception {
+ URI uri = URI.create("sca://contribution/001");
+ Contribution contribution = new Contribution(uri);
+
+ addArtifact(contribution, "sca://contribution/001/test1.wsdl");
+ addArtifact(contribution, "sca://contribution/001/test2.wsdl");
+ addArtifact(contribution, "sca://contribution/001/ipo.xsd");
+
+ URL url = getClass().getResource("test1.wsdl");
+ try {
+ processor.processContent(contribution, URI.create("sca://contribution/001/test1.wsdl"), url.openStream());
+ } catch (Throwable e) {
+ fail(e.getMessage());
+ }
+ }
+
+ private DeployedArtifact addArtifact(Contribution contribution, String artifact) {
+ DeployedArtifact a1 = new DeployedArtifact(URI.create(artifact));
+ contribution.addArtifact(a1);
+ return a1;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.java
new file mode 100644
index 0000000000..d878b465a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLDefinitionRegistryTestCase.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.idl.wsdl;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+import junit.framework.Assert;
+
+/**
+ * Verifies the default WSDL registry implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionRegistryTestCase extends TestCase {
+ private static final String NS = "http://www.example.org";
+ private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() {
+ public void readingWSDL(String namespace, URL location) {
+ }
+
+ public void cachingDefinition(String namespace, URL location) {
+ }
+ };
+ private WSDLDefinitionRegistryImpl wsdlRegistry;
+ private ClassLoader cl;
+ private URL exampleWsdl;
+
+
+ public void testLoadFromAbsoluteWSDLLocation() {
+ try {
+ Definition def = wsdlRegistry.loadDefinition(NS + ' ' + exampleWsdl, cl);
+ Assert.assertNotNull(def.getPortType(new QName(NS, "HelloWorld")));
+ } catch (IOException e) {
+ Assert.fail(e.getMessage());
+ } catch (WSDLException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ public void testLoadFromRelativeWSDLLocation() {
+ try {
+ Definition def = wsdlRegistry.loadDefinition(NS + " org/apache/tuscany/idl/wsdl/example.wsdl", cl);
+ Assert.assertNotNull(def.getPortType(new QName(NS, "HelloWorld")));
+ } catch (IOException e) {
+ Assert.fail(e.getMessage());
+ } catch (WSDLException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ public void testGetDefinition() {
+ try {
+ wsdlRegistry.loadDefinition(NS + ' ' + exampleWsdl, cl);
+ Assert.assertNotNull(wsdlRegistry.getDefinition(NS));
+ } catch (IOException e) {
+ Assert.fail(e.getMessage());
+ } catch (WSDLException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wsdlRegistry = new WSDLDefinitionRegistryImpl();
+ wsdlRegistry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ wsdlRegistry.setMonitor(NULL_MONITOR);
+ exampleWsdl = getClass().getResource("example.wsdl");
+ cl = getClass().getClassLoader();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.java
new file mode 100644
index 0000000000..c05cf9770f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLLoaderImplTestCase.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.idl.wsdl;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLLoaderImplTestCase extends TestCase {
+ private WSDLLoaderImpl loader;
+ private URI exampleURI;
+ private QName exampleName;
+
+ public void testGetNamespace() throws UnresolveableResourceException {
+ assertEquals("http://example.org/TicketAgent.wsdl20", loader.getNamespace(exampleURI));
+ }
+
+ public void testGetInterfaceNameFromFragment() throws UnresolveableResourceException, InvalidFragmentException {
+ assertEquals("TicketAgent", loader.getInterfaceName("wsdl.interface(TicketAgent)"));
+ }
+
+ public void testGetInterfaceNameFromURI() throws UnresolveableResourceException, InvalidFragmentException {
+ assertEquals(exampleName, loader.getInterfaceName(exampleURI));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ loader = new WSDLLoaderImpl();
+ exampleURI = URI.create("http://example.org/TicketAgent.wsdl20#wsdl.interface(TicketAgent)");
+ exampleName = new QName("http://example.org/TicketAgent.wsdl20", "TicketAgent");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java
new file mode 100644
index 0000000000..b61db4c5d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WSDLOperationTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME =
+ new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDefinitionRegistryImpl registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDefinitionRegistryImpl();
+ registry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ }
+
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+
+ DataType<List<DataType<XMLType>>> inputType = op.getInputType();
+ Assert.assertEquals(1, inputType.getLogical().size());
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), inputType
+ .getLogical().get(0).getLogical().getElementName());
+
+ DataType<XMLType> outputType = op.getOutputType();
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"),
+ outputType.getLogical().getElementName());
+ Assert.assertTrue(op.isWrapperStyle());
+
+ DataType<List<DataType<XMLType>>> unwrappedInputType = op.getWrapper().getWrapperInfo().getUnwrappedInputType();
+ List<DataType<XMLType>> childTypes = unwrappedInputType.getLogical();
+ Assert.assertEquals(1, childTypes.size());
+ DataType<XMLType> childType = childTypes.get(0);
+ Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical().getElementName());
+
+ childType = op.getWrapper().getWrapperInfo().getUnwrappedOutputType();
+ Assert.assertEquals(new QName(null, "price"), childType.getLogical().getElementName());
+ }
+
+ public final void testUnwrappedOperation() throws Exception {
+ URL url = getClass().getResource("unwrapped-stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getInputType().getLogical().size());
+
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(2, op.getInputType().getLogical().size());
+ }
+
+ public final void testInvalidWSDL() throws Exception {
+ URL url = getClass().getResource("invalid-stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+
+ try {
+ op.isWrapperStyle();
+ fail("InvalidWSDLException should have been thrown");
+ } catch (InvalidWSDLException e) {
+ // Expected
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java
new file mode 100644
index 0000000000..748c790297
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.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.idl.wsdl;
+
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WrapperStyleOperationTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDefinitionRegistryImpl registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDefinitionRegistryImpl();
+ registry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ }
+
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertTrue(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
+ }
+
+ public final void testUnwrappedOperation() throws Exception {
+ URL url = getClass().getResource("unwrapped-stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java
new file mode 100644
index 0000000000..60433d3bc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImplTestCase.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.idl.wsdl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaException;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * Verifies the default XSD registry implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLSchemaRegistryImplTestCase extends TestCase {
+ private static final QName PO_ELEMENT_NAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private static final QName PO_TYPE_NAME = new QName("http://www.example.com/IPO", "PurchaseOrderType");
+
+ private static final String NS = "http://example.com/stockquote.xsd";
+ private static final QName GET_LAST_TRADE_PRICE_ELEMENT_NAME = new QName(NS, "getLastTradePrice");
+
+ private XMLSchemaRegistryImpl xsdRegistry;
+
+ private WSDLDefinitionRegistryImpl wsdlRegistry;
+
+ private ClassLoader cl;
+
+ private URL wsdl;
+
+ public void testLoadFromAbsoluteWSDLLocation() {
+ try {
+ Definition definition = wsdlRegistry.loadDefinition(null, wsdl);
+ List<XmlSchema> schemas = xsdRegistry.loadSchemas(definition);
+ Assert.assertTrue(schemas.size() == 1);
+ XmlSchema schema = schemas.get(0);
+ XmlSchemaElement element = schema.getElementByName(GET_LAST_TRADE_PRICE_ELEMENT_NAME);
+ Assert.assertNotNull(element);
+ XmlSchemaType type = element.getSchemaType();
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
+ XmlSchemaSequence sequence = (XmlSchemaSequence) complexType.getParticle();
+ XmlSchemaObjectCollection items = sequence.getItems();
+ Assert.assertTrue(items.getItem(0) instanceof XmlSchemaElement);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ public void testSchemaLocation() throws IOException {
+ String schemaLocation = "http://www.example.com/IPO org/apache/tuscany/idl/wsdl/ipo.xsd";
+ XmlSchema schema = xsdRegistry.loadSchema(schemaLocation, cl);
+ Assert.assertNotNull(schema);
+ Assert.assertNotNull(schema.getElementByName(PO_ELEMENT_NAME));
+ Assert.assertNotNull(xsdRegistry.getElement(PO_ELEMENT_NAME));
+ Assert.assertNotNull(schema.getTypeByName(PO_TYPE_NAME));
+ Assert.assertNotNull(xsdRegistry.getType(PO_TYPE_NAME));
+
+
+ schemaLocation = "http://www.example.com/IPO1 org/apache/tuscany/idl/wsdl/ipo.xsd";
+ try {
+ schema = xsdRegistry.loadSchema(schemaLocation, cl);
+ Assert.fail("");
+ } catch (XmlSchemaException e) {
+ Assert.assertTrue(e.getMessage().contains("http://www.example.com/IPO1 !="));
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xsdRegistry = new XMLSchemaRegistryImpl();
+ wsdlRegistry = new WSDLDefinitionRegistryImpl();
+ wsdlRegistry.setSchemaRegistry(xsdRegistry);
+ wsdl = getClass().getResource("stockquote.wsdl");
+ cl = getClass().getClassLoader();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessorTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessorTestCase.java
new file mode 100644
index 0000000000..93fc898cc6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/XSDContributionProcessorTestCase.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.idl.wsdl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.isNull;
+import static org.easymock.EasyMock.replay;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.spi.deployer.ArtifactResolverRegistry;
+import org.apache.tuscany.spi.deployer.ContributionProcessorRegistry;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.spi.model.DeployedArtifact;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XSDContributionProcessorTestCase extends TestCase {
+ private XSDContributionProcessor processor;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new XSDContributionProcessor();
+ ArtifactResolverRegistry registry = createMock(ArtifactResolverRegistry.class);
+ URL url = getClass().getResource("ipo.xsd");
+ expect(registry.resolve(isA(Contribution.class), isA(String.class), isA(String.class), (String)isNull())).andReturn(url)
+ .anyTimes();
+ processor.setArtifactResolverRegistry(registry);
+ replay(registry);
+
+ ContributionProcessorRegistry processorRegistry = createMock(ContributionProcessorRegistry.class);
+ processorRegistry.processModel(isA(Contribution.class), isA(URI.class), isA(Definition.class));
+ replay(processorRegistry);
+ processor.setContributionProcessorRegistry(processorRegistry);
+ }
+
+ public void testLoad() throws Exception {
+ URI uri = URI.create("sca://contribution/001");
+ Contribution contribution = new Contribution(uri);
+
+ URI a1 = URI.create("sca://contribution/001/test1.xsd");
+ addArtifact(contribution, a1);
+ URI a2 = URI.create("sca://contribution/001/ipo.xsd");
+ addArtifact(contribution, a2);
+
+ URL url = getClass().getResource("test1.xsd");
+ processor.processContent(contribution, new URI("sca://contribution/001/test1.xsd"), url.openStream());
+ DeployedArtifact da1 = contribution.getArtifact(a1);
+ Map<String, Object> schemas = da1.getModelObjects(XmlSchema.class);
+ assertEquals(1, schemas.size());
+ assertTrue(schemas.containsKey("http://www.example.com/Customer"));
+ XmlSchema schema = (XmlSchema) schemas.values().iterator().next();
+ XmlSchemaObjectCollection includes = schema.getIncludes();
+ assertEquals(1, includes.getCount());
+ XmlSchemaImport imported = (XmlSchemaImport) includes.getItem(0);
+ assertEquals("http://www.example.com/IPO", imported.getSchema().getTargetNamespace());
+ }
+
+ private DeployedArtifact addArtifact(Contribution contribution, URI artifact) {
+ DeployedArtifact a1 = new DeployedArtifact(artifact);
+ contribution.addArtifact(a1);
+ return a1;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl
new file mode 100644
index 0000000000..5e8e5dad0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/example.wsdl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://www.example.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ name="example">
+
+ <wsdl:portType name="HelloWorld">
+ </wsdl:portType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/invalid-stockquote.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/invalid-stockquote.wsdl
new file mode 100644
index 0000000000..38f9cb05d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/invalid-stockquote.wsdl
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice1">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd
new file mode 100644
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl
new file mode 100644
index 0000000000..7be1c896a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/stockquote.wsdl
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.wsdl
new file mode 100644
index 0000000000..786c602e24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.wsdl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
+
+ <wsdl:import location="test2.wsdl" namespace="http://helloworld"></wsdl:import>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.xsd b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.xsd
new file mode 100644
index 0000000000..fa4328939e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test1.xsd
@@ -0,0 +1,15 @@
+<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO" xmlns:tns="http://www.example.com/Customer">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <complexType name="Customer">
+ <sequence>
+ <element name="customerID" type="string"></element>
+ <element name="name" type="string"></element>
+ <element name="order" type="ipo:PurchaseOrderType" />
+ </sequence>
+ </complexType>
+ <element name="customer" type="tns:Customer"></element>
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test2.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test2.wsdl
new file mode 100644
index 0000000000..0cd6819841
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/test2.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest" />
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl
new file mode 100644
index 0000000000..2fade0036c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput1">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput1">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <message name="GetLastTradePriceInput2">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ <part name="other" type="xsd:string"/>
+ </message>
+
+ <message name="GetLastTradePriceOutput2">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice1">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice2">
+ <input message="tns:GetLastTradePriceInput2" />
+ <output message="tns:GetLastTradePriceOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/pom.xml
new file mode 100644
index 0000000000..6e57489604
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Services</name>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>idl</module>
+ <module>databinding</module>
+ <module>transports/http.jetty</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/.ruleset b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/.ruleset
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/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/services/transports/http.jetty/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/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/services/transports/http.jetty/pom.xml b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/pom.xml
new file mode 100644
index 0000000000..1caa4a7d0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <name>Apache Tuscany Jetty HTTP Service</name>
+ <description>Tuscany Jetty HTTP Service</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>${sca.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>6.1.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyLogger.java b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyLogger.java
new file mode 100644
index 0000000000..d42b301fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyLogger.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.service.jetty;
+
+import org.mortbay.log.Logger;
+
+/**
+ * Serves as a wrapper for a {@link TransportMonitor} to replace Jetty's logging mechanism
+ *
+ * @version $Rev$ $Date$
+ */
+public class JettyLogger implements Logger {
+
+ private TransportMonitor monitor;
+ private boolean debugEnabled;
+
+ public void setMonitor(TransportMonitor monitor) {
+ this.monitor = monitor;
+ }
+
+ public boolean isDebugEnabled() {
+ return debugEnabled;
+ }
+
+ public void setDebugEnabled(boolean debugEnabled) {
+ this.debugEnabled = debugEnabled;
+ }
+
+ public void info(String msg, Object arg0, Object arg1) {
+ if (monitor != null) {
+ monitor.debug(msg, arg0, arg1);
+ } else if (debugEnabled) {
+ System.err.println(":INFO: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void debug(String msg, Throwable th) {
+ if (debugEnabled) {
+ if (monitor != null) {
+ monitor.debug(msg, th);
+ } else {
+ System.err.println(":DEBUG: " + msg);
+ th.printStackTrace();
+ }
+ }
+ }
+
+ public void debug(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ if (monitor != null) {
+ monitor.debug(msg, arg0, arg1);
+ } else {
+ System.err.println(":DEBUG: " + format(msg, arg0, arg1));
+ }
+ }
+ }
+
+ public void warn(String msg, Object arg0, Object arg1) {
+ if (monitor != null) {
+ monitor.warn(msg, arg0, arg1);
+ } else if (debugEnabled) {
+ System.err.println(":WARN: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void warn(String msg, Throwable th) {
+ if (monitor != null) {
+ monitor.warn(msg, th);
+ } else if (debugEnabled) {
+ System.err.println(":WARN: " + msg);
+ th.printStackTrace();
+ }
+ }
+
+ public Logger getLogger(String name) {
+ return this;
+ }
+
+ private String format(String msg, Object arg0, Object arg1) {
+ int i0 = msg.indexOf("{}");
+ int i1 = i0 < 0 ? -1 : msg.indexOf("{}", i0 + 2);
+ if (arg1 != null && i1 >= 0) {
+ msg = msg.substring(0, i1) + arg1 + msg.substring(i1 + 2);
+ }
+ if (arg0 != null && i0 >= 0) {
+ msg = msg.substring(0, i0) + arg0 + msg.substring(i0 + 2);
+ }
+ return msg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyService.java b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyService.java
new file mode 100644
index 0000000000..6fd68813df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyService.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.service.jetty;
+
+import org.apache.tuscany.spi.host.ServletHost;
+
+import org.mortbay.jetty.Server;
+
+/**
+ * Implementations provide a Jetty transport service to the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface JettyService extends ServletHost {
+
+ /**
+ * Returns the active Jetty server
+ */
+ Server getServer();
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
new file mode 100644
index 0000000000..e71e8333d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/JettyServiceImpl.java
@@ -0,0 +1,356 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.jetty;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.resource.spi.work.Work;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.api.annotation.Monitor;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.SCAObjectStartException;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.security.SslSocketConnector;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.servlet.ServletMapping;
+import org.mortbay.jetty.servlet.SessionHandler;
+import org.mortbay.log.Log;
+import org.mortbay.log.Logger;
+import org.mortbay.thread.BoundedThreadPool;
+import org.mortbay.thread.ThreadPool;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implements an HTTP transport service using Jetty.
+ *
+ * @version $$Rev$$ $$Date: 2007-02-21 13:28:30 +0000 (Wed, 21 Feb
+ * 2007) $$
+ */
+@Scope("COMPOSITE")
+@Service(ServletHost.class)
+@EagerInit
+public class JettyServiceImpl implements JettyService {
+
+ private static final String ROOT = "/";
+ private static final int ERROR = 0;
+ private static final int UNINITIALIZED = 0;
+ private static final int STARTING = 1;
+ private static final int STARTED = 2;
+ private static final int STOPPING = 3;
+ private static final int STOPPED = 4;
+
+ private final Object joinLock = new Object();
+ private int state = UNINITIALIZED;
+ private int httpPort = 8080;
+ private int httpsPort = 8484;
+ private String keystore;
+ private String certPassword;
+ private String keyPassword;
+ private boolean sendServerVersion;
+ private boolean https;
+ private TransportMonitor monitor;
+ private WorkScheduler scheduler;
+ private boolean debug;
+ private Server server;
+ private Connector connector;
+ private ServletHandler servletHandler;
+
+ static {
+ // hack to replace the static Jetty logger
+ System.setProperty("org.mortbay.log.class", JettyLogger.class.getName());
+
+ }
+
+ public JettyServiceImpl(@Monitor
+ TransportMonitor monitor, @Autowire
+ WorkScheduler scheduler) {
+ this.monitor = monitor;
+ this.scheduler = scheduler;
+ // Jetty uses a static logger, so jam in the monitor into a static
+ // reference
+ Logger logger = Log.getLogger(null);
+ if (logger instanceof JettyLogger) {
+ JettyLogger jettyLogger = (JettyLogger)logger;
+ jettyLogger.setMonitor(this.monitor);
+ if (debug) {
+ jettyLogger.setDebugEnabled(true);
+ }
+ }
+
+ httpPort = Integer.getInteger("Tuscany.JettyService.httpPort", httpPort);
+
+ }
+
+ @Property
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
+ }
+
+ @Property
+ public void setHttpsPort(int httpsPort) {
+ this.httpsPort = httpsPort;
+ }
+
+ @Property
+ public void setSendServerVersion(boolean sendServerVersion) {
+ this.sendServerVersion = sendServerVersion;
+ }
+
+ @Property
+ public void setHttps(boolean https) {
+ this.https = https;
+ }
+
+ @Property
+ public void setKeystore(String keystore) {
+ this.keystore = keystore;
+ }
+
+ @Property
+ public void setCertPassword(String certPassword) {
+ this.certPassword = certPassword;
+ }
+
+ @Property
+ public void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
+ }
+
+ @Property
+ public void setDebug(boolean val) {
+ debug = val;
+ }
+
+ @Init
+ public void init() throws Exception {
+ state = STARTING;
+ }
+
+ @Destroy
+ public void destroy() throws Exception {
+ if (state == STARTED) {
+ state = STOPPING;
+ synchronized (joinLock) {
+ joinLock.notifyAll();
+ }
+ server.stop();
+ state = STOPPED;
+ // monitor.shutdown();
+ }
+ }
+
+ public void registerMapping(String path, Servlet servlet) {
+ if (state == STARTING) {
+
+ try {
+ server = new Server();
+ if (scheduler == null) {
+ BoundedThreadPool threadPool = new BoundedThreadPool();
+ threadPool.setMaxThreads(100);
+ server.setThreadPool(threadPool);
+ } else {
+ server.setThreadPool(new TuscanyThreadPool());
+ }
+ if (connector == null) {
+ if (https) {
+ Connector httpConnector = new SelectChannelConnector();
+ httpConnector.setPort(httpPort);
+ SslSocketConnector sslConnector = new SslSocketConnector();
+ sslConnector.setPort(httpsPort);
+ sslConnector.setKeystore(keystore);
+ sslConnector.setPassword(certPassword);
+ sslConnector.setKeyPassword(keyPassword);
+ server.setConnectors(new Connector[] {httpConnector, sslConnector});
+ } else {
+ SelectChannelConnector selectConnector = new SelectChannelConnector();
+ selectConnector.setPort(httpPort);
+ server.setConnectors(new Connector[] {selectConnector});
+ }
+ } else {
+ connector.setPort(httpPort);
+ server.setConnectors(new Connector[] {connector});
+ }
+
+ ContextHandler contextHandler = new ContextHandler();
+ contextHandler.setContextPath(ROOT);
+ server.setHandler(contextHandler);
+
+ SessionHandler sessionHandler = new SessionHandler();
+ servletHandler = new ServletHandler();
+ sessionHandler.addHandler(servletHandler);
+
+ contextHandler.setHandler(sessionHandler);
+
+ server.setStopAtShutdown(true);
+ server.setSendServerVersion(sendServerVersion);
+ // monitor.started();
+ server.start();
+ state = STARTED;
+ } catch (Exception e) {
+ state = ERROR;
+ throw new SCAObjectStartException(e);
+ }
+ }
+
+ ServletHolder holder = new ServletHolder(servlet);
+ servletHandler.addServlet(holder);
+ ServletMapping mapping = new ServletMapping();
+ mapping.setServletName(holder.getName());
+ mapping.setPathSpec(path);
+ servletHandler.addServletMapping(mapping);
+ }
+
+ public Servlet unregisterMapping(String path) {
+ Servlet removedServlet = null;
+ List<ServletMapping> mappings = new ArrayList(Arrays.asList(servletHandler.getServletMappings()));
+ for (ServletMapping mapping : mappings) {
+ if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
+ try {
+ removedServlet = servletHandler.getServlet(mapping.getServletName()).getServlet();
+ } catch (ServletException e) {
+ throw new IllegalStateException(e);
+ }
+ mappings.remove(mapping);
+ break;
+ }
+ }
+ if (removedServlet != null) {
+ servletHandler.setServletMappings((ServletMapping[])mappings.toArray(new ServletMapping[mappings.size()]));
+ }
+ return removedServlet;
+ }
+
+ public boolean isMappingRegistered(String path) {
+ ServletMapping[] mappings = servletHandler.getServletMappings();
+ for (ServletMapping mapping : mappings) {
+ if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void registerComposite(File compositeLocation) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Server getServer() {
+ return server;
+ }
+
+ public int getHttpPort() {
+ return httpPort;
+ }
+
+ /**
+ * An integration wrapper to enable use of a {@link WorkScheduler} with
+ * Jetty
+ */
+ private class TuscanyThreadPool implements ThreadPool {
+
+ public boolean dispatch(Runnable job) {
+ scheduler.scheduleWork(new TuscanyWork(job));
+ return true;
+ }
+
+ public void join() throws InterruptedException {
+ synchronized (joinLock) {
+ joinLock.wait();
+ }
+ }
+
+ public int getThreads() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getIdleThreads() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isLowOnThreads() {
+ // TODO FIXME
+ return false;
+ }
+
+ public void start() throws Exception {
+
+ }
+
+ public void stop() throws Exception {
+
+ }
+
+ public boolean isRunning() {
+ return state == STARTING || state == STARTED;
+ }
+
+ public boolean isStarted() {
+ return state == STARTED;
+ }
+
+ public boolean isStarting() {
+ return state == STARTING;
+ }
+
+ public boolean isStopping() {
+ return state == STOPPING;
+ }
+
+ public boolean isFailed() {
+ return state == ERROR;
+ }
+ }
+
+ /**
+ * A unit of work dispatched to the runtime work scheduler
+ */
+ private class TuscanyWork implements Work {
+
+ Runnable job;
+
+ public TuscanyWork(Runnable job) {
+ this.job = job;
+ }
+
+ public void release() {
+ }
+
+ public void run() {
+ job.run();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.java
new file mode 100644
index 0000000000..c68eacd21c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/java/org/apache/tuscany/service/jetty/TransportMonitor.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.service.jetty;
+
+/**
+ * The monitoring interfaces used by the Jetty system service
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface TransportMonitor {
+
+ /**
+ * Called after the service is initialized
+ */
+ void started();
+
+ /**
+ * Called after the service is stopped
+ */
+ void shutdown();
+
+ void warn(String msg, Object...args);
+
+ void debug(String msg, Object...args);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/http.jetty.scdl b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/http.jetty.scdl
new file mode 100644
index 0000000000..27673adde2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/http.jetty.scdl
@@ -0,0 +1,35 @@
+<!--
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.transport.http.jetty.include">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.tuscany.sca.services</group>
+ <name>http-jetty</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <service name="ServletHost">
+ <interface.java class="org.apache.tuscany.spi.host.ServletHost" />
+ <reference>http.JettyService</reference>
+ </service>
+
+ <component name="http.JettyService" initLevel="20">
+ <system:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/service.composite b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/service.composite
new file mode 100644
index 0000000000..762d47dc5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/main/resources/META-INF/sca/service.composite
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing pejmsssions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="org.apache.tuscany.transport.http.jetty">
+ <include name="org.apache.tuscany.transport.http.jetty.include" scdlLocation="http.jetty.scdl" />
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/test/java/org/apache/tuscany/service/jetty/JettyServiceImplTestCase.java b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/test/java/org/apache/tuscany/service/jetty/JettyServiceImplTestCase.java
new file mode 100644
index 0000000000..503d5a588e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/sca/services/transports/http.jetty/src/test/java/org/apache/tuscany/service/jetty/JettyServiceImplTestCase.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.service.jetty;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.Socket;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+
+import junit.framework.TestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyServiceImplTestCase extends TestCase {
+
+ private static final String REQUEST1_HEADER =
+ "GET / HTTP/1.0\n"
+ + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST1_CONTENT =
+ "";
+ private static final String REQUEST1 =
+ REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
+
+ private static final int HTTP_PORT = 8585;
+
+ private TransportMonitor monitor;
+ private WorkScheduler scheduler;
+ private ExecutorService executor = Executors.newCachedThreadPool();
+
+ /**
+ * Verifies requests are properly routed according to the servlet mapping
+ */
+ public void testRegisterServletMapping() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, null);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.registerMapping("/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ }
+
+ public void testIsMappingRegistered() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, null);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.registerMapping("/foo", servlet);
+ assertTrue(service.isMappingRegistered("/foo"));
+ assertFalse(service.isMappingRegistered("/bar"));
+ service.destroy();
+ }
+
+ public void testUnregisterMapping() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, null);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.registerMapping("/foo", servlet);
+ assertTrue(service.isMappingRegistered("/foo"));
+ service.unregisterMapping("/foo");
+ assertFalse(service.isMappingRegistered("/foo"));
+ service.destroy();
+ }
+
+ public void testRequestSession() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, scheduler);
+ service.setDebug(true);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.registerMapping("/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ assertNotNull(servlet.sessionId);
+ }
+
+ public void testUseWorkScheduler() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, scheduler);
+ service.setDebug(true);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.registerMapping("/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ }
+
+ public void testRestart() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, null);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ service.destroy();
+ service.init();
+ service.destroy();
+ }
+
+ public void testNoMappings() throws Exception {
+ JettyServiceImpl service = new JettyServiceImpl(monitor, null);
+ service.setHttpPort(HTTP_PORT);
+ service.init();
+ Exception ex = null;
+ try {
+ new Socket("127.0.0.1", HTTP_PORT);
+ } catch (ConnectException e) {
+ ex = e;
+ }
+ assertNotNull(ex);
+ service.destroy();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ //executor.submit();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ monitor = createMock(TransportMonitor.class);
+ scheduler = createMock(WorkScheduler.class);
+ scheduler.scheduleWork(isA(Runnable.class));
+
+ expectLastCall().andStubAnswer(new IAnswer() {
+ public Object answer() throws Throwable {
+ Runnable runnable = (Runnable) getCurrentArguments()[0];
+ executor.execute(runnable);
+ return null;
+ }
+ });
+ replay(scheduler);
+ }
+
+ private static String read(Socket socket) throws IOException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ StringBuffer sb = new StringBuffer();
+ String str;
+ while ((str = reader.readLine()) != null) {
+ sb.append(str);
+ }
+ return sb.toString();
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+ private class TestServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ boolean invoked;
+ String sessionId;
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ invoked = true;
+ sessionId = req.getSession().getId();
+ OutputStream writer = resp.getOutputStream();
+ try {
+ writer.write("result".getBytes());
+ } finally {
+ writer.close();
+ }
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/spec/commonj/LICENSE.txt
new file mode 100644
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ 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/spec/commonj/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/spec/commonj/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/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/spec/commonj/pom.xml b/sca-java-1.x/branches/sca-java-integration/spec/commonj/pom.xml
new file mode 100644
index 0000000000..150400e286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api_r${specVersion}</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>osgi-bundle</packaging>
+ <name>Commonj API for Timer and Work Manager</name>
+ <description>Commonj API for Timer and Work Manager</description>
+
+ <properties>
+ <specVersion>1.1</specVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix.plugins</groupId>
+ <artifactId>maven-osgi-plugin</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <osgiManifest>
+ <bundleName>${pom.name}</bundleName>
+ <bundleDescription>${pom.description}</bundleDescription>
+ <bundleVendor>${pom.organization.name}</bundleVendor>
+ <bundleLocalization>plugin</bundleLocalization>
+ <bundleSymbolicName>commonj.twm</bundleSymbolicName>
+ <exportPackage>commonj.timers;version="${specVersion}", commonj.work;version="${specVersion}</exportPackage>
+ </osgiManifest>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/CancelTimerListener.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/CancelTimerListener.java
new file mode 100644
index 0000000000..ba252e70dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/CancelTimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface CancelTimerListener extends TimerListener {
+
+ void timerCancel(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/StopTimerListener.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/StopTimerListener.java
new file mode 100644
index 0000000000..92defc4bdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/StopTimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface StopTimerListener extends TimerListener {
+
+ void timerStop(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/Timer.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/Timer.java
new file mode 100644
index 0000000000..0a5c3b65fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/Timer.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Timer {
+
+ boolean cancel();
+ long getPeriod();
+ long getScheduledExecutionTime() throws IllegalStateException;
+ TimerListener getTimerListener();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerListener.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerListener.java
new file mode 100644
index 0000000000..6e3733b5f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TimerListener {
+
+ void timerExpired(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerManager.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerManager.java
new file mode 100644
index 0000000000..c07b6478d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/timers/TimerManager.java
@@ -0,0 +1,79 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TimerManager {
+
+ static final long IMMEDIATE = 0;
+ static final long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ boolean isStopped();
+
+ boolean isStopping();
+
+ boolean isSuspended() throws IllegalStateException;
+
+ boolean isSuspending() throws IllegalStateException;
+
+ void resume() throws IllegalStateException;
+
+ Timer schedule(TimerListener listener, long delayInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, long delayInMillis, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, Date scheduleDate)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, Date scheduleDate, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer scheduleAtFixedRate(TimerListener listener, long delayInMillis, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer scheduleAtFixedRate(TimerListener listener, Date scheduleDate, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ void stop() throws IllegalStateException;
+
+ void suspend() throws IllegalStateException;
+
+ boolean waitForStop(long timeOut)
+ throws InterruptedException, IllegalArgumentException;
+
+ boolean waitForSuspend(long timOut)
+ throws InterruptedException, IllegalStateException, IllegalArgumentException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/RemoteWorkItem.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/RemoteWorkItem.java
new file mode 100644
index 0000000000..aebf40a324
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/RemoteWorkItem.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+import java.util.Collection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface RemoteWorkItem extends WorkItem {
+
+ WorkManager getPinnedWorkManager();
+ void release();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/Work.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/Work.java
new file mode 100644
index 0000000000..1071fe4a2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/Work.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Work extends Runnable {
+
+ boolean isDaemon();
+ void release();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkCompletedException.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkCompletedException.java
new file mode 100644
index 0000000000..0edd14c8a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkCompletedException.java
@@ -0,0 +1,72 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkCompletedException extends WorkException {
+
+ private final List exceptionList;
+
+ public WorkCompletedException() {
+ super();
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ public WorkCompletedException(String message) {
+ super(message);
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ public WorkCompletedException(String message, Throwable cause) {
+ super(message, cause);
+ exceptionList = Collections.singletonList(cause);
+ }
+ public WorkCompletedException(Throwable cause) {
+ super(cause);
+ exceptionList = Collections.singletonList(cause);
+ }
+ public WorkCompletedException(String message, List list) {
+ super(message);
+ if ((list != null) && (list.size() > 0)) {
+ initCause((Throwable) list.get(0));
+ exceptionList = Collections.unmodifiableList(new ArrayList(list));
+ } else {
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ }
+
+ public List getExceptionList() {
+ return exceptionList;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkEvent.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkEvent.java
new file mode 100644
index 0000000000..9a7814b860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkEvent.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkEvent {
+
+ static final int WORK_ACCEPTED = 1;
+ static final int WORK_REJECTED = 2;
+ static final int WORK_STARTED = 3;
+ static final int WORK_COMPLETED = 4;
+
+ WorkException getException();
+ int getType();
+ WorkItem getWorkItem();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkException.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkException.java
new file mode 100644
index 0000000000..f490f2e99e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkException.java
@@ -0,0 +1,49 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkException extends Exception {
+
+ public WorkException() {
+ super();
+ }
+ public WorkException(String message) {
+ super(message);
+ }
+ public WorkException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public WorkException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkItem.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkItem.java
new file mode 100644
index 0000000000..6b8d3185a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkItem.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkItem extends Comparable {
+
+ Work getResult() throws WorkException;
+ int getStatus();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkListener.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkListener.java
new file mode 100644
index 0000000000..9b523f7321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkListener.java
@@ -0,0 +1,44 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkListener {
+
+ static long IMMEDIATE = 0;
+ static long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ void workAccepted(WorkEvent event);
+ void workCompleted(WorkEvent event);
+ void workRejected(WorkEvent event);
+ void workStarted(WorkEvent event);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkManager.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkManager.java
new file mode 100644
index 0000000000..2c4167d24c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkManager.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+import java.util.Collection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkManager {
+
+ static final long IMMEDIATE = 0;
+ static final long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ WorkItem schedule(Work work) throws WorkException, IllegalArgumentException;
+
+ WorkItem schedule(Work work, WorkListener listener) throws WorkException, IllegalArgumentException;
+
+ boolean waitForAll(Collection workItems, long timeout)
+ throws InterruptedException, IllegalArgumentException;
+
+ Collection waitForAny(Collection workItems, long timeout)
+ throws InterruptedException, IllegalArgumentException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkRejectedException.java b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkRejectedException.java
new file mode 100644
index 0000000000..23dcd2294c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/commonj/src/main/java/commonj/work/WorkRejectedException.java
@@ -0,0 +1,50 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkRejectedException extends WorkException {
+
+
+ public WorkRejectedException() {
+ super();
+ }
+ public WorkRejectedException(String message) {
+ super(message);
+ }
+ public WorkRejectedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public WorkRejectedException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/pom.xml b/sca-java-1.x/branches/sca-java-integration/spec/pom.xml
new file mode 100644
index 0000000000..33b5ff2393
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.osoa</groupId>
+ <artifactId>spec</artifactId>
+ <packaging>pom</packaging>
+ <name>OSOA Specification API jars</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+
+ <distributionManagement>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ <snapshotRepository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+
+ <modules>
+ <module>commonj</module>
+ <module>sca-api-r1.0</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/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/spec/sca-api-r0.95/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/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/spec/sca-api-r0.95/README.txt b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/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/spec/sca-api-r0.95/pom.xml b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/pom.xml
new file mode 100644
index 0000000000..df86524cf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${specVersion}</artifactId>
+ <name>SCA API Version 0.95</name>
+ <description>API classes for the Service Component Architecture</description>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>osgi-bundle</packaging>
+
+ <properties>
+ <specVersion>0.95</specVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix.plugins</groupId>
+ <artifactId>maven-osgi-plugin</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <osgiManifest>
+ <bundleName>${pom.name}</bundleName>
+ <bundleDescription>${pom.description}</bundleDescription>
+ <bundleVendor>${pom.organization.name}</bundleVendor>
+ <bundleLocalization>plugin</bundleLocalization>
+ <bundleSymbolicName>org.osoa.sca</bundleSymbolicName>
+ <exportPackage>org.osoa.sca;version="${specVersion}", org.osoa.sca.annotations;version="${specVersion}"</exportPackage>
+ </osgiManifest>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CompositeContext.java
new file mode 100644
index 0000000000..1dbf82e9f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CompositeContext.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.osoa.sca;
+
+
+/**
+ * Interface used by SCA Components to access their context
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeContext {
+
+ /**
+ * Returns the name of the parent composite.
+ *
+ * @return the name of the module
+ */
+ String getName();
+
+ /**
+ * Returns the absolute URI of the composite component.
+ *
+ * @return the absolute URI of the module component
+ */
+ String getURI();
+
+ /**
+ * Returns the request context that corresponds to the last remotable service invocation. If this is
+ * invoked from outside an SCA component then <tt>null</tt> is returned.
+ *
+ * @return the current request context
+ */
+ RequestContext getRequestContext();
+
+ /**
+ * Returns an object implementing the interface defined for the named service.
+ *
+ * @param serviceName the name of another service in the current module
+ * @return an object that implements the service's interface
+ */
+ <T> T locateService(Class<T> serviceType, String serviceName);
+
+ /**
+ * Create a reference to the supplied component. The component must define only one service.
+ *
+ * @param self the component to be referenced
+ * @return a reference to the component
+ */
+ ServiceReference createServiceReferenceForSession(Object self);
+
+ /**
+ * Create a reference to the named service implemented by the supplied component.
+ *
+ * @param self the component to be referenced
+ * @param serviceName the service to be referenced
+ * @return a reference to the service
+ */
+ ServiceReference createServiceReferenceForSession(Object self, String serviceName);
+
+ /**
+ * Create a new session for stateful interaction with the named service.
+ *
+ * @param serviceName the name of the service to interact with
+ * @return a reference to the service
+ */
+ ServiceReference newSession(String serviceName);
+
+ /**
+ * Create a new session for stateful interaction with the named service using an application-supplied
+ * session identifier.
+ *
+ * @param serviceName the name of the service to interact with
+ * @param sessionId a token that identifies this session
+ * @return a reference to the service
+ */
+ ServiceReference newSession(String serviceName, Object sessionId);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ConversationEndedException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ConversationEndedException.java
new file mode 100644
index 0000000000..6af61c580e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ConversationEndedException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate the conversation being used for a stateful interaction has been ended.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationEndedException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CurrentCompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CurrentCompositeContext.java
new file mode 100644
index 0000000000..a8bd851119
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/CurrentCompositeContext.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.osoa.sca;
+
+/**
+ * Class providing access to the current CompositeComponent.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class CurrentCompositeContext {
+ private static final ThreadLocal<CompositeContext> CURRENT_COMPONENT =
+ new InheritableThreadLocal<CompositeContext>();
+
+ /**
+ * Returns the current composite context associated with this thread.
+ *
+ * @return the current composite context
+ */
+ public static CompositeContext getContext() {
+ return CURRENT_COMPONENT.get();
+ }
+
+ /**
+ * Sets the composite context that is associated with this thread.
+ *
+ * @param context the context to associated with this thread; may be null
+ * @return the context previously associated with this thread; may be null
+ */
+ public static CompositeContext setContext(CompositeContext context) {
+ CompositeContext current = CURRENT_COMPONENT.get();
+ CURRENT_COMPONENT.set(context);
+ return current;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
new file mode 100644
index 0000000000..afccfd400d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/NoRegisteredCallbackException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate that no callback has been registered
+ * when interacting with a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoRegisteredCallbackException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/RequestContext.java
new file mode 100644
index 0000000000..9d1b09f757
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/RequestContext.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.osoa.sca;
+
+import javax.security.auth.Subject;
+
+/**
+ * Interface that provides information on the current request.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RequestContext {
+ /**
+ * Returns the JAAS Subject of the current request.
+ *
+ * @return the Subject of the current request
+ */
+ Subject getSecuritySubject();
+
+ /**
+ * Returns the name of the service that was invoked.
+ *
+ * @return the name of the service that was invoked
+ */
+ String getServiceName();
+
+ /**
+ * Returns a reference to the service that was invoked.
+ *
+ * @return a reference to the service that was invoked
+ */
+ ServiceReference getServiceReference();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceReference.java
new file mode 100644
index 0000000000..5290c1d2fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceReference.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.osoa.sca;
+
+
+/**
+ * Interface that provides access to other services.
+ * Any ServiceReference can be cast to the business interface of the service to
+ * which it refers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceReference {
+ /**
+ * Returns the session ID.
+ *
+ * @return the session ID
+ */
+ Object getSessionID();
+
+ /**
+ * End the client's session with the referenced service.
+ */
+ void endSession();
+
+ /**
+ * Returns the callback ID.
+ *
+ * @return the callback ID
+ */
+ Object getCallbackID();
+
+ /**
+ * Sets the callback ID.
+ *
+ * @param callbackID the callback ID
+ */
+ void setCallbackID(Object callbackID);
+
+ /**
+ * Returns the callback object.
+ *
+ * @return the callback object
+ */
+ Object getCallback();
+
+ /**
+ * Sets the callback object.
+ *
+ * @param callback the callback object
+ */
+ void setCallback(Object callback);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceRuntimeException.java
new file mode 100644
index 0000000000..460e0b720e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceRuntimeException.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.osoa.sca;
+
+
+/**
+ * Base for Exceptions that may be raised by an SCA runtime and which typical
+ * application code is not expected to be able to handle.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = -3876058842262557092L;
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException() {
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceUnavailableException.java
new file mode 100644
index 0000000000..edb0593ab2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/ServiceUnavailableException.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.osoa.sca;
+
+/**
+ * Exception used to indicate that a runtime exception occurred during the invocation of and external service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceUnavailableException extends ServiceRuntimeException {
+
+ private static final long serialVersionUID = -5869397223249401047L;
+
+ /**
+ * Constructs a new ServiceUnavailableException.
+ */
+ public ServiceUnavailableException() {
+ super((Throwable) null);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message.
+ *
+ * @param message The detail message (which is saved to later retrieval by the getMessage() method).
+ */
+ public ServiceUnavailableException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified cause.
+ *
+ * @param cause The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message and cause.
+ * @param message
+ * The message (which is saved to later retrieval by the getMessage() method).
+ * @param cause
+ * The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/Version.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/Version.java
new file mode 100644
index 0000000000..0ed8f1a492
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/Version.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.osoa.sca;
+
+/**
+ * Class providing information on the version of the specification
+ * supported by these API classes.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class Version {
+ /**
+ * Identifier for version 1.0
+ */
+ public static final String VERSION_1_0 = "1.0";
+
+ /**
+ * Identifier for the XML Namespace for version 1.0
+ */
+ public static final String SCA_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ /**
+ * The specification version of these API classes.
+ */
+ public static final String API_VERSION = VERSION_1_0;
+
+ private Version() {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
new file mode 100644
index 0000000000..dcf16126da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a method that indicates that its parameters may safely
+ * be passed by reference. The annotation may also be placed on an interface
+ * or class to indicate that all declared methods support this optimization.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface AllowsPassByReference {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Callback.java
new file mode 100644
index 0000000000..dbfdce7e7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Callback.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * When placed on a service interface, this annotation specifies the interface
+ * to be used for callbacks.
+ * <p/>
+ * When placed on a method or field, this annotation denotes the injection
+ * site to be used for a callback reference.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Callback {
+ /**
+ * The Class of the callback interface.
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ComponentName.java
new file mode 100644
index 0000000000..0ad13831c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ComponentName.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or method that is used to inject the component's name.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ComponentName {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Constructor.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Constructor.java
new file mode 100644
index 0000000000..8480b38926
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Constructor.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Used to indicate the constructor the runtime is to use when instantiating a component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(CONSTRUCTOR)
+@Retention(RUNTIME)
+public @interface Constructor {
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Context.java
new file mode 100644
index 0000000000..93f6710578
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Context.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or method that is used to inject the component's CompositeContext.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Context {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Conversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Conversation.java
new file mode 100644
index 0000000000..fe57e7a9c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Conversation.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the characteristics of a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Conversation {
+ /**
+ * The maximum time that can pass between operations in a single conversation.
+ * If this time is exceeded the container may end the conversation.
+ */
+ public String maxIdleTime() default "";
+
+ /**
+ * The maximum time that a conversation may remain active.
+ * If this time is exceeded the container may end the conversation.
+ */
+ public String maxAge() default "";
+
+ /**
+ * If true, indicates that only the user that initiated the conversation
+ * has the authority to continue it.
+ */
+ public boolean singlePrincipal() default false;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ConversationID.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ConversationID.java
new file mode 100644
index 0000000000..e521b91797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/ConversationID.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or method that is used to inject the conversation ID.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ConversationID {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Destroy.java
new file mode 100644
index 0000000000..0a81dbe14c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Destroy.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.osoa.sca.annotations;
+
+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 used to indicate a method that will be called by the container when the
+ * scope defined for the local service ends.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Destroy {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EagerInit.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EagerInit.java
new file mode 100644
index 0000000000..7fb9885fb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EagerInit.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate an instance should be eagerly initialized.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EagerInit {
+
+ /**
+ * A Tuscany-specific extension for specifying the component's initialization order, with lesser values given
+ * precedence. A value of 0 indicates the component should not be initialized eagerly.
+ *
+ * @return the component initalization level
+ */
+ public int value() default 50;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EndConversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EndConversation.java
new file mode 100644
index 0000000000..14f7ef865f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/EndConversation.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.osoa.sca.annotations;
+
+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 method ends a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EndConversation {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Init.java
new file mode 100644
index 0000000000..957bec262c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Init.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.osoa.sca.annotations;
+
+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 used to indicate a method that will be called by the container when the scope defined for the local
+ * service begins.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Init {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/OneWay.java
new file mode 100644
index 0000000000..fbc7398da4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/OneWay.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a method that indicates that the method is non-blocking and communication
+ * with the service provider may use buffer the requests and send them at some later time.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface OneWay {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Property.java
new file mode 100644
index 0000000000..acbc35a1ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Property.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.osoa.sca.annotations;
+
+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.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is
+ * used to inject a configuration property value.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target( {METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Property {
+ /**
+ * The name of the property. If not specified then the name will be derived
+ * from the annotated field.
+ */
+ public String name() default "";
+
+ /**
+ * Indicates if a value must be specified.
+ */
+ public String override() default "may";
+
+ /**
+ * The XML Type in a QName format
+ */
+ public String xmlType() default "";
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Reference.java
new file mode 100644
index 0000000000..7fceafadf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Reference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is used to inject a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Reference {
+ /**
+ * The name of the reference. If not specified then the name will be derived from the annotated field.
+ */
+ public String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ */
+ public boolean required() default false;
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Remotable.java
new file mode 100644
index 0000000000..f447a4126d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Remotable.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a Java interface as remotable.
+ * Remotable interfaces use pass-by-value semantics, can be published as entry points
+ * and used for external services.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Remotable {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Resource.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Resource.java
new file mode 100644
index 0000000000..b3e3855719
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/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.osoa.sca.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * 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.
+ */
+ public String name() default "";
+
+ /**
+ * Denotes if the resource is optional
+ */
+ public boolean optional() default false;
+
+ /**
+ * Denotes the default name of the resource provided by the runtime environment.
+ */
+ public String mappedName() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Scope.java
new file mode 100644
index 0000000000..6f952d489c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Scope.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a scoped service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Scope {
+ /**
+ * The name of the scope. Values currently defined by the specification are:
+ * <ul>
+ * <li>stateless (default)</li>
+ * <li>request</li>
+ * <li>session</li>
+ * <li>module</li>
+ * <li>conversation</li>
+ * </ul>
+ */
+ String value() default "STATELESS";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Service.java
new file mode 100644
index 0000000000..33e7a93ea3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/java/org/osoa/sca/annotations/Service.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the service interfaces exposed by a Java class.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Service {
+ /**
+ * Array of interfaces that should be exposed as services.
+ */
+ Class<?>[] interfaces() default {};
+
+ /**
+ * Shortcut allowing a single interface to be exposed.
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-sca.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-sca.xsd
new file mode 100644
index 0000000000..a501639e78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-sca.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.sca" type="sca:SCABinding" substitutionGroup="sca:binding"/>
+ <complexType name="SCABinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-webservice.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..0ddaf95697
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-binding-webservice.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="port" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-core.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-core.xsd
new file mode 100644
index 0000000000..fad0304c0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-core.xsd
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="required" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:Module"/>
+ <complexType name="Module">
+ <complexContent>
+ <extension base="sca:ModuleFragment"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..n sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 1..n or 0..n sample
+ <reference>StockQuoteComponent1</reference> - type must be URI
+ <reference>StockQuoteComponent2</reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding">
+ <attribute name="uri" type="anyURI" use="optional"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 1..n or 0..n sample
+ <references>
+ <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI
+ <v:stockQuote>StockQuoteComponent2</v:stockQuote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="target" type="anyType"/>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target"/>
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target"/>
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="1..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="OverrideOptions">
+ <restriction base="string">
+ <enumeration value="no"/>
+ <enumeration value="may"/>
+ <enumeration value="must"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-implementation-java.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-implementation-java.xsd
new file mode 100644
index 0000000000..1395086cc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-implementation-java.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.java" type="sca:JavaImplementation" substitutionGroup="sca:implementation"/>
+ <complexType name="JavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-java.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-java.xsd
new file mode 100644
index 0000000000..113176a545
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-java.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface"/>
+ <complexType name="JavaInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="NCName" use="required"/>
+ <attribute name="callbackInterface" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-wsdl.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..5114c8db06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca-interface-wsdl.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface"/>
+ <complexType name="WSDLPortType">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="anyURI" use="required"/>
+ <attribute name="callbackInterface" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca.xsd b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca.xsd
new file mode 100644
index 0000000000..62b1c265d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/main/resources/schemas/sca.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <include schemaLocation="sca-interface-java.xsd"/>
+ <include schemaLocation="sca-interface-wsdl.xsd"/>
+
+ <include schemaLocation="sca-implementation-java.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java
new file mode 100644
index 0000000000..c4506713f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/CallbackTestCase.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.osoa.sca.annotations;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.usage.CallbackType;
+
+/**
+ * Test case for callback annotation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackTestCase extends TestCase {
+ private Class<?> type;
+ private Field field;
+ private Method method;
+
+ /**
+ * Test annotation of a callback interface.
+ */
+ public void testTypeDeclaration() {
+ assertTrue(type.isAnnotationPresent(Callback.class));
+ Callback callback = type.getAnnotation(Callback.class);
+ assertEquals(Object.class, callback.value());
+ }
+
+ /**
+ * Test annotation of a private field.
+ */
+ public void testField() {
+ assertTrue(field.isAnnotationPresent(Callback.class));
+ Callback callback = field.getAnnotation(Callback.class);
+ assertEquals(Void.class, callback.value());
+ }
+
+ /**
+ * Test annotation of a method.
+ */
+ public void testMethod() {
+ assertTrue(method.isAnnotationPresent(Callback.class));
+ Callback callback = method.getAnnotation(Callback.class);
+ assertEquals(Void.class, callback.value());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ type = CallbackType.class;
+ field = type.getDeclaredField("cbField");
+ method = type.getMethod("cbMethod");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java
new file mode 100644
index 0000000000..962c7bef51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r0.95/src/test/java/org/osoa/sca/annotations/usage/CallbackType.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.osoa.sca.annotations.usage;
+
+import org.osoa.sca.annotations.Callback;
+
+/**
+ * Mock object for callback annotation tests.
+ *
+ * @version $Rev$ $Date$
+ */
+@Callback(Object.class)
+public class CallbackType {
+ @Callback
+ private Object cbField;
+
+ /**
+ * Site for testing annotation of a public method.
+ */
+ @Callback
+ public void cbMethod() {
+ cbField = new Object();
+ }
+
+ /**
+ * Mock method to make IDEs stop complaining.
+ *
+ * @return nothing
+ */
+ public Object getCbField() {
+ return cbField;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/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/spec/sca-api-r1.0/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/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/spec/sca-api-r1.0/pom.xml b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/pom.xml
new file mode 100644
index 0000000000..7513d60814
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r${specVersion}</artifactId>
+ <name>SCA API Version 1.0</name>
+ <description>API classes for the Service Component Architecture</description>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <specVersion>1.0</specVersion>
+ </properties>
+
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java
new file mode 100644
index 0000000000..c32d229a76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.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.osoa.sca;
+
+/**
+ * Common superclass for references that can be passed between components.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
+ */
+public interface CallableReference<B> {
+ /**
+ * Returns a type-safe reference to the target of this reference.
+ * The instance returned is guaranteed to implement the business interface for this reference
+ * but may not be a proxy as defined by java.lang.reflect.Proxy.
+ *
+ * @return a proxy to the target that implements the business interface associated with this reference
+ */
+ B getService();
+
+ /**
+ * Returns the Java class for the business interface associated with this reference.
+ *
+ * @return the Class for the business interface associated with this reference
+ */
+ Class<B> getBusinessInterface();
+
+ /**
+ * Returns true if this reference is conversational.
+ *
+ * @return true if this reference is conversational
+ */
+ boolean isConversational();
+
+ /**
+ * Returns the conversation associated with this reference.
+ * Returns null if no conversation is currently active.
+ *
+ * @return the conversation associated with this reference; may be null
+ */
+ Conversation getConversation();
+
+ /**
+ * Returns the callback ID.
+ *
+ * @return the callback ID
+ */
+ Object getCallbackID();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
new file mode 100644
index 0000000000..616d4c6338
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.osoa.sca;
+
+/**
+ * Interface providing programmatic access to a component's SCA context as an alternative to injection.
+ * It provides access to reference and property values for the component and provides a mechanism for
+ * obtaining a reference to a service that can be passed to other components.
+ * <p/>
+ * SCA components obtain an instance of this interface through injection. Non-SCA client code may also
+ * obtain an instance through runtime-specific mechanisms.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContext {
+ /**
+ * Returns the absolute URI of the component within the SCA Domain.
+ *
+ * @return the absolute URI of the component
+ */
+ String getURI();
+
+ /**
+ * Cast a type-safe reference to a CallableReference.
+ * Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service
+ * then a ServiceReference will be returned, if the target refers to a callback then a CallableReference
+ * will be returned.
+ *
+ * @param target a reference proxy provided by the SCA runtime
+ * @param <B> the Java type of the business interface for the reference
+ * @param <R> the type of reference to be returned
+ * @return a CallableReference equivalent for the proxy
+ * @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime
+ */
+ <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a reference defined by this component.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
+ * @return an object that implements the business interface
+ */
+ <B> B getService(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Returns a ServiceReference for a reference defined by this component.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference for the designated reference
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Returns the value of an SCA property defined by this component.
+ *
+ * @param type the Java type to be returned for the property
+ * @param propertyName the name of the property whose value should be returned
+ * @param <B> the Java type of the property
+ * @return the property value
+ */
+ <B> B getProperty(Class<B> type, String propertyName);
+
+ /**
+ * Returns a ServiceReference that can be used to invoke this component over the default service.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference that will invoke this component
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface);
+
+ /**
+ * Returns a ServiceReference that can be used to invoke this component over the designated service.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param serviceName the name of the service to invoke
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference that will invoke this component
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns the context for the current SCA service request, or null if there is no current request
+ * or if the context is unavailable.
+ *
+ * @return the SCA request context; may be null
+ */
+ RequestContext getRequestContext();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java
new file mode 100644
index 0000000000..fcca132e0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CompositeContext.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.osoa.sca;
+
+
+/**
+ * @deprecated
+ *
+ * Interface used by SCA Components to access their context
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeContext {
+
+ /**
+ * Returns the name of the parent composite.
+ *
+ * @return the name of the module
+ */
+ String getName();
+
+ /**
+ * Returns the absolute URI of the composite component.
+ *
+ * @return the absolute URI of the module component
+ */
+ String getURI();
+
+ /**
+ * Returns the request context that corresponds to the last remotable service invocation. If this is
+ * invoked from outside an SCA component then <tt>null</tt> is returned.
+ *
+ * @return the current request context
+ */
+ RequestContext getRequestContext();
+
+ /**
+ * Returns an object implementing the interface defined for the named service.
+ *
+ * @param serviceName the name of another service in the current module
+ * @return an object that implements the service's interface
+ */
+ <T> T locateService(Class<T> serviceType, String serviceName);
+
+ /**
+ * Create a reference to the supplied component. The component must define only one service.
+ *
+ * @param self the component to be referenced
+ * @return a reference to the component
+ */
+ ServiceReference createServiceReferenceForSession(Object self);
+
+ /**
+ * Create a reference to the named service implemented by the supplied component.
+ *
+ * @param self the component to be referenced
+ * @param serviceName the service to be referenced
+ * @return a reference to the service
+ */
+ ServiceReference createServiceReferenceForSession(Object self, String serviceName);
+
+ /**
+ * Create a new session for stateful interaction with the named service.
+ *
+ * @param serviceName the name of the service to interact with
+ * @return a reference to the service
+ */
+ ServiceReference newSession(String serviceName);
+
+ /**
+ * Create a new session for stateful interaction with the named service using an application-supplied
+ * session identifier.
+ *
+ * @param serviceName the name of the service to interact with
+ * @param sessionId a token that identifies this session
+ * @return a reference to the service
+ */
+ ServiceReference newSession(String serviceName, Object sessionId);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.java
new file mode 100644
index 0000000000..b1b2af8048
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Constants.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.osoa.sca;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Constants {
+ /**
+ * Namespace for intents.
+ */
+ String SCA_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ /**
+ * Prefix form of the namespace that can be prepended to intent declarations.
+ */
+ String SCA_PREFIX = '{' + SCA_NS + '}';
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.java
new file mode 100644
index 0000000000..64423a4aa2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/Conversation.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.osoa.sca;
+
+/**
+ * Interface representing a Conversation providing access to the conversation id and and a mechanism
+ * to terminate the conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Conversation {
+ /**
+ * Returns the identifier for this conversation.
+ * If a user-defined identity had been supplied for this reference then its value will be returned;
+ * otherwise the identity generated by the system when the conversation was initiated will be returned.
+ *
+ * @return the identifier for this conversation
+ */
+ Object getConversationID();
+
+ /**
+ * End this conversation.
+ */
+ void end();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.java
new file mode 100644
index 0000000000..63e3907cff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ConversationEndedException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate the conversation being used for a stateful interaction has been ended.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationEndedException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.java
new file mode 100644
index 0000000000..0ed4cf8b96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CurrentCompositeContext.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.osoa.sca;
+
+/**
+ * @deprecated
+ *
+ * Class providing access to the current CompositeComponent.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class CurrentCompositeContext {
+ private static final ThreadLocal<CompositeContext> CURRENT_COMPONENT =
+ new InheritableThreadLocal<CompositeContext>();
+
+ /**
+ * Returns the current composite context associated with this thread.
+ *
+ * @return the current composite context
+ */
+ public static CompositeContext getContext() {
+ return CURRENT_COMPONENT.get();
+ }
+
+ /**
+ * Sets the composite context that is associated with this thread.
+ *
+ * @param context the context to associated with this thread; may be null
+ * @return the context previously associated with this thread; may be null
+ */
+ public static CompositeContext setContext(CompositeContext context) {
+ CompositeContext current = CURRENT_COMPONENT.get();
+ CURRENT_COMPONENT.set(context);
+ return current;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
new file mode 100644
index 0000000000..7c067a3a43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/NoRegisteredCallbackException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate that no callback has been registered
+ * when interacting with a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoRegisteredCallbackException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java
new file mode 100644
index 0000000000..900d5eecc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.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.osoa.sca;
+
+import javax.security.auth.Subject;
+
+/**
+ * Interface that provides information on the current request.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RequestContext {
+ /**
+ * Returns the JAAS Subject of the current request.
+ *
+ * @return the Subject of the current request
+ */
+ Subject getSecuritySubject();
+
+ /**
+ * Returns the name of the service that was invoked.
+ *
+ * @return the name of the service that was invoked
+ */
+ String getServiceName();
+
+ /**
+ * Returns a CallableReference for the service that was invoked by the caller.
+ *
+ * @param <B> the Java type of the business interface for the reference
+ * @return a CallableReference for the service that was invoked by the caller
+ */
+ <B> CallableReference<B> getServiceReference();
+
+ /**
+ * Returns a type-safe reference to the callback provided by the caller.
+ *
+ * @param <CB> the Java type of the business interface for the callback
+ * @return a type-safe reference to the callback provided by the caller
+ */
+ <CB> CB getCallback();
+
+ /**
+ * Returns a CallableReference to the callback provided by the caller.
+ *
+ * @param <CB> the Java type of the business interface for the callback
+ * @return a CallableReference to the callback provided by the caller
+ */
+ <CB> CallableReference<CB> getCallbackReference();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java
new file mode 100644
index 0000000000..8790aac4fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.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.osoa.sca;
+
+
+/**
+ * A ServiceReference represents a client's perspective of a reference to another service.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
+ */
+public interface ServiceReference<B> extends CallableReference<B> {
+ /**
+ * Returns the id supplied by the user that will be associated with conversations initiated through this reference.
+ *
+ * @return the id to associated with any conversation initiated through this reference
+ */
+ Object getConversationID();
+
+ /**
+ * Set the id to associate with any conversation started through this reference.
+ * If the value supplied is null then the id will be generated by the implementation.
+ *
+ * @param conversationId the user-defined id to associated with a conversation
+ * @throws IllegalStateException if a conversation is currently associated with this reference
+ */
+ void setConversationID(Object conversationId) throws IllegalStateException;
+
+ /**
+ * Sets the callback ID.
+ *
+ * @param callbackID the callback ID
+ */
+ void setCallbackID(Object callbackID);
+
+ /**
+ * Returns the callback object.
+ *
+ * @return the callback object
+ */
+ Object getCallback();
+
+ /**
+ * Sets the callback object.
+ *
+ * @param callback the callback object
+ */
+ void setCallback(Object callback);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.java
new file mode 100644
index 0000000000..1c6b436afa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceRuntimeException.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.osoa.sca;
+
+
+/**
+ * Base for Exceptions that may be raised by an SCA runtime and which typical
+ * application code is not expected to be able to handle.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = -3876058842262557092L;
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException() {
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.java
new file mode 100644
index 0000000000..d3543799ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceUnavailableException.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.osoa.sca;
+
+/**
+ * Exception used to indicate that a runtime exception occurred during the invocation of and external service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceUnavailableException extends ServiceRuntimeException {
+
+ private static final long serialVersionUID = -5869397223249401047L;
+
+ /**
+ * Constructs a new ServiceUnavailableException.
+ */
+ public ServiceUnavailableException() {
+ super((Throwable) null);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message.
+ *
+ * @param message The detail message (which is saved to later retrieval by the getMessage() method).
+ */
+ public ServiceUnavailableException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified cause.
+ *
+ * @param cause The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message and cause.
+ *
+ * @param message The message (which is saved to later retrieval by the getMessage() method).
+ * @param cause The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
new file mode 100644
index 0000000000..dcf16126da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a method that indicates that its parameters may safely
+ * be passed by reference. The annotation may also be placed on an interface
+ * or class to indicate that all declared methods support this optimization.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface AllowsPassByReference {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.java
new file mode 100644
index 0000000000..290ec05b7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Authentication.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.osoa.sca.annotations;
+
+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 java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+/**
+ * Annotation denoting the intent that service operations require authentication.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require authentication.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require authentication; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require authentication.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require authentication.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require authentication.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require authentication.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Authentication.AUTHENTICATION)
+public @interface Authentication {
+ String AUTHENTICATION = SCA_PREFIX + "authentication";
+ String AUTHENTICATION_MESSAGE = AUTHENTICATION + "message";
+ String AUTHENTICATION_TRANSPORT = AUTHENTICATION + "transport";
+
+ /**
+ * List of authentication qualifiers (such as "message" or "transport").
+ *
+ * @return authentication qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.java
new file mode 100644
index 0000000000..6b3e51211a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Callback.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * When placed on a service interface, this annotation specifies the interface
+ * to be used for callbacks.
+ * <p/>
+ * When placed on a method or field, this annotation denotes the injection
+ * site to be used for a callback reference.
+ * <p/>
+ * There is a error in the 1.00 draft spec in the declaration of this interface.
+ * The form defined here is a proposed correction for that error.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Callback {
+ /**
+ * The Class of the associated callback interface.
+ *
+ * @return the associated callback interface
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.java
new file mode 100644
index 0000000000..0ad13831c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ComponentName.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or method that is used to inject the component's name.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ComponentName {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.java
new file mode 100644
index 0000000000..e8b0721ce5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Confidentiality.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.osoa.sca.annotations;
+
+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 java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+/**
+ * Annotation denoting the intent that service operations require confidentiality.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require confidentiality.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require confidentiality; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require confidentiality.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require confidentiality.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require confidentiality.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require confidentiality.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Confidentiality.CONFIDENTIALITY)
+public @interface Confidentiality {
+ String CONFIDENTIALITY = SCA_PREFIX + "confidentiality";
+ String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message";
+ String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport";
+
+ /**
+ * List of confidentiality qualifiers (such as "message" or "transport").
+ *
+ * @return confidentiality qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.java
new file mode 100644
index 0000000000..8480b38926
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Constructor.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Used to indicate the constructor the runtime is to use when instantiating a component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(CONSTRUCTOR)
+@Retention(RUNTIME)
+public @interface Constructor {
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.java
new file mode 100644
index 0000000000..c02e220d3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Context.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or setter method that is used to inject an SCA context.
+ * The type of context injected is determined by the type of the field or the parameter
+ * to the setter method and is typically a ComponentContext or RequestContext.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Context {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
new file mode 100644
index 0000000000..edd2307de8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationAttributes.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.osoa.sca.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the characteristics of a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(ElementType.TYPE)
+@Retention(RUNTIME)
+public @interface ConversationAttributes {
+ /**
+ * The maximum time that can pass between operations in a single conversation. If this time is exceeded the
+ * container may end the conversation.
+ *
+ * @return the maximum time that can pass between operations in a single conversation
+ */
+ public String maxIdleTime() default "";
+
+ /**
+ * The maximum time that a conversation may remain active. If this time is exceeded the container may end the
+ * conversation.
+ *
+ * @return the maximum time that a conversation may remain active
+ */
+ public String maxAge() default "";
+
+ /**
+ * If true, indicates that only the user that initiated the conversation has the authority to continue it.
+ *
+ * @return true if only the user that initiated the conversation has the authority to continue it
+ */
+ public boolean singlePrincipal() default false;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.java
new file mode 100644
index 0000000000..e521b91797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/ConversationID.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 used to indicate a field or method that is used to inject the conversation ID.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ConversationID {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.java
new file mode 100644
index 0000000000..c2e6e7fe0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Conversational.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Used on a Java interface to denote a conversational service contract.
+ * <p/>
+ * The draft spec erroneously defines the targets for this as {TYPE, METHOD, FIELD}
+ * but this annotation is only applicable to interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Conversational {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.java
new file mode 100644
index 0000000000..0a81dbe14c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Destroy.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.osoa.sca.annotations;
+
+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 used to indicate a method that will be called by the container when the
+ * scope defined for the local service ends.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Destroy {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.java
new file mode 100644
index 0000000000..5a2fdd7518
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EagerInit.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate an instance should be eagerly initialized.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface EagerInit {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.java
new file mode 100644
index 0000000000..021900752c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/EndsConversation.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.osoa.sca.annotations;
+
+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 used to indicate a method ends a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface EndsConversation {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.java
new file mode 100644
index 0000000000..957bec262c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Init.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.osoa.sca.annotations;
+
+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 used to indicate a method that will be called by the container when the scope defined for the local
+ * service begins.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Init {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.java
new file mode 100644
index 0000000000..11f266ac5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Integrity.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.osoa.sca.annotations;
+
+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 java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+/**
+ * Annotation denoting the intent that service operations require integrity.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require integrity.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require integrity; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require integrity.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require integrity.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require integrity.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require integrity.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Integrity.INTEGRITY)
+public @interface Integrity {
+ String INTEGRITY = SCA_PREFIX + "integrity";
+ String INTEGRITY_MESSAGE = INTEGRITY + "message";
+ String INTEGRITY_TRANSPORT = INTEGRITY + "transport";
+
+ /**
+ * List of integrity qualifiers (such as "message" or "transport").
+ *
+ * @return integrity qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.java
new file mode 100644
index 0000000000..c655495e74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Intent.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that can be applied to annotations that describe SCA intents.
+ * Adding this annotation allows SCA runtimes to automatically detect user-defined intents.
+ * <p/>
+ * Applications must specify a value, a pairing of targetNamespace and localPort, or both.
+ * If both value and pairing are supplied they must define the name qualified name.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({ANNOTATION_TYPE})
+@Retention(RUNTIME)
+public @interface Intent {
+ /**
+ * The qualified name of the intent, in the form defined by {@link javax.xml.namespace.QName#toString}.
+ *
+ * @return the qualified name of the intent
+ */
+ String value() default "";
+
+ /**
+ * The XML namespace for the intent.
+ *
+ * @return the XML namespace for the intent
+ */
+ String targetNamespace() default "";
+
+ /**
+ * The name of the intent within its namespace.
+ *
+ * @return name of the intent within its namespace
+ */
+ String localPart() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.java
new file mode 100644
index 0000000000..37fbaf96cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/OneWay.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.osoa.sca.annotations;
+
+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 on a method that indicates that the method is non-blocking and communication
+ * with the service provider may use buffer the requests and send them at some later time.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface OneWay {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.java
new file mode 100644
index 0000000000..5bf43b0539
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/PolicySets.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.osoa.sca.annotations;
+
+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 java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that allows application of SCA Policy Sets.
+ * <p/>
+ * Each policy set is specified using its XML QName in the form defined by {@link javax.xml.namespace.QName#toString()}.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+public @interface PolicySets {
+ /**
+ * Returns the policy sets to be applied.
+ *
+ * @return the policy sets to be applied
+ */
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.java
new file mode 100644
index 0000000000..e0248c01f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Property.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is
+ * used to inject a configuration property value.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Property {
+ /**
+ * The name of the property. If not specified then the name will be derived
+ * from the annotated field or method.
+ *
+ * @return the name of the property
+ */
+ String name() default "";
+
+ /**
+ * Indicates whether a value for the property must be provided.
+ *
+ * @return true if a value must be provided
+ */
+ boolean required() default false;
+
+ /**
+ * The XML Type in a QName format
+ */
+ String xmlType() default "";
+ }
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.java
new file mode 100644
index 0000000000..9875891460
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Qualifier.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.osoa.sca.annotations;
+
+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 an attribute of an @Intent annotation to indicate the
+ * attribute provides qualifiers for the intent.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Qualifier {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.java
new file mode 100644
index 0000000000..f6f6797ccc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Reference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is used to inject a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Reference {
+ /**
+ * The name of the reference. If not specified then the name will be derived from the annotated field or method.
+ *
+ * @return the name of the reference
+ */
+ public String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ *
+ * @return true if a reference must be specified
+ */
+ public boolean required() default false;
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.java
new file mode 100644
index 0000000000..f447a4126d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Remotable.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a Java interface as remotable.
+ * Remotable interfaces use pass-by-value semantics, can be published as entry points
+ * and used for external services.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Remotable {
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.java
new file mode 100644
index 0000000000..2f14ab59f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Requires.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.osoa.sca.annotations;
+
+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 java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that allows the attachment of any intent to a Java Class or interface or to members of that
+ * class such as methods, fields or constructor parameters.
+ * <p/>
+ * Intents are specified as XML QNames in the representation defined by
+ * {@link javax.xml.namespace.QName#toString()}. Intents may be qualified with one or more
+ * suffixes separated by a "." such as:
+ * <ul>
+ * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality</li>
+ * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality.message</li>
+ * </ul>
+ * This annotation supports general purpose intents specified as strings. Users may also define
+ * specific intents using the {@link @org.osoa.sca.annotations.Intent} annotation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+public @interface Requires {
+ /**
+ * Returns the attached intents.
+ *
+ * @return the attached intents
+ */
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.java
new file mode 100644
index 0000000000..9f82fbc283
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Scope.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a scoped service.
+ * <p/>
+ * The spec refers to but does not describe an eager() attribute; this is an error in the draft.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Scope {
+ /**
+ * The name of the scope. Values currently defined by the specification are:
+ * <ul>
+ * <li>STATELESS (default)</li>
+ * <li>REQUEST</li>
+ * <li>CONVERSATION</li>
+ * <li>COMPOSITE</li>
+ * </ul>
+ *
+ * @return the name of the scope
+ */
+ String value() default "STATELESS";
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.java
new file mode 100644
index 0000000000..99d3dbfebe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/annotations/Service.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the service interfaces exposed by a Java class.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Service {
+ /**
+ * Array of interfaces that should be exposed as services.
+ *
+ * @return a list of interfaces that should be exposed as services
+ */
+ Class<?>[] interfaces() default {};
+
+ /**
+ * Shortcut allowing a single interface to be exposed.
+ *
+ * @return a single service interfaces to be exposed
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/pom.xml
new file mode 100644
index 0000000000..f6de7e91de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-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.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca-interop</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-interop-clients</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Interop Testing - Clients</name>
+
+ <modules>
+ <module>webserviceInteropDoc</module>
+ <module>webserviceSOAPRound2</module>
+ <module>webserviceXSQ</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/pom.xml
new file mode 100644
index 0000000000..7cf88d1c51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-interop-clients</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>interop-client-webserviceInteropDoc</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Interop Testing - Clients - InteropDoc</name>
+
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${sca.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java
new file mode 100644
index 0000000000..1b3a6a6c1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.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.test.interop.client;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+/**
+ * This class implements the DocTest service component.
+ */
+@Service(DocTestPortType.class)
+//FIXME workaround for JIRA TUSCANY-41
+@Scope("COMPOSITE")
+public class LoopbackInteropDocServiceComponentImpl implements DocTestPortType {
+
+ public ComplexDocument ComplexDocument(ComplexDocument param0) throws RemoteException {
+ return param0;
+ }
+
+ public SimpleDocument1 SimpleDocument(SimpleDocument1 param4) throws RemoteException {
+ return param4;
+ }
+
+ public SingleTag SingleTag(SingleTag param2) throws RemoteException {
+ return param2;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/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/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..d286a5137f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="interop.client">
+<!--
+ <import.sdo factory="org.soapinterop.SoapinteropFactory"/>
+ <import.wsdl wsdlLocation="wsdl/interopdoc.wsdl"/>
+ -->
+ <!-- import.sdo location="wsdl/interopdoc.wsdl" -->
+ <dbsdo:import.sdo factory="org.soapinterop.SoapinteropFactory"/>
+
+ <component name="LoopbackInteropDocService">
+ <implementation.java class="org.apache.tuscany.test.interop.client.LoopbackInteropDocServiceComponentImpl"/>
+ </component>
+
+ <reference name="RemoteInteropDocService">
+ <!-- interface.wsdl interface="http://soapinterop.org/#wsdl.interface(DocTestPortType)"/ -->
+ <interface.java interface="org.soapinterop.DocTestPortType"/>
+
+ <binding.ws endpoint="http://soapinterop.org/#wsdl.endpoint(interopDocSvc/interopDocPort)" location="wsdl/interopdoc.wsdl"/>
+ </reference>
+
+ <reference name="LocalHostInteropDocService">
+ <!-- interface.wsdl interface="http://soapinterop.org/#wsdl.interface(DocTestPortType)"/ -->
+ <interface.java interface="org.soapinterop.DocTestPortType"/>
+
+
+ <binding.ws endpoint="http://soapinterop.org/#wsdl.endpoint(interopDocSvc/interopDocPort)"
+ location="wsdl/interopdoc.wsdl"/>
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl
new file mode 100644
index 0000000000..fb208f56ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>axis2</group>
+ <name>axis2-kernel</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl
new file mode 100644
index 0000000000..92a6be450f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl
new file mode 100644
index 0000000000..61753384b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl
new file mode 100644
index 0000000000..84538dab8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>wsdl4j</group>
+ <name>wsdl4j</name>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.ws.commons</group>
+ <name>XmlSchema</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl
new file mode 100644
index 0000000000..bda64f749e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite name="test.extensions" xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT">
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="includes/interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="includes/databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="includes/databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="includes/binding.axis2.scdl"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl
new file mode 100644
index 0000000000..89a8a2e3de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl
@@ -0,0 +1,185 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://soapinterop.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/">
+
+ <xsd:element name="SingleTag">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="SingleTag"/>
+ <xsd:element name="SingleTagResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SimpleDocument">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="SimpleDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ComplexDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ComplexDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/>
+ </xsd:sequence>
+ <xsd:attribute name="AnAttribute" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfSimpleDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ChildDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ComplexDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+
+ </types>
+
+ <message name="SingleTagSoapIn">
+ <part name="parameters" element="tns:SingleTag"/>
+ </message>
+ <message name="SingleTagSoapOut">
+ <part name="outputDoc" element="tns:SingleTagResponse"/>
+ </message>
+ <message name="SimpleDocumentSoapIn">
+ <part name="parameters" element="tns:SimpleDocument"/>
+ </message>
+ <message name="SimpleDocumentSoapOut">
+ <part name="outputDoc" element="tns:SimpleDocumentResponse"/>
+ </message>
+ <message name="ComplexDocumentSoapIn">
+ <part name="parameters" element="tns:ComplexDocument"/>
+ </message>
+ <message name="ComplexDocumentSoapOut">
+ <part name="outputDoc" element="tns:ComplexDocumentResponse"/>
+ </message>
+
+ <portType name="DocTestPortType">
+
+ <operation name="SingleTag">
+ <input message="tns:SingleTagSoapIn"/>
+ <output message="tns:SingleTagSoapOut"/>
+ </operation>
+ <operation name="SimpleDocument">
+ <input message="tns:SimpleDocumentSoapIn"/>
+ <output message="tns:SimpleDocumentSoapOut"/>
+ </operation>
+ <operation name="ComplexDocument">
+ <input message="tns:ComplexDocumentSoapIn"/>
+ <output message="tns:ComplexDocumentSoapOut"/>
+ </operation>
+
+ </portType>
+
+ <binding name="doc_test_binding" type="tns:DocTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="SingleTag">
+ <soap:operation soapAction="http://soapinterop.org/SingleTag"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="SimpleDocument">
+ <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="ComplexDocument">
+ <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="interopDocSvc">
+
+ <port name="interopDocPort" binding="tns:doc_test_binding">
+ <soap:address location="http://www.whitemesa.net/interopdoc"/>
+ <!-- soap:address location="http://mssoapinterop.org/asmx/simple.asmx"/ -->
+ <!-- soap:address location="http://easysoap.sourceforge.net/cgi-bin/interopserver"/ -->
+ <!-- soap:address location="http://www.mssoapinterop.org/remoting/ServiceAllTypes.soap"/ -->
+ <http-conf:client xmlns:http-conf="http://celtix.objectweb.org/transports/http/configuration"
+ AllowChunking="false"/>
+ </port>
+
+ </service>
+
+</definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java
new file mode 100644
index 0000000000..6b74f04283
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.test.interop.client;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.soapinterop.ArrayOfSimpleDocument;
+import org.soapinterop.ChildDocument;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+import commonj.sdo.helper.DataFactory;
+
+public class InteropDocClientTestCase extends SCATestCase {
+
+ private DataFactory dataFactory;
+
+ private DocTestPortType interopDoc;
+
+ public InteropDocClientTestCase(){};
+
+ public void testSingleTag() throws RemoteException {
+
+ // Create the input
+ SingleTag input = (SingleTag) dataFactory.create(SingleTag.class);
+
+ // Invoke the service
+ SingleTag output = interopDoc.SingleTag(input);
+
+ // Test the results
+ assertNotNull(output);
+
+ }
+
+ public void testSimpleDocument() throws RemoteException {
+
+ // Create the input
+ SimpleDocument1 input = (SimpleDocument1) dataFactory.create(SimpleDocument1.class);
+ input.setValue("123");
+
+ // Invoke the service
+ SimpleDocument1 output = interopDoc.SimpleDocument(input);
+
+ // Test the results
+ assertNotNull(output);
+ assertEquals("123", output.getValue());
+
+ }
+
+ public void testComplexDocument() throws RemoteException {
+
+ // Create the input
+ ComplexDocument input = (ComplexDocument) dataFactory.create(ComplexDocument.class);
+ input.setAnAttribute("789");
+ ChildDocument childDocument = (ChildDocument) dataFactory.create(ChildDocument.class);
+ SimpleDocument simpleDocument = (SimpleDocument) dataFactory.create(SimpleDocument.class);
+ ;
+ SimpleDocument1 simpleDocument1 = (SimpleDocument1) dataFactory.create(SimpleDocument1.class);
+ ;
+ simpleDocument.setSimpleDocument(simpleDocument1);
+ simpleDocument1.setValue("456");
+ ArrayOfSimpleDocument arrayOfSimpleDocument = (ArrayOfSimpleDocument) dataFactory.create(ArrayOfSimpleDocument.class);
+ ;
+ arrayOfSimpleDocument.getSimpleDocument().add(simpleDocument1);
+ childDocument.setChildSimpleDoc(arrayOfSimpleDocument);
+ input.setChild(childDocument);
+
+ // Invoke the service
+ ComplexDocument output = interopDoc.ComplexDocument(input);
+
+ // Test the results
+ assertNotNull(output);
+ assertEquals("789", output.getAnAttribute());
+ assertNotNull(output.getChild());
+ assertNotNull(output.getChild().getChildSimpleDoc());
+
+ // FIXME Add more tests of the output document
+
+ }
+
+ protected void setUp() throws Exception {
+
+ setApplicationSCDL(LoopbackInteropDocServiceComponentImpl.class, "META-INF/sca/default.scdl");
+
+ addExtension("test.extensions", getClass().getClassLoader().getResource("META-INF/tuscany/extensions/test-extensions.scdl"));
+ /*
+ addExtension("org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry", getClass().getClassLoader().getResource(
+
+ "META-INF/tuscany/interface.wsdl.scdl"));
+
+ addExtension("org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector", getClass().getClassLoader().getResource(
+ "META-INF/tuscany/interface.wsdl.scdl"));
+
+
+
+ addExtension("org.apache.tuscany.binding.axis2.WebServiceBinding", getClass().getClassLoader().getResource(
+ "META-INF/tuscany/binding.axis2.scdl"));
+ addExtension("org.apache.tuscany.databinding.sdo", getClass().getClassLoader().getResource("META-INF/tuscany/databinding.sdo.scdl"));
+ */
+ super.setUp();
+
+ // Get the SDO DataFactory
+ dataFactory = DataFactory.INSTANCE;
+
+ // Locate the service to test
+ interopDoc = locateInteropDocService();
+
+ }
+
+ /**
+ * Locate the interop service to test
+ *
+ * @return
+ */
+ protected DocTestPortType locateInteropDocService() {
+ String interopLocation = System.getProperty("interopLocation");
+
+ // Valid service names are:
+ // RemoteInteropDocService: the live interop Web Service
+ // LocalHostInteropDocService: the interop Web Service hosted by Tuscany on localhost
+ // LoopbackInteropDocServiceComponent: a dummy loopback service component
+
+ // To specify the service name run mvn -interopLocation="Remote"
+
+ if (interopLocation == null)
+ interopLocation = "Remote";
+
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+
+ return (DocTestPortType) compositeContext.locateService(DocTestPortType.class, interopLocation + "InteropDocService");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/pom.xml
new file mode 100644
index 0000000000..ba34ed3df3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-interop-clients</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>interop-client-webserviceSOAPRound2</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Interop Testing - Clients - SOAP Builders Round 2 Interop Test</name>
+
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${sca.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop.wsdl.interop.test.doc.lit</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java
new file mode 100644
index 0000000000..079d3aefeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/java/org/apache/tuscany/test/interop/client/InteropTestDocLit.java
@@ -0,0 +1,44 @@
+package org.apache.tuscany.test.interop.client;
+import org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ * @author rineholt
+ *
+ */
+public class InteropTestDocLit {
+ private WSDLInteropTestDocLitPortType interopTestDocLitPortType =null;
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+
+ }
+ WSDLInteropTestDocLitPortType getInteropTestDocLitPortType() {
+ return interopTestDocLitPortType;
+ }
+ void setInteropTestDocLitPortType(WSDLInteropTestDocLitPortType interopTestDocLitPortType) {
+ this.interopTestDocLitPortType = interopTestDocLitPortType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/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/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..0ed260399c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="InteropClient">
+
+ <dbsdo:import.sdo location="wsdl/interoptestdoclit.wsdl"/>
+ <dbsdo:import.sdo factory="org.soapinterop.xsd.XsdFactory"/>
+
+ <reference name="RemoteInteropDocService">
+<!--
+ <interface.wsdl interface="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.interface(WSDLInteropTestDocLitPortType)"/>
+ <binding.ws port="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.endpoint(WSDLInteropTestDocLitService/WSDLInteropTestDocLitPort)"/>
+-->
+
+ <interface.java interface="org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType"/>
+ <binding.ws endpoint="http://soapinterop.org/WSDLInteropTestDocLit#wsdl.endpoint(WSDLInteropTestDocLitService/WSDLInteropTestDocLitPort)"
+ location="wsdl/interoptestdoclit.wsdl" />
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl
new file mode 100644
index 0000000000..fb208f56ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/binding.axis2.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>axis2</group>
+ <name>axis2-kernel</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl
new file mode 100644
index 0000000000..21df676937
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.axiom.scdl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl
new file mode 100644
index 0000000000..61753384b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/databinding.sdo.scdl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl
new file mode 100644
index 0000000000..84538dab8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/includes/interface.wsdl.scdl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>wsdl4j</group>
+ <name>wsdl4j</name>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.ws.commons</group>
+ <name>XmlSchema</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl
new file mode 100644
index 0000000000..1e8c3b1589
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/tuscany/extensions/test-extensions.scdl
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite name="test.extensions" xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT">
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="includes/interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="includes/databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="includes/databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="includes/binding.axis2.scdl"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl
new file mode 100644
index 0000000000..e08039cedb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="WSDLInteropTestDocLitService"
+ targetNamespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://soapinterop.org/WSDLInteropTestDocLit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd1="http://soapinterop.org/xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <types>
+ <schema targetNamespace="http://soapinterop.org/xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ elementFormDefault="qualified">
+ <complexType name="ArrayOfstring_literal">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="1" name="string" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="SOAPStruct">
+ <all>
+ <element name="varFloat" type="xsd:float"/>
+ <element name="varInt" type="xsd:int"/>
+ <element name="varString" type="xsd:string"/>
+ </all>
+ </complexType>
+
+ <element name="echoStringParam" type="xsd:string"/>
+
+ <element name="echoStringReturn" type="xsd:string"/>
+ <element name="echoStringArrayParam" type="xsd1:ArrayOfstring_literal"/>
+
+ <element name="echoStringArrayReturn" type="xsd1:ArrayOfstring_literal"/>
+
+ <element name="echoStructParam" type="xsd1:SOAPStruct"/>
+
+ <element name="echoStructReturn" type="xsd1:SOAPStruct"/>
+ </schema>
+ </types>
+ <message name="echoString">
+ <part element="xsd1:echoStringParam" name="a"/>
+ </message>
+ <message name="echoStringResponse">
+ <part element="xsd1:echoStringReturn" name="result"/>
+ </message>
+ <message name="echoStringArray">
+ <part element="xsd1:echoStringArrayParam" name="a"/>
+ </message>
+ <message name="echoStringArrayResponse">
+ <part element="xsd1:echoStringArrayReturn" name="result"/>
+ </message>
+ <message name="echoStruct">
+ <part element="xsd1:echoStructParam" name="a"/>
+ </message>
+ <message name="echoStructResponse">
+ <part element="xsd1:echoStructReturn" name="result"/>
+ </message>
+ <message name="echoVoid"/>
+ <message name="echoVoidResponse"/>
+
+ <portType name="WSDLInteropTestDocLitPortType">
+ <operation name="echoString">
+ <input message="tns:echoString" name="echoString"/>
+ <output message="tns:echoStringResponse" name="echoStringResponse"/>
+ </operation>
+ <operation name="echoStringArray">
+ <input message="tns:echoStringArray" name="echoStringArray"/>
+ <output message="tns:echoStringArrayResponse" name="echoStringArrayResponse"/>
+ </operation>
+ <operation name="echoStruct">
+ <input message="tns:echoStruct" name="echoStruct"/>
+ <output message="tns:echoStructResponse" name="echoStructResponse"/>
+ </operation>
+ <operation name="echoVoid">
+ <input message="tns:echoVoid" name="echoVoid"/>
+ <output message="tns:echoVoidResponse" name="echoVoidResponse"/>
+ </operation>
+ </portType>
+ <binding name="WSDLInteropTestDocLitPortBinding"
+ type="tns:WSDLInteropTestDocLitPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echoString">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoString">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStringResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoStringArray">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoStringArray">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStringArrayResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoStruct">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoStruct">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoStructResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ <operation name="echoVoid">
+ <soap:operation soapAction="http://soapinterop.org/" style="document"/>
+ <input name="echoVoid">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </input>
+ <output name="echoVoidResponse">
+ <soap:body namespace="http://soapinterop.org/WSDLInteropTestDocLit"
+ use="literal"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="WSDLInteropTestDocLitService">
+ <port binding="tns:WSDLInteropTestDocLitPortBinding"
+ name="WSDLInteropTestDocLitPort">
+ <soap:address
+ location="http://mssoapinterop.org/stkv3/wsdl/interopTestDocLit.wsdl"/>
+ <http-conf:client xmlns:http-conf="http://celtix.objectweb.org/transports/http/configuration"
+ AllowChunking="false"/>
+ </port>
+ </service>
+</definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java
new file mode 100644
index 0000000000..da70d5b3a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.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.test.interop.client;
+
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType;
+import org.soapinterop.xsd.ArrayOfstring_literal;
+import org.soapinterop.xsd.SOAPStruct;
+import org.soapinterop.xsd.XsdPackage;
+
+import commonj.sdo.helper.DataFactory;
+
+/**
+ * This test case is part of the tuscany interop tests. This is a reduced version of the SOAPBuilders InteropTest test, document/literal mode. This
+ * version has operations such as echoString, echoArrayOfString and echoStruct.
+ *
+ * <p>
+ * The WSDL for the external service used in this test case can be downloaded from http://www.mssoapinterop.org/stkV3/wsdl/InteropTestDocLit.wsdl.
+ * This is part of the WSDL interop test from Microsoft and more details aobout this test case are found at
+ * http://www.mssoapinterop.org/stkV3/wsdl/WSDLInterop-0118.htm
+ */
+public class InteropTestDocLitTestCase extends SCATestCase {
+
+ private WSDLInteropTestDocLitPortType doc = null;
+
+ private DataFactory dataFactory;
+
+
+ protected void setUp() throws Exception {
+ setApplicationSCDL(InteropTestDocLit.class, "META-INF/sca/default.scdl");
+ addExtension("test.extensions", InteropTestDocLit.class.getClassLoader().getResource("META-INF/tuscany/extensions/test-extensions.scdl"));
+
+ super.setUp();
+
+ // Get the SDO DataFactory
+ dataFactory = DataFactory.INSTANCE;
+
+ // Locate the service to test
+ doc = locateInteropDocService();
+ }
+
+ /**
+ * Locate the interop service to test
+ *
+ * @return
+ */
+ protected WSDLInteropTestDocLitPortType locateInteropDocService() {
+
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ return compositeContext.locateService(WSDLInteropTestDocLitPortType.class, "RemoteInteropDocService");
+
+ }
+
+ /**
+ * test echo void
+ *
+ * @throws RemoteException
+ */
+ public void testEchoVoid() throws RemoteException {
+ doc.echoVoid();
+ assertTrue(true);
+ }
+
+ /**
+ * test echo string
+ *
+ * @throws RemoteException
+ */
+ public void testEchoString() throws RemoteException {
+ String input = "a test string";
+ String output = doc.echoString(input);
+ assertEquals(input, output);
+ }
+
+ /**
+ * test echo string
+ *
+ * @throws RemoteException
+ */
+ public void testEchoStringArray() throws RemoteException {
+
+ ArrayOfstring_literal input = (ArrayOfstring_literal) dataFactory.create(ArrayOfstring_literal.class);
+ List inStrings = Arrays.asList(new String[] { "petra", "sue" });
+ input.set(XsdPackage.ARRAY_OFSTRING_LITERAL__STRING, inStrings);
+
+ ArrayOfstring_literal output = doc.echoStringArray(input);
+
+ List outStrings = output.getString();
+ assertNotNull(outStrings);
+ assertEquals(2, outStrings.size());
+ assertEquals("petra", outStrings.get(0));
+ assertEquals("sue", outStrings.get(1));
+ }
+
+ /**
+ * test echo struct
+ *
+ * @throws RemoteException
+ */
+ public void testEchoStruct() throws RemoteException {
+ SOAPStruct input = (SOAPStruct) dataFactory.create(SOAPStruct.class);
+ input.setVarInt(200);
+ input.setVarFloat(.002f);
+ input.setVarString("Hello");
+ SOAPStruct output = doc.echoStruct(input);
+ assertEquals(input.getVarInt(), output.getVarInt());
+ assertEquals(input.getVarFloat(), output.getVarFloat());
+ assertEquals(input.getVarString(), output.getVarString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/pom.xml
new file mode 100644
index 0000000000..c31cce8fc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-interop-clients</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>interop-client-webserviceXSQ</artifactId>
+ <packaging>jar</packaging>
+ <name>Tuscany Interop Testing - Clients - webserviceXSQ</name>
+ <properties>
+ <ws.type>axis2</ws.type>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ <argLine>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3720,server=y,suspend=y</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${sca.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/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/testing/sca/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java
new file mode 100644
index 0000000000..f2a7b198a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.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 interop;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.test.SCATestCase;
+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 ClientTestCase extends SCATestCase {
+ private Object serviceProxy;
+
+ // old tc
+ // public void testGetQuote() throws ConfigurationException,
+ // SecurityException, NoSuchMethodException, IllegalArgumentException,
+ // IllegalAccessException, InvocationTargetException {
+ //
+ // TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null);
+ // tuscany.start();
+ // ModuleContext moduleContext = CurrentModuleContext.getContext();
+ //
+ // Object serviceProxy = moduleContext.locateService("webserviceXSQ");
+ // Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] {
+ // String.class });
+ //
+ // String sqResponse = (String) m.invoke(serviceProxy, "IBM");
+ //
+ // assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
+ //
+ // tuscany.stop();
+ // }
+
+ public void testGetQuote() throws IllegalArgumentException, IllegalAccessException,
+ InvocationTargetException, SecurityException, NoSuchMethodException {
+ Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] {String.class});
+
+ String sqResponse = (String)m.invoke(serviceProxy, "IBM");
+
+ assertTrue(sqResponse.startsWith("<StockQuotes><Stock><Symbol>IBM</Symbol>"));
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ setApplicationSCDL(getClass(), "META-INF/sca/test.scdl");
+
+ addExtension("test.exts", getClass().getClassLoader()
+ .getResource("META-INF/tuscany/test-extensions.scdl"));
+
+ super.setUp();
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ serviceProxy = compositeContext.locateService(Object.class, "webserviceXSQ");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/sca/test.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/sca/test.scdl
new file mode 100644
index 0000000000..22b3b90623
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/sca/test.scdl
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="composite.webserviceXSQ">
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/sq.wsdl"/>
+
+ <reference name="webserviceXSQ">
+ <interface.wsdl interface="http://www.webserviceX.NET/#wsdl.interface(StockQuoteSoap)" wsdli:wsdlLocation="http://www.webserviceX.NET/ wsdl/sq.wsdl" />
+ <binding.ws endpoint="http://www.webserviceX.NET/#wsdl.endpoint(StockQuote/StockQuoteSoap)"
+ location="wsdl/sq.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/binding.axis2.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/binding.axis2.scdl
new file mode 100644
index 0000000000..fb208f56ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/binding.axis2.scdl
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Axis2 based WebService binding extension -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.axis2.WebServiceBinding">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>axis2</group>
+ <name>axis2-kernel</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="webservice.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
+ </component>
+
+ <component name="webservice.axis2.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.axiom.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
new file mode 100644
index 0000000000..e4fe956e61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
new file mode 100644
index 0000000000..61753384b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/interface.wsdl.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
new file mode 100644
index 0000000000..84538dab8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>wsdl4j</group>
+ <name>wsdl4j</name>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency xmlns="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT">
+ <group>org.apache.ws.commons</group>
+ <name>XmlSchema</name>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/test-extensions.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/test-extensions.scdl
new file mode 100644
index 0000000000..355b663a1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/META-INF/tuscany/test-extensions.scdl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="binding.axis2.scdl"/>
+
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl
new file mode 100644
index 0000000000..0408a60297
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:tns="http://www.webserviceX.NET/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.webserviceX.NET/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/">
+ <s:element name="GetQuote">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+
+ </s:element>
+ <s:element name="GetQuoteResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="string" nillable="true" type="s:string" />
+
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetQuoteSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuote" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuoteResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetIn">
+
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetOut">
+ <wsdl:part name="Body" element="tns:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostIn">
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostOut">
+
+ <wsdl:part name="Body" element="tns:string" />
+ </wsdl:message>
+ <wsdl:portType name="StockQuoteSoap">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteSoapIn" />
+ <wsdl:output message="tns:GetQuoteSoapOut" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:portType name="StockQuoteHttpGet">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpGetIn" />
+ <wsdl:output message="tns:GetQuoteHttpGetOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="StockQuoteHttpPost">
+ <wsdl:operation name="GetQuote">
+ <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</documentation>
+ <wsdl:input message="tns:GetQuoteHttpPostIn" />
+ <wsdl:output message="tns:GetQuoteHttpPostOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap">
+
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ <wsdl:operation name="GetQuote">
+ <soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet">
+ <http:binding verb="GET" />
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:mimeXml part="Body" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost">
+ <http:binding verb="POST" />
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StockQuote">
+
+ <wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap">
+ <soap:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet">
+ <http:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost">
+ <http:address location="http://www.webservicex.net/stockquote.asmx" />
+ </wsdl:port>
+
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/pom.xml
new file mode 100644
index 0000000000..461ba16256
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-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.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-testing-sca-interop</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Interop Testing</name>
+
+ <properties>
+ <sdo.version>1.0-incubator-SNAPSHOT</sdo.version>
+ <specVersionSDO>2.1</specVersionSDO>
+ </properties>
+
+ <modules>
+ <module>clients</module>
+ <sdo.version>1.0-incubator-SNAPSHOT</sdo.version>
+ <specVersionSDO>2.1</specVersionSDO>
+ <module>services</module>
+ </modules>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/pom.xml
new file mode 100644
index 0000000000..1f1970ff63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2005-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.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca-interop</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-interop-services</artifactId>
+ <packaging>pom</packaging>
+ <name>Tuscany Interop Testing - Services</name>
+
+ <modules>
+ <module>webserviceInteropDoc</module>
+ </modules>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/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/testing/sca/interop/services/webserviceInteropDoc/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/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/testing/sca/interop/services/webserviceInteropDoc/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/pom.xml
new file mode 100644
index 0000000000..2da8adf7af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/pom.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-interop-services</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>interop-service-webserviceInteropDoc</artifactId>
+ <packaging>war</packaging>
+ <name>Tuscany Interop Testing - Services - InteropDoc</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp</artifactId>
+ <version>${sca.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp-host</artifactId>
+ <version>${sca.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${sca.version}</version>
+ <scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noInterfaces>true</noInterfaces>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${sca.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/interopdoc.wsdl</wsdlFile>
+ <javaPackage>org.soapinterop</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java
new file mode 100644
index 0000000000..c34941f43e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.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.test.interop.server;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Service;
+import org.soapinterop.ComplexDocument;
+import org.soapinterop.DocTestPortType;
+import org.soapinterop.SimpleDocument1;
+import org.soapinterop.SingleTag;
+
+/**
+ * This class implements the HelloWorld service component.
+ */
+@Service(DocTestPortType.class)
+public class InteropDocServiceComponentImpl implements DocTestPortType {
+
+ public ComplexDocument ComplexDocument(ComplexDocument param2) throws RemoteException {
+ return param2;
+ }
+
+ public SimpleDocument1 SimpleDocument(SimpleDocument1 param0) throws RemoteException {
+ return param0;
+ }
+
+ public SingleTag SingleTag(SingleTag param4) throws RemoteException {
+ return param4;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<definitions name="InteropTestDoc" targetNamespace="http://soapinterop.org/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://soapinterop.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://soapinterop.org/" xmlns:interop="http://soapinterop.org/">
+
+ <xsd:element name="SingleTag">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="SingleTag"/>
+ <xsd:element name="SingleTagResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SingleTag" type="interop:SingleTag"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="SimpleDocument">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="SimpleDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="SimpleDocument" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ComplexDocument">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ComplexDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="simpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ <xsd:element minOccurs="0" maxOccurs="1" name="child" type="interop:ChildDocument"/>
+ </xsd:sequence>
+ <xsd:attribute name="AnAttribute" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="ArrayOfSimpleDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="unbounded" name="SimpleDocument" nillable="true" type="interop:SimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ChildDocument">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="childSimpleDoc" type="interop:ArrayOfSimpleDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ComplexDocumentResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" maxOccurs="1" name="ComplexDocument" type="interop:ComplexDocument"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+
+ </types>
+
+ <message name="SingleTagSoapIn">
+ <part name="parameters" element="tns:SingleTag"/>
+ </message>
+ <message name="SingleTagSoapOut">
+ <part name="outputDoc" element="tns:SingleTagResponse"/>
+ </message>
+ <message name="SimpleDocumentSoapIn">
+ <part name="parameters" element="tns:SimpleDocument"/>
+ </message>
+ <message name="SimpleDocumentSoapOut">
+ <part name="outputDoc" element="tns:SimpleDocumentResponse"/>
+ </message>
+ <message name="ComplexDocumentSoapIn">
+ <part name="parameters" element="tns:ComplexDocument"/>
+ </message>
+ <message name="ComplexDocumentSoapOut">
+ <part name="outputDoc" element="tns:ComplexDocumentResponse"/>
+ </message>
+
+ <portType name="DocTestPortType">
+
+ <operation name="SingleTag">
+ <input message="tns:SingleTagSoapIn"/>
+ <output message="tns:SingleTagSoapOut"/>
+ </operation>
+ <operation name="SimpleDocument">
+ <input message="tns:SimpleDocumentSoapIn"/>
+ <output message="tns:SimpleDocumentSoapOut"/>
+ </operation>
+ <operation name="ComplexDocument">
+ <input message="tns:ComplexDocumentSoapIn"/>
+ <output message="tns:ComplexDocumentSoapOut"/>
+ </operation>
+
+ </portType>
+
+ <binding name="doc_test_binding" type="tns:DocTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="SingleTag">
+ <soap:operation soapAction="http://soapinterop.org/SingleTag"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="SimpleDocument">
+ <soap:operation soapAction="http://soapinterop.org/SimpleDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+
+ <operation name="ComplexDocument">
+ <soap:operation soapAction="http://soapinterop.org/ComplexDocument"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="interopDocSvc">
+
+ <port name="interopDocPort" binding="tns:doc_test_binding">
+ <soap:address location="http://www.whitemesa.net/interopdoc"/>
+ </port>
+
+ </service>
+
+</definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/META-INF/sca/default.scdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..3fbc73616e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/META-INF/sca/default.scdl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="interop.server">
+
+ <import.sdo location="wsdl/interopdoc.wsdl"/>
+ <!-- import.wsdl wsdlLocation="wsdl/interopdoc.wsdl"/ -->
+
+ <service name="InteropDocService">
+ <!-- interface.wsdl interface="http://soapinterop.org/#wsdl.interface(DocTestPortType)"/ -->
+ <interface.java interface="org.soapinterop.DocTestPortType"/>
+
+ <binding.ws endpoint="http://soapinterop.org/#wsdl.endpoint(interopDocSvc/interopDocPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1"
+ location="wsdl/interopdoc.wsdl"
+ />
+
+ <reference>InteropDocServiceComponent/DocTestPortType</reference>
+ </service>
+
+ <component name="InteropDocServiceComponent">
+ <implementation.java class="org.apache.tuscany.test.interop.server.InteropDocServiceComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..8cf95fb789
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+ <display-name>Tuscany Interop Test Server</display-name>
+
+ <context-param>
+ <param-name>systemScdlPath</param-name>
+ <param-value>/META-INF/sca/webapp.system.scdl</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>applicationScdlPath</param-name>
+ <param-value>/META-INF/sca/default.scdl</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.tuscany.runtime.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <display-name>Tuscany Servlet</display-name>
+ <servlet-class>org.apache.tuscany.runtime.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/t.bat b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/t.bat
new file mode 100755
index 0000000000..f612aabb75
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/interop/services/webserviceInteropDoc/t.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/testing/sca/itest/IntegrationTestHelp.html b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/IntegrationTestHelp.html
new file mode 100644
index 0000000000..66f84f52c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/IntegrationTestHelp.html
@@ -0,0 +1,1293 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+
+ <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+
+ <meta content="text/css" http-equiv="Content-Style-Type">
+
+ <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
+
+ <style media="all" type="text/css">
+@import url("../../../javadoc/css/maven-base.css");
+@import url("../../../javadoc/css/maven-theme.css");
+@import url("../../../javadoc/css/site.css");
+ </style>
+ <link href="../../../javadoc/css/print.css" media="print" rel="stylesheet" type="text/css">
+ <title>IntegrationTestFramework - Getting Started</title>
+
+
+</head>
+
+
+<body>
+
+<div id="bodyColumn">
+<div id="contentBox">
+<div class="section">
+<h2>Itegration Test Framework - Getting started</h2>
+
+<p>This page will describe what is the integration test framework
+and how it can be used to write test cases.</p>
+
+<p>The Integration Test Framework gives the ability for users to
+write
+Function Verification Test Cases, which can then be run on a fully
+integrated tuscany runtime. Some of the features of the Itest plugin
+are auto start and stop of the tuscany runtime, and running the test
+cases within the runtime. </p>
+
+</div>
+
+<div class="section">
+<h2>Writing Test Cases to run on Tuscany StandAlone</h2>
+
+You could have a simple test
+case as is the example with the propertyTest. Here the application is
+simply a jar file that would run on standalone tuscany runtime. In the
+pom.xml file, you can specify the following:<br>
+
+<br>
+
+</div>
+
+<a name="setup JDK 5.0"></a>
+<div class="section">
+<h2><font><font size="-1">&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;tuscany-itest-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;executions&gt;<br>
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(255, 255, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<span style="color: rgb(255, 0, 0);">&lt;execution&gt;</span></span></span><br style="color: rgb(255, 0, 0);">
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;start&lt;/id&gt;</span><br style="color: rgb(255, 0, 0);">
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;</span><br style="color: rgb(255, 0, 0);">
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;start&lt;/goal&gt;</span><br style="color: rgb(255, 0, 0);">
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;</span><br style="color: rgb(255, 0, 0);">
+
+<span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;</span><br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<span style="color: rgb(0, 128, 0);">&lt;execution&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;test&lt;/id&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;test&lt;/goal&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;includes&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;include&gt;**/*ITest.java&lt;/include&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/includes&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;</span><br style="color: rgb(0, 128, 0);">
+
+<span style="color: rgb(0, 128, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;</span><br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;</span><br style="color: rgb(0, 0, 255);">
+
+<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;stop&lt;/id&gt;</span><br style="color: rgb(0, 0, 255);">
+
+<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;</span><br style="color: rgb(0, 0, 255);">
+
+<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;stop&lt;/goal&gt;</span><br style="color: rgb(0, 0, 255);">
+
+<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;</span><br style="color: rgb(0, 0, 255);">
+
+<span style="color: rgb(0, 0, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;</span><br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&lt;/plugin&gt;</font></font></h2>
+
+<br>
+
+In the above, the code marked in red starts up the tuscany runtime.<br>
+
+<br>
+
+And similarly, the&nbsp;code marked in blue stops the tuscany
+runtime after the tests are run<br>
+
+<br>
+
+The code marked in green runs the actual test cases. Notice that it
+does have an &lt;include&gt; filter, to indicate which of the
+tests you
+want to include. Similarly you can have an &lt;exclude&gt;
+filter.<br>
+
+<br>
+
+Also, you should have the following code in order to not run these
+testcases as part of the regular unit tests in case you have other unit
+testcases.<br>
+
+</div>
+
+<div class="section"> <a name="Starting the Server"></a>
+<h2><font><font size="-1">&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;excludes&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;exclude&gt;**/*ITest.java&lt;/exclude&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/excludes&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/plugin&gt;</font></font></h2>
+
+To see the code for the test case, please check the propertyTest module.</div>
+
+<div class="section">
+<h2>Writing Test Cases to test on Apache Tomcat</h2>
+
+<br>
+
+You may have your testSuite containing webApps that need to be
+deployed&nbsp;on tomcat (For example if you have testcases to test
+single or multiple composites). In such a case, you would need to use
+the "Maven Cargo Plugin". More information on the plugin itself can be
+found here: <a href="http://cargo.codehaus.org/Maven2+plugin">Maven
+Cargo Plugin.</a><br>
+
+<br>
+
+This plugin can be used to automatically deploy your webApp on a tomcat
+server, start the server, run the testcases and stop the server. The
+following code illustrates this process.<br>
+
+<br>
+
+The Maven Cargo plugin is defined as such in the pom.xml file:<br>
+
+<br>
+
+<h2><font><font><font><font><font><font><font><font size="-1">&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;<br>
+
+&lt;/plugin&gt;</font></font></font></font></font></font></font></font></h2>
+
+The following code illustrated starting and stopping the container from
+within the cargo plugin. The container is started in a
+"pre-integration-test" phase. This ensures that the container is
+started well before the actual tests are run which is desired. Also,
+the container is stopped in a "post-integration-test" phase, which
+ensures that the container is stopped well after the test cases are run.<br>
+
+<h2><font><font><font><font size="-1">&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&lt;executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;start-container&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;start&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;stop-container&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;post-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;stop&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/executions&gt;</font></font></font></font></h2>
+
+The following code specifies the configuration for the container.
+Firstly the configuration of the container itself is specified, by
+specifying the container ID and home, which in this case is wherever
+tomcat is installed. Next, the configuration to be used within the
+container is specified. This would include the home for the container,
+which is where all the container (tomcat) core files are copied and
+used for the testcases. Also specified, are the webApps which need to
+be deployed on the container during this run.<br>
+
+<br>
+
+<h2><font><font><font><font><font><font><font><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;wait&gt;false&lt;/wait&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;!-- Container configuration --&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;container&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;containerId&gt;tomcat5x&lt;/containerId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;home&gt;${tomcat.dir}&lt;/home&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/container&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;!-- Configuration to use with the container --&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;home&gt;${project.build.directory}/tomcat5x&lt;/home&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;deployables&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;deployable&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingscomposite&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;properties&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;context&gt;/testtool&lt;/context&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/properties&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;pingURL&gt;http://localhost:8080/testtool/services&lt;/pingURL&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/deployable&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;deployable&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingsutility&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;properties&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;context&gt;/testutil&lt;/context&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/properties&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;pingURL&gt;http://localhost:8080/testutil/services&lt;/pingURL&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/deployable&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/deployables&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+</font></font></font></font></font></font></font></font></h2>
+
+In the above code, for each webApp that is deployed, there is a
+&lt;context&gt; property specified, which is the context under
+which
+the webApp is deployed.<br>
+
+<br>
+
+Now the final part of the code below which illustrates the running of
+the testcases using the itest plugin:<br>
+
+<br>
+
+<h2><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font size="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;tuscany-itest-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;start&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;start&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;applicationScdl&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+file:///C:/SDO2/Tuscany/java/testing/sca/itest/bindingsTest/bindingsclient/src/main/resources/META-INF/sca/default.scdl<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/applicationScdl&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;extensions&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.services.databinding&lt;/groupId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;databinding-sdo&lt;/artifactId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.services.bindings&lt;/groupId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;axis2&lt;/artifactId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/extensions&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;test&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;test&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;includes&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;include&gt;**/*ITest.java&lt;/include&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/includes&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;stop&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;stop&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/plugin&gt;<br>
+
+</font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></h2>
+
+Notice in the above code, how the execution &lt;start&gt; and
+&lt;stop&gt; phase for the testcases is defined as
+"pre-integration-test". This is the same phase under which the
+container was started. Hence this ensures that the testcases are run
+after the container is started, and before it is stopped. In the above
+example, we have two composites as webApps being deployed on tomcat.
+Since we have multiple scdl files, with the same name, we need to
+specify the application scdl file which can done using
+&lt;applicationScdl&gt; property. Also, if the testcases
+require some
+extensions, then they can also be specified as indicated above using
+the &lt;extensions&gt; property.<br>
+
+<br>
+
+The final pom file for such a test case should be similar to the one
+given below:
+<h2><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font><font size="-1">&nbsp;&nbsp;&lt;project
+xmlns="http://maven.apache.org/POM/4.0.0"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+http://maven.apache.org/maven-v4_0_0.xsd"&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingsclient&lt;/artifactId&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;packaging&gt;jar&lt;/packaging&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;version&gt;SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp; &lt;name&gt;SCA FVT
+Bindings Test Tool JSP Client&lt;/name&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;properties&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&lt;tomcat.dir&gt;C:/Apache/Tomcat
+5.5&lt;/tomcat.dir&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;/properties&gt;<br>
+
+<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp; &lt;dependencies&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;junit&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;junit&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;version&gt;3.8.1&lt;/version&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;scope&gt;test&lt;/scope&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&lt;groupId&gt;org.osoa&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&lt;artifactId&gt;sca-api-r0.95&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp; &lt;scope&gt;provided&lt;/scope&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/dependency&gt;<br>
+
+&nbsp; &nbsp;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.services.bindings&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;axis2&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&lt;/dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&lt;dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingscomposite&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;version&gt;SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;scope&gt;provided&lt;/scope&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp; &nbsp;&lt;/dependency&gt; <br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&lt;dependency&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingsutility&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;version&gt;SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;scope&gt;provided&lt;/scope&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&lt;/dependency&gt; <br>
+
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&lt;dependency&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;test&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/dependency&gt;<br>
+
+&nbsp;&nbsp; &nbsp;<br>
+
+&nbsp;&nbsp; &nbsp;<br>
+
+&nbsp; &nbsp;&nbsp;&nbsp; &lt;/dependencies&gt;<br>
+
+<br>
+
+<br>
+
+<br>
+
+&nbsp;<br>
+
+&nbsp; &lt;build&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;defaultGoal&gt;install&lt;/defaultGoal&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp; &lt;plugins&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;source&gt;1.5&lt;/source&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;target&gt;1.5&lt;/target&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;showDeprecation&gt;true&lt;/showDeprecation&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;compilerArgument&gt;-Xlint:unchecked,deprecation,fallthrough,finally&lt;/compilerArgument&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/plugin&gt;<br>
+
+&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;start-container&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;start&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;stop-container&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;post-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;stop&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/executions&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;wait&gt;false&lt;/wait&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;!-- Container configuration --&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;container&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;containerId&gt;tomcat5x&lt;/containerId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;home&gt;${tomcat.dir}&lt;/home&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;!-- <br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;zipUrlInstaller&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;url&gt;http://www.orionserver.com/distributions/orion2.0.5.zip&lt;/url&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;installDir&gt;${java.io.tmpdir}/cargoinstalls&lt;/installDir&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/zipUrlInstaller&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+--&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/container&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;!-- Configuration to use with the container --&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;home&gt;${project.build.directory}/tomcat5x&lt;/home&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;deployables&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;deployable&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingscomposite&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;properties&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;context&gt;/testtool&lt;/context&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/properties&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;pingURL&gt;http://localhost:8080/testtool/services&lt;/pingURL&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/deployable&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;deployable&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.testing.bindingstest&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;bindingsutility&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;type&gt;war&lt;/type&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;properties&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;context&gt;/testutil&lt;/context&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/properties&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;pingURL&gt;http://localhost:8080/testutil/services&lt;/pingURL&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/deployable&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/deployables&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/plugin&gt;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;tuscany-itest-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;start&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;start&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;applicationScdl&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+file:///C:/SDO2/Tuscany/java/testing/sca/itest/bindingsTest/bindingsclient/src/main/resources/META-INF/sca/default.scdl<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/applicationScdl&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;extensions&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.services.databinding&lt;/groupId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;databinding-sdo&lt;/artifactId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.tuscany.sca.services.bindings&lt;/groupId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;axis2&lt;/artifactId&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;version&gt;1.0-incubator-SNAPSHOT&lt;/version&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/dependency&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/extensions&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;test&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;test&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;includes&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;include&gt;**/*ITest.java&lt;/include&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/includes&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;execution&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;id&gt;stop&lt;/id&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;phase&gt;pre-integration-test&lt;/phase&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goals&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;goal&gt;stop&lt;/goal&gt;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/goals&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/execution&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/executions&gt;<br>
+
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/plugin&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;plugin&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;configuration&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;excludes&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;exclude&gt;**/*ITest.java&lt;/exclude&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+&lt;/excludes&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+&lt;/configuration&gt;<br>
+
+&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
+&nbsp;&nbsp;&nbsp; &lt;/plugin&gt;<br>
+
+&nbsp;&nbsp;&nbsp; &lt;/plugins&gt;<br>
+
+&nbsp; &lt;/build&gt;<br>
+
+&nbsp;<br>
+
+&lt;/project&gt;</font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></h2>
+
+</div>
+
+<div class="section">
+<h2>Getting Help</h2>
+
+<p>First place to look is at the Tuscany FAQ at <a href="http://incubator.apache.org/tuscany/faq.html" target="_blank">http://incubator.apache.org/tuscany/faq.html</a>
+</p>
+
+<p>Any problem with this release can be reported to the Tuscany <a href="http://incubator.apache.org/tuscany/mail-lists.html" target="_blank">mailing lists</a> or create a JIRA
+issue at&nbsp;<a href="http://issues.apache.org/jira/browse/Tuscany" target="_blank">http://issues.apache.org/jira/browse/Tuscany</a>.</p>
+
+<p></p>
+
+<table class="bodyTable">
+
+ <tbody>
+
+ <tr class="a">
+
+ <td>
+ <p>Thank you for your interest in Tuscany.</p>
+
+ <strong><em>-The Tuscany Development Team</em></strong>
+ <p></p>
+
+ </td>
+
+ </tr>
+
+ </tbody>
+</table>
+
+<p></p>
+
+</div>
+
+</div>
+
+</div>
+
+</body>
+</html>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/pom.xml
new file mode 100644
index 0000000000..f9a72ae54b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingsclient</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool JSP Client</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingscomposite</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingsutility</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..44801846f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.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.sca.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Tool Service
+ */
+
+@Remotable
+public interface SCATestToolService {
+
+ public String doOneHopPing(String input);
+
+ public String doTwoHopPing(String input);
+
+ public String doDataTypeTest(String input);
+
+ public String getCallbackBuffer();
+
+ public void clearCallbackBuffer();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite
new file mode 100644
index 0000000000..ca3ff6494e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2"
+ name="bindingsclient">
+
+ <!--
+ <reference name="SCATestToolSCAReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/>
+ <binding.sca uri="SCATestToolSCAServiceComponent"/>
+ </reference>
+ -->
+
+ <reference name="SCATestToolWSReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService" />
+ <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)"
+ location="wsdl/testtool.wsdl" />
+ </reference>
+
+ <!--
+ <reference name="SCATestToolEJBReference">
+ <interface.java interface="org.apache.tuscany.sca.itest.SCATestToolService"/>
+ <binding.ejb uri="corbaname:iiop:localhost:2811/NameServiceServerRoot#ejb/scabeta1fvt/scatesttool/SCATestToolServiceHome"/>
+ </reference>
+
+ -->
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..22d7070ec3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <element name="doOneHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTest">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTestResponse">
+ <complexType>
+ <sequence>
+ <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="getCallbackBufferResponse">
+ <complexType>
+ <sequence>
+ <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="clearCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="clearCallbackBufferResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="doOneHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="doOneHopPingResponse">
+ <wsdl:part element="tns:doOneHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestResponse">
+ <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferResponse">
+ <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferRequest">
+ <wsdl:part element="tns:getCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingRequest">
+ <wsdl:part element="tns:doTwoHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingResponse">
+ <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferResponse">
+ <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferRequest">
+ <wsdl:part element="tns:clearCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestRequest">
+ <wsdl:part element="tns:doDataTypeTest" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doOneHopPingRequest">
+ <wsdl:part element="tns:doOneHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestToolService">
+ <wsdl:operation name="doOneHopPing">
+ <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" />
+
+ <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" />
+
+ <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" />
+
+ <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" />
+
+ <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" />
+
+ <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="doOneHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doOneHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doOneHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doTwoHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doTwoHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doDataTypeTestRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doDataTypeTestResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="getCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="getCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="clearCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="clearCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestToolService">
+ <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
new file mode 100644
index 0000000000..8c63a8b6eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<%--
+ * SCATestService.java
+ * written by Chris Ortiz
+ * interface class for basic test service
+ * version .1 9/22/2006
+ *
+ *
+ --%>
+
+
+<HTML>
+<HEAD>
+ <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1" session="true" autoFlush="true"
+ isThreadSafe="true" isErrorPage="false"
+ import="org.apache.tuscany.sca.itest.SCATestToolService"
+ import="java.io.PrintWriter"
+ import="java.io.StringWriter"
+ import="org.osoa.sca.CurrentCompositeContext"
+ import="org.osoa.sca.CompositeContext"
+ %>
+ <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <META name="GENERATOR" content="IBM Software Development Platform">
+ <TITLE>SCA FVT Test Service Driver</TITLE>
+</HEAD>
+
+<BODY bgcolor="#c8d8f8">
+<H2>SCA FVT Test Tool Client</H2>
+
+<form action="SCATestTool.jsp" method="get"><HR><BR>Choose Binding type:<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="WS"> WS Binding
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="EJB"> EJB Binding
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="radio" name="bind" value="SCA" checked> Default Binding<BR><BR><HR>
+ <BR>Check Tests to run:<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping First Composite" checked> Ping First Composite
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Ping Second Composite"> Ping Second Composite<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Data Type Test"> Data Type Test<BR><BR>
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async One Way"> Async One Way&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ &nbsp;&nbsp;&nbsp;&nbsp;<INPUT type="checkbox" name="test" value="Async Callback"> Async Call Back<BR><BR>
+
+
+ <BR>
+ <INPUT type="submit" value="Run Test"></FORM>
+<BR>
+
+ <%
+
+ String bindingchoice = request.getParameter("bind");
+ String[] selected = request.getParameterValues("test");
+
+ try {
+ SCATestToolService scaTestTool;
+ if (bindingchoice.equals("WS")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolWSReference");
+ } else if (bindingchoice.equals("EJB")) {
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolEJBReference");
+ } else {
+ // assume default binding
+ CompositeContext compositeContext = CurrentCompositeContext.getContext();
+ scaTestTool = (SCATestToolService) compositeContext.locateService(SCATestToolService.class, "SCATestToolSCAReference");
+ }
+ if (selected != null && selected.length != 0) {
+ for (int i = 0; i < selected.length; i++) {
+ String value = null;
+ if (null != selected[i] && selected[i].equals("Ping First Composite")) {
+ value = scaTestTool.doOneHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Ping Second Composite")){
+ value = scaTestTool.doTwoHopPing("brio");
+ } else if (null != selected[i] && selected[i].equals("Data Type Test")){
+ value = scaTestTool.doDataTypeTest("brio");
+ } else if (null != selected[i] && selected[i].equals("Async One Way")){
+ value = "Ut Oh! Test tool not complete for oneway testing";
+ } else if (null != selected[i] && selected[i].equals("Async Callback")){
+ value = "Ut Oh! Test tool not complete for async testing";
+ } else {
+ value = "Ut Oh! unknown test";
+ }
+
+%>
+
+<HR>
+Results from <%=selected[i]%> test with <%=bindingchoice%> binding:
+<P><%=value%>
+ <%
+ } //for
+ } //if
+
+ }catch(Exception e){
+ e.printStackTrace();
+ StringWriter sw= new StringWriter();
+ PrintWriter pw= new PrintWriter(sw);
+
+ e.printStackTrace(pw);
+ pw.flush();
+
+%>
+ Whoops!<BR clear="all">
+<PRE>
+ Exception &quot;<%=e.getClass().getName()%>&quot; Exception message: &quot;<%=e.getMessage()%>&quot;<BR clear="all">
+ <%=sw.toString() %>
+</PRE>
+<% } //catch
+
+%>
+
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..b25586f096
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>SCA Test Service Driver</display-name>
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>SCATestTool.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java
new file mode 100644
index 0000000000..7429b25dfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServerTest extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.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/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
new file mode 100644
index 0000000000..d14a438ee4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.core.test.SCATestCaseRunner;
+import org.apache.tuscany.sca.util.SCATestUtilityServerTest;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class WSBindingsClientTestCase extends TestCase {
+ private SCATestToolService scaTestTool;
+
+ private SCATestCaseRunner toolServer;
+ private SCATestCaseRunner utilityServer;
+
+ // Hops over one composite
+ /*public void testOneHopPing() throws Throwable {
+ try {
+ assertTrue(scaTestTool.doOneHopPing("brio").contains("brio"));
+ } catch (UndeclaredThrowableException e) {
+ throw (e.getCause());
+ }
+ }*/
+
+ // Hops over two composites
+ public void testTwoHopPing() {
+ assertTrue(scaTestTool.doTwoHopPing("brio").contains("brio"));
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsclient.composite");
+
+ toolServer = new SCATestCaseRunner(SCATestToolServerTest.class);
+ toolServer.setUp();
+ utilityServer = new SCATestCaseRunner(SCATestUtilityServerTest.class);
+ utilityServer.setUp();
+
+ CompositeContext cc = CurrentCompositeContext.getContext();
+ System.out.println("Composite Name = " + cc.getName());
+ System.out.println(CurrentCompositeContext.getContext());
+ scaTestTool =
+ (SCATestToolService)CurrentCompositeContext.getContext().locateService(SCATestToolService.class,
+ "SCATestToolWSReference");
+ if (scaTestTool == null) {
+ System.out.println("Yo Yo It is null");
+ } else {
+ System.out.println("Yo Yo It is not null: " + scaTestTool);
+ }
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ toolServer.tearDown();
+ utilityServer.tearDown();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java
new file mode 100644
index 0000000000..286ff0f4a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java
@@ -0,0 +1,28 @@
+package org.apache.tuscany.sca.util;
+
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.api.SCARuntime;
+
+import junit.framework.TestCase;
+
+public class SCATestUtilityServerTest extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8081);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/pom.xml
new file mode 100644
index 0000000000..3cde0a2f80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingscomposite</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Service Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation -->
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java
new file mode 100644
index 0000000000..efe30c4f4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Random;
+import java.util.Vector;
+
+import org.apache.tuscany.sca.util.SCATestUtilityService;
+
+public class SCADataTypeHelper {
+
+ Date date;
+ Random ran;
+ SCATestUtilityService scaUtil; // change this to be the service provider
+
+ public SCADataTypeHelper(SCATestUtilityService util) {
+ date = new Date();
+ ran = new Random(date.getTime());
+ scaUtil = util;
+ }
+
+ public StringBuffer test_char() throws SCADataTypeHelperException {
+
+ char x = 'a';
+ x += ran.nextInt(26); // get a char a-z
+ StringBuffer rc = new StringBuffer("\nchar datatype test sending ==> " + x);
+ try {
+ char y = scaUtil.echo_char(x);
+ if (x == y) {
+ rc.append("\nchar successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: char ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_char\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_String() throws SCADataTypeHelperException {
+
+ String x = date.toString();
+ StringBuffer rc = new StringBuffer("\nString datatype test sending ==> " + x);
+ try {
+ String y = scaUtil.echo_String(x);
+ if (x.equals(y)) {
+ rc.append("\nString successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: String ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_String\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_int() throws SCADataTypeHelperException {
+
+ int x = ran.nextInt();
+ StringBuffer rc = new StringBuffer("\nint datatype test sending ==> " + x);
+ try {
+ int y = scaUtil.echo_int(x);
+ if (x == y) {
+ rc.append("\nint successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: int ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_int\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_boolean() throws SCADataTypeHelperException {
+
+ boolean x = ran.nextBoolean();
+ StringBuffer rc = new StringBuffer("\nboolean datatype test sending ==> " + x);
+ try {
+ boolean y = scaUtil.echo_boolean(x);
+ if (x == y) {
+ rc.append("\nboolean successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: boolean ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_boolean\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_long() throws SCADataTypeHelperException {
+
+ long x = ran.nextLong();
+ StringBuffer rc = new StringBuffer("\nlong datatype test sending ==> " + x);
+ try {
+ long y = scaUtil.echo_long(x);
+ if (x == y) {
+ rc.append("\nlong successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: long ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_long\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_short() throws SCADataTypeHelperException {
+
+ short x = (short)ran.nextInt();
+ StringBuffer rc = new StringBuffer("\nshort datatype test sending ==> " + x);
+ try {
+ short y = scaUtil.echo_short(x);
+ if (x == y) {
+ rc.append("\nshort successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: short ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_short\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_float() throws SCADataTypeHelperException {
+
+ float x = ran.nextFloat();
+ StringBuffer rc = new StringBuffer("\nfloat datatype test sending ==> " + x);
+ try {
+ float y = scaUtil.echo_float(x);
+ if (x == y) {
+ rc.append("\nfloat successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: float ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_float " + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_double() throws SCADataTypeHelperException {
+
+ double x = ran.nextDouble();
+ StringBuffer rc = new StringBuffer("\ndouble datatype test sending ==> " + x);
+ try {
+ double y = scaUtil.echo_double(x);
+ if (x == y) {
+ rc.append("\ndouble successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException(rc + "\nDatatype exception: double ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_double\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_BigInteger() throws SCADataTypeHelperException {
+
+ BigInteger x = new BigInteger(ran.nextInt(32) + 32, ran); // between
+ // 32 - 64
+ // bitLength
+ StringBuffer rc = new StringBuffer("\nBigInteger datatype test sending ==> " + x);
+ try {
+ BigInteger y = scaUtil.echo_BigInteger(x);
+ if (x.equals(y)) {
+ rc.append("\nBigInteger successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigInteger ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigInteger\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_BigDecimal() throws SCADataTypeHelperException {
+
+ BigDecimal x = new BigDecimal(ran.nextDouble());
+ StringBuffer rc = new StringBuffer("\nBigDecimal datatype test sending ==> " + x);
+ try {
+ BigDecimal y = scaUtil.echo_BigDecimal(x);
+ if (x.equals(y)) {
+ rc.append("\nBigDecimal successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: BigDecimal ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_BigDecimal\n" + e.toString());
+ }
+ return rc;
+ }
+
+ private StringBuffer test_Vector() throws SCADataTypeHelperException {
+
+ Vector vector = new Vector();
+ vector.addElement("DanW");
+ vector.addElement(new Float(2000F));
+ vector.addElement(new Short((short)11));
+ StringBuffer rc = new StringBuffer("\nVector datatype test sending ==> " + vector.toString());
+ boolean passed = true;
+ try {
+ Vector y = scaUtil.echo_Vector(vector);
+ if (((String)y.elementAt(0)).equals("DanW")) {
+ rc.append("\nVector element 0 string " + y.elementAt(0) + " successfully recieved");
+ } else {
+ passed = false;
+ }
+ if ((((Float)y.elementAt(1)).equals((Float)vector.elementAt(1)))) {
+ rc.append("\nVector element 1 Float " + y.elementAt(1) + " successfully recieved");
+ } else {
+ passed = false;
+ }
+ if (y.elementAt(2).equals(vector.elementAt(2))) {
+ rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " successfully received");
+ } else {
+ passed = false;
+ }
+ if (!passed) {
+ //
+ // one of the tests failed
+ //
+ rc.append("\nVector element 0 (String) " + y.elementAt(0) + " should be \"DanW\"");
+ rc.append("\nVector element 1 (Float) " + y.elementAt(1) + " should be \"2000F\"");
+ rc.append("\nVector element 2 (Short) " + y.elementAt(2) + " should be \"11\"");
+ throw new SCADataTypeHelperException("\n" + rc + "\nDataType exception: Vector ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_Vector\n" + e.toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer test_GregorianCalendar() throws SCADataTypeHelperException {
+
+ GregorianCalendar x = new GregorianCalendar();
+ StringBuffer rc = new StringBuffer("\nGregorianCalendar datatype test sending ==> " + x.toString());
+ try {
+ GregorianCalendar y = scaUtil.echo_GregorianCalendar(x);
+ if (x.equals(y)) {
+ rc.append("\nGregorianCalendar successfully received ==> " + y);
+ } else {
+ throw new SCADataTypeHelperException("\n" + rc + "\nDatatype exception: GregorianCalendar ==> " + y);
+ }
+ } catch (Exception e) {
+ throw new SCADataTypeHelperException("\nRemote exception from scaUtil.echo_GregorianCalendar\n" + e
+ .toString());
+ }
+ return rc;
+ }
+
+ public StringBuffer doDataType() {
+
+ StringBuffer rc = new StringBuffer();
+ try {
+ rc.append(test_boolean());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_char());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_String());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_int());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString());
+ }
+ try {
+ rc.append(test_long());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_short());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_float());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_double());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_BigInteger());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_BigDecimal());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_Vector());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+ try {
+ rc.append(test_GregorianCalendar());
+ } catch (SCADataTypeHelperException e) {
+ rc.append("\n" + e.toString() + "\n");
+ } catch (Exception e) {
+ rc.append("\n" + e.toString() + "\n");
+ }
+
+ return rc;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java
new file mode 100644
index 0000000000..074fba8057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.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 org.apache.tuscany.sca.itest;
+
+public class SCADataTypeHelperException extends Exception {
+
+ public SCADataTypeHelperException() {
+ }
+
+ public SCADataTypeHelperException(String msg) {
+ super(msg);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..c55e22c905
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.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.sca.itest;
+
+/**
+ * SCA Test Tool Callback Service
+ */
+public interface SCATestToolCallbackService {
+
+ public void pingCallBack(String reply);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java
new file mode 100644
index 0000000000..290d9a0897
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java
@@ -0,0 +1,28 @@
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServer {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.composite");
+
+ try {
+ System.out.println("SCATestTool server started");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ SCARuntime.stop();
+ System.out.println("SCATestTool server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..67b7e8eb64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.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.sca.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Tool Service
+ */
+
+@Remotable
+public interface SCATestToolService {
+
+ public String doOneHopPing(String input);
+
+ public String doTwoHopPing(String input);
+
+ public String doDataTypeTest(String input);
+
+ public String getCallbackBuffer();
+
+ public void clearCallbackBuffer();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java
new file mode 100644
index 0000000000..e207a23927
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.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.sca.itest;
+
+import org.apache.tuscany.sca.util.SCATestUtilityService;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * SCA Test Service Implementation
+ */
+
+@Service(SCATestToolService.class)
+public class SCATestToolServiceImpl implements SCATestToolService, SCATestToolCallbackService {
+ @Reference
+ public SCATestUtilityService scaTestUtil;
+
+ private String callbackBuffer = null;
+
+ public String doOneHopPing(String input) {
+ System.out.println("Invoking SCATestToolServiceImpl.doOneHopPing()");
+ StringBuffer rc = new StringBuffer();
+ rc.append("doOneHopPing(): ");
+ rc.append(input);
+ return rc.toString();
+ }
+
+ public String doTwoHopPing(String input) {
+ System.out.println("Invoking SCATestToolServiceImpl.doTwoHopPing()");
+ StringBuffer rc = new StringBuffer();
+ rc.append("doTwoHopPing(): ");
+ rc.append(input);
+ rc.append(" --> ");
+ rc.append(scaTestUtil.ping(input));
+ return rc.toString();
+ }
+
+ public String doDataTypeTest(String input) {
+ StringBuffer rc = new StringBuffer();
+ rc.append("doDataTypeTest(): ");
+ rc.append(input);
+ rc.append(" --> ");
+ SCADataTypeHelper dataHelper = new SCADataTypeHelper(scaTestUtil);
+ rc.append(dataHelper.doDataType());
+ return rc.toString();
+ }
+
+ public void pingCallBack(String reply) {
+ callbackBuffer = reply;
+ }
+
+ public String getCallbackBuffer() {
+ return callbackBuffer;
+ }
+
+ public void clearCallbackBuffer() {
+ callbackBuffer = null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.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.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Vector;
+import java.util.GregorianCalendar;
+
+import org.apache.tuscany.sca.itest.SCATestToolCallbackService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Utility Service
+ */
+
+@Remotable
+public interface SCATestUtilityService {
+ public String ping(String input);
+
+ @Callback(SCATestToolCallbackService.class)
+ public void asyncping();
+
+ public int echo_int(int input);
+
+ public short echo_short(short input);
+
+ public long echo_long(long input);
+
+ public float echo_float(float input);
+
+ public double echo_double(double input);
+
+ public boolean echo_boolean(boolean input);
+
+ public char echo_char(char input);
+
+ public String echo_String(String input);
+
+ public BigDecimal echo_BigDecimal(BigDecimal input);
+
+ public BigInteger echo_BigInteger(BigInteger input);
+
+ public Vector echo_Vector(Vector input);
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite
new file mode 100644
index 0000000000..c288471c14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+
+ <component name="httpserver">
+ <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ <property name="httpPort">8080</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
new file mode 100644
index 0000000000..b2f1e57e15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="bindingscomposite">
+
+ <dbsdo:import.sdo location="wsdl/testtool.wsdl" />
+ <dbsdo:import.sdo location="wsdl/testutility.wsdl" />
+
+ <service name="SCATestToolWSService">
+ <interface.wsdl interface="http://scatesttool.scabeta1fvt#wsdl.interface(SCATestToolService)"
+ wsdli:wsdlLocation="http://scatesttool.scabeta1fvt wsdl/testtool.wsdl" />
+ <reference>SCATestToolWSServiceComponent</reference>
+ <binding.ws endpoint="http://scatesttool.scabeta1fvt#wsdl.endpoint(SCATestToolService/SCATestToolServiceSoapPort)"
+ location="wsdl/testtool.wsdl" uri="testtool" />
+ </service>
+
+ <component name="SCATestToolWSServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.SCATestToolServiceImpl" />
+ <!--reference name="scaTestUtil">SCATestUtilityWSReference</reference-->
+ </component>
+
+ <reference name="SCATestUtilityWSReference" promote="SCATestToolWSServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.util.SCATestUtilityService" />
+ <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)"
+ location="wsdl/testutility.wsdl" />
+ </reference>
+
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..729593518d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatesttool.scabeta1fvt" xmlns:impl="http://scatesttool.scabeta1fvt"
+ xmlns:tns="http://scatesttool.scabeta1fvt" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testtool">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.scabeta1fvt" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <element name="doOneHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doOneHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doTwoHopPingResponse">
+ <complexType>
+ <sequence>
+ <element name="doTwoHopPingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTest">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="doDataTypeTestResponse">
+ <complexType>
+ <sequence>
+ <element name="doDataTypeTestReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="getCallbackBufferResponse">
+ <complexType>
+ <sequence>
+ <element name="getCallbackBufferReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="clearCallbackBuffer">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="clearCallbackBufferResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="doOneHopPing">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="doOneHopPingResponse">
+ <wsdl:part element="tns:doOneHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestResponse">
+ <wsdl:part element="tns:doDataTypeTestResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferResponse">
+ <wsdl:part element="tns:clearCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferRequest">
+ <wsdl:part element="tns:getCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingRequest">
+ <wsdl:part element="tns:doTwoHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doTwoHopPingResponse">
+ <wsdl:part element="tns:doTwoHopPingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="getCallbackBufferResponse">
+ <wsdl:part element="tns:getCallbackBufferResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="clearCallbackBufferRequest">
+ <wsdl:part element="tns:clearCallbackBuffer" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doDataTypeTestRequest">
+ <wsdl:part element="tns:doDataTypeTest" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="doOneHopPingRequest">
+ <wsdl:part element="tns:doOneHopPing" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestToolService">
+ <wsdl:operation name="doOneHopPing">
+ <wsdl:input message="tns:doOneHopPingRequest" name="doOneHopPingRequest" />
+
+ <wsdl:output message="tns:doOneHopPingResponse" name="doOneHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdl:input message="tns:doTwoHopPingRequest" name="doTwoHopPingRequest" />
+
+ <wsdl:output message="tns:doTwoHopPingResponse" name="doTwoHopPingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdl:input message="tns:doDataTypeTestRequest" name="doDataTypeTestRequest" />
+
+ <wsdl:output message="tns:doDataTypeTestResponse" name="doDataTypeTestResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdl:input message="tns:getCallbackBufferRequest" name="getCallbackBufferRequest" />
+
+ <wsdl:output message="tns:getCallbackBufferResponse" name="getCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdl:input message="tns:clearCallbackBufferRequest" name="clearCallbackBufferRequest" />
+
+ <wsdl:output message="tns:clearCallbackBufferResponse" name="clearCallbackBufferResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestToolServiceSoapBinding" type="tns:SCATestToolService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="doOneHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doOneHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doOneHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doTwoHopPing">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doTwoHopPingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doTwoHopPingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="doDataTypeTest">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="doDataTypeTestRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="doDataTypeTestResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="getCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="getCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="clearCallbackBuffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="clearCallbackBufferRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="clearCallbackBufferResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestToolService">
+ <wsdl:port binding="tns:SCATestToolServiceSoapBinding" name="SCATestToolServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl
@@ -0,0 +1,704 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility">
+ <wsdl:types>
+
+ <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://xml.apache.org/xml-soap" />
+ <element name="pingResponse">
+ <complexType>
+ <sequence>
+ <element name="pingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="asyncping">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="asyncpingResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="echo_int">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_intResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_intReturn" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_short">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_shortResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_shortReturn" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_long">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_longResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_longReturn" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_float">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_floatResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_floatReturn" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_double">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_doubleResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_doubleReturn" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_boolean">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_booleanResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_booleanReturn" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_char">
+ <complexType>
+ <sequence>
+ <element name="input" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_charResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_charReturn" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_String">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_StringResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_StringReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimal">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimalResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigInteger">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigIntegerResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_Vector">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_VectorResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendar">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendarResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ping">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <simpleType name="char">
+ <restriction base="xsd:string">
+ <length value="1" />
+ </restriction>
+ </simpleType>
+ <complexType name="Vector">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="echo_StringRequest">
+ <wsdl:part element="tns:echo_String" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortResponse">
+ <wsdl:part element="tns:echo_shortResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingRequest">
+ <wsdl:part element="tns:asyncping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingResponse">
+ <wsdl:part element="tns:asyncpingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleResponse">
+ <wsdl:part element="tns:echo_doubleResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalResponse">
+ <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortRequest">
+ <wsdl:part element="tns:echo_short" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerRequest">
+ <wsdl:part element="tns:echo_BigInteger" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorRequest">
+ <wsdl:part element="tns:echo_Vector" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingResponse">
+ <wsdl:part element="tns:pingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charResponse">
+ <wsdl:part element="tns:echo_charResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorResponse">
+ <wsdl:part element="tns:echo_VectorResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longRequest">
+ <wsdl:part element="tns:echo_long" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleRequest">
+ <wsdl:part element="tns:echo_double" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalRequest">
+ <wsdl:part element="tns:echo_BigDecimal" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarRequest">
+ <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatResponse">
+ <wsdl:part element="tns:echo_floatResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanRequest">
+ <wsdl:part element="tns:echo_boolean" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanResponse">
+ <wsdl:part element="tns:echo_booleanResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_StringResponse">
+ <wsdl:part element="tns:echo_StringResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatRequest">
+ <wsdl:part element="tns:echo_float" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarResponse">
+ <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intResponse">
+ <wsdl:part element="tns:echo_intResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longResponse">
+ <wsdl:part element="tns:echo_longResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charRequest">
+ <wsdl:part element="tns:echo_char" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingRequest">
+ <wsdl:part element="tns:ping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intRequest">
+ <wsdl:part element="tns:echo_int" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerResponse">
+ <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestUtilityService">
+ <wsdl:operation name="ping">
+ <wsdl:input message="tns:pingRequest" name="pingRequest" />
+
+ <wsdl:output message="tns:pingResponse" name="pingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" />
+
+ <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" />
+
+ <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" />
+
+ <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" />
+
+ <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" />
+
+ <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" />
+
+ <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" />
+
+ <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" />
+
+ <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" />
+
+ <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" />
+
+ <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" />
+
+ <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" />
+
+ <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" />
+
+ <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="ping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="pingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="pingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="asyncpingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="asyncpingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_intRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_intResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_shortRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_shortResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_longRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_longResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_floatRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_floatResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_doubleRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_doubleResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_booleanRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_booleanResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_charRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_charResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_StringRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_StringResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigDecimalRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigDecimalResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigIntegerRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigIntegerResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_VectorRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_VectorResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_GregorianCalendarRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_GregorianCalendarResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestUtilityService">
+ <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java
new file mode 100644
index 0000000000..53f6c04544
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sca.itest;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestToolServerTestCase extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingscomposite-system.composite", "bindingscomposite.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/testing/sca/itest/bindings/bindingsutility/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/pom.xml
new file mode 100644
index 0000000000..567d90e8ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingsutility</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Utility Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- SDO's XXXHelper.INSTANCE pattern requires the implementation -->
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..664fb06930
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.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.sca.itest;
+
+/**
+ * SCA Test Tool Callback Service
+ */
+
+public interface SCATestToolCallbackService {
+
+ public void pingCallBack(String reply);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java
new file mode 100644
index 0000000000..552454c968
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java
@@ -0,0 +1,28 @@
+package org.apache.tuscany.sca.util;
+
+
+import java.io.IOException;
+
+import org.apache.tuscany.api.SCARuntime;
+
+public class SCATestUtilityServer {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+
+ try {
+ System.out.println("SCATestUtility server started");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ SCARuntime.stop();
+ System.out.println("SCATestUtility server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.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.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Vector;
+import java.util.GregorianCalendar;
+
+import org.apache.tuscany.sca.itest.SCATestToolCallbackService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * SCA Test Utility Service
+ */
+
+@Remotable
+public interface SCATestUtilityService {
+ public String ping(String input);
+
+ @Callback(SCATestToolCallbackService.class)
+ public void asyncping();
+
+ public int echo_int(int input);
+
+ public short echo_short(short input);
+
+ public long echo_long(long input);
+
+ public float echo_float(float input);
+
+ public double echo_double(double input);
+
+ public boolean echo_boolean(boolean input);
+
+ public char echo_char(char input);
+
+ public String echo_String(String input);
+
+ public BigDecimal echo_BigDecimal(BigDecimal input);
+
+ public BigInteger echo_BigInteger(BigInteger input);
+
+ public Vector echo_Vector(Vector input);
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java
new file mode 100644
index 0000000000..e752e4d6e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.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.sca.util;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.util.GregorianCalendar;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(SCATestUtilityService.class)
+public class SCATestUtilityServiceImpl implements SCATestUtilityService {
+
+ // private SCATestToolCallbackService utilCallBack;
+
+ /**
+ * The setter used by the runtime to set the callback reference
+ *
+ * @param myServiceCallback
+ */
+
+ // @Callback
+ // public void setCallback(SCATestToolCallbackService utilCallBack) {
+ // this.utilCallBack = utilCallBack;
+ // }
+ public String ping(String input) {
+ System.out.println("Invoking SCATestUtilityServiceImpl.ping()");
+ StringBuffer rc = new StringBuffer();
+
+ try {
+ // get a systems property object
+ Properties sp = System.getProperties();
+ rc.append("Pinged SCA Test Utility Service on: ");
+ // get operating system info
+ rc.append(sp.getProperty("os.name"));
+ rc.append(", " + sp.getProperty("os.version"));
+ // get network info
+ rc.append(" - " + InetAddress.getLocalHost().toString());
+ } catch (Exception e) {
+ System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString());
+ e.printStackTrace();
+ }
+ return rc.toString();
+ }
+
+ public void asyncping() {
+
+ StringBuffer rc = new StringBuffer();
+
+ try {
+ // get a systems property object
+ Properties sp = System.getProperties();
+ rc.append("Pinged SCA Test Utility Service on: ");
+ // get operating system info
+ rc.append(sp.getProperty("os.name"));
+ rc.append(", " + sp.getProperty("os.version"));
+ // get network info
+ rc.append(" - " + InetAddress.getLocalHost().toString());
+ } catch (Exception e) {
+ System.out.println("\nException preparing system infomation for ping service reply\n" + e.toString());
+ e.printStackTrace();
+ }
+ // utilCallBack.pingCallBack(rc.toString());
+ }
+
+ public int echo_int(int input) {
+ int local;
+ local = input;
+ return local;
+ }
+
+ public short echo_short(short input) {
+ short local;
+ local = input;
+ return local;
+ }
+
+ public long echo_long(long input) {
+ long local;
+ local = input;
+ return local;
+ }
+
+ public float echo_float(float input) {
+ float local;
+ local = input;
+ return local;
+ }
+
+ public double echo_double(double input) {
+ double local;
+ local = input;
+ return local;
+ }
+
+ public boolean echo_boolean(boolean input) {
+ boolean local;
+ local = input;
+ return local;
+ }
+
+ public char echo_char(char input) {
+ char local;
+ local = input;
+ return local;
+ }
+
+ public String echo_String(String input) {
+ String local;
+ local = input;
+ return local;
+ }
+
+ public BigDecimal echo_BigDecimal(BigDecimal input) {
+ BigDecimal local;
+ local = input;
+ return local;
+ }
+
+ public BigInteger echo_BigInteger(BigInteger input) {
+ BigInteger local;
+ local = input;
+ return local;
+ }
+
+ public Vector echo_Vector(Vector input) {
+ Vector local;
+ local = input;
+ return local;
+ }
+
+ public GregorianCalendar echo_GregorianCalendar(GregorianCalendar input) {
+ GregorianCalendar local;
+ local = input;
+ return local;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite
new file mode 100644
index 0000000000..7126b78572
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--
+ Tuscany system configuration.
+
+ $Rev$ $Date$
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="system">
+
+ <include name="default-system"
+ scdlResource="META-INF/tuscany/default-system.composite" />
+
+ <component name="httpserver">
+ <t:implementation.system class="org.apache.tuscany.service.jetty.JettyServiceImpl" />
+ <property name="httpPort">8081</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite
new file mode 100644
index 0000000000..6771b72442
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:v="http://www.osoa.org/xmlns/sca/values/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="bindingsutility">
+
+ <dbsdo:import.sdo location="wsdl/testutility.wsdl" />
+
+ <service name="SCATestUtilityWSService">
+ <interface.wsdl interface="http://scatestutil.scabeta1fvt#wsdl.interface(SCATestUtilityService)"
+ wsdli:wsdlLocation="http://scatestutil.scabeta1fvt wsdl/testutility.wsdl" />
+ <reference>SCATestUtilityWSServiceComponent</reference>
+ <binding.ws endpoint="http://scatestutil.scabeta1fvt#wsdl.endpoint(SCATestUtilityService/SCATestUtilityServiceSoapPort)"
+ location="wsdl/testutility.wsdl" uri="testutil" />
+ </service>
+
+ <component name="SCATestUtilityWSServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.util.SCATestUtilityServiceImpl" />
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl
@@ -0,0 +1,704 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://scatestutil.scabeta1fvt" xmlns:impl="http://scatestutil.scabeta1fvt"
+ xmlns:tns="http://scatestutil.scabeta1fvt" xmlns:tns2="http://xml.apache.org/xml-soap" xmlns:tns3="http://util.java"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testutility">
+ <wsdl:types>
+
+ <schema elementFormDefault="qualified" targetNamespace="http://scatestutil.scabeta1fvt"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://xml.apache.org/xml-soap"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://xml.apache.org/xml-soap" />
+ <element name="pingResponse">
+ <complexType>
+ <sequence>
+ <element name="pingReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="asyncping">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="asyncpingResponse">
+ <complexType>
+ <sequence />
+ </complexType>
+ </element>
+ <element name="echo_int">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_intResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_intReturn" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_short">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_shortResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_shortReturn" type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_long">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_longResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_longReturn" type="xsd:long" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_float">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_floatResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_floatReturn" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_double">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_doubleResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_doubleReturn" type="xsd:double" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_boolean">
+ <complexType>
+ <sequence>
+ <element name="input" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_booleanResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_booleanReturn" type="xsd:boolean" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_char">
+ <complexType>
+ <sequence>
+ <element name="input" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_charResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_charReturn" type="tns2:char" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_String">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_StringResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_StringReturn" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimal">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigDecimalResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigDecimalReturn" minOccurs="0" type="xsd:decimal" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigInteger">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_BigIntegerResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_BigIntegerReturn" minOccurs="0" type="xsd:integer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_Vector">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_VectorResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_VectorReturn" minOccurs="0" type="tns2:Vector" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendar">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echo_GregorianCalendarResponse">
+ <complexType>
+ <sequence>
+ <element name="echo_GregorianCalendarReturn" minOccurs="0" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ping">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <simpleType name="char">
+ <restriction base="xsd:string">
+ <length value="1" />
+ </restriction>
+ </simpleType>
+ <complexType name="Vector">
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType" />
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="echo_StringRequest">
+ <wsdl:part element="tns:echo_String" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortResponse">
+ <wsdl:part element="tns:echo_shortResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingRequest">
+ <wsdl:part element="tns:asyncping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="asyncpingResponse">
+ <wsdl:part element="tns:asyncpingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleResponse">
+ <wsdl:part element="tns:echo_doubleResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalResponse">
+ <wsdl:part element="tns:echo_BigDecimalResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_shortRequest">
+ <wsdl:part element="tns:echo_short" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerRequest">
+ <wsdl:part element="tns:echo_BigInteger" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorRequest">
+ <wsdl:part element="tns:echo_Vector" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingResponse">
+ <wsdl:part element="tns:pingResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charResponse">
+ <wsdl:part element="tns:echo_charResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_VectorResponse">
+ <wsdl:part element="tns:echo_VectorResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longRequest">
+ <wsdl:part element="tns:echo_long" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_doubleRequest">
+ <wsdl:part element="tns:echo_double" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigDecimalRequest">
+ <wsdl:part element="tns:echo_BigDecimal" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarRequest">
+ <wsdl:part element="tns:echo_GregorianCalendar" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatResponse">
+ <wsdl:part element="tns:echo_floatResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanRequest">
+ <wsdl:part element="tns:echo_boolean" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_booleanResponse">
+ <wsdl:part element="tns:echo_booleanResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_StringResponse">
+ <wsdl:part element="tns:echo_StringResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_floatRequest">
+ <wsdl:part element="tns:echo_float" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_GregorianCalendarResponse">
+ <wsdl:part element="tns:echo_GregorianCalendarResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intResponse">
+ <wsdl:part element="tns:echo_intResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_longResponse">
+ <wsdl:part element="tns:echo_longResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_charRequest">
+ <wsdl:part element="tns:echo_char" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="pingRequest">
+ <wsdl:part element="tns:ping" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_intRequest">
+ <wsdl:part element="tns:echo_int" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:message name="echo_BigIntegerResponse">
+ <wsdl:part element="tns:echo_BigIntegerResponse" name="parameters" />
+
+ </wsdl:message>
+
+ <wsdl:portType name="SCATestUtilityService">
+ <wsdl:operation name="ping">
+ <wsdl:input message="tns:pingRequest" name="pingRequest" />
+
+ <wsdl:output message="tns:pingResponse" name="pingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdl:input message="tns:asyncpingRequest" name="asyncpingRequest" />
+
+ <wsdl:output message="tns:asyncpingResponse" name="asyncpingResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdl:input message="tns:echo_intRequest" name="echo_intRequest" />
+
+ <wsdl:output message="tns:echo_intResponse" name="echo_intResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdl:input message="tns:echo_shortRequest" name="echo_shortRequest" />
+
+ <wsdl:output message="tns:echo_shortResponse" name="echo_shortResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdl:input message="tns:echo_longRequest" name="echo_longRequest" />
+
+ <wsdl:output message="tns:echo_longResponse" name="echo_longResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdl:input message="tns:echo_floatRequest" name="echo_floatRequest" />
+
+ <wsdl:output message="tns:echo_floatResponse" name="echo_floatResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdl:input message="tns:echo_doubleRequest" name="echo_doubleRequest" />
+
+ <wsdl:output message="tns:echo_doubleResponse" name="echo_doubleResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdl:input message="tns:echo_booleanRequest" name="echo_booleanRequest" />
+
+ <wsdl:output message="tns:echo_booleanResponse" name="echo_booleanResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdl:input message="tns:echo_charRequest" name="echo_charRequest" />
+
+ <wsdl:output message="tns:echo_charResponse" name="echo_charResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdl:input message="tns:echo_StringRequest" name="echo_StringRequest" />
+
+ <wsdl:output message="tns:echo_StringResponse" name="echo_StringResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdl:input message="tns:echo_BigDecimalRequest" name="echo_BigDecimalRequest" />
+
+ <wsdl:output message="tns:echo_BigDecimalResponse" name="echo_BigDecimalResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdl:input message="tns:echo_BigIntegerRequest" name="echo_BigIntegerRequest" />
+
+ <wsdl:output message="tns:echo_BigIntegerResponse" name="echo_BigIntegerResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdl:input message="tns:echo_VectorRequest" name="echo_VectorRequest" />
+
+ <wsdl:output message="tns:echo_VectorResponse" name="echo_VectorResponse" />
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdl:input message="tns:echo_GregorianCalendarRequest" name="echo_GregorianCalendarRequest" />
+
+ <wsdl:output message="tns:echo_GregorianCalendarResponse" name="echo_GregorianCalendarResponse" />
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SCATestUtilityServiceSoapBinding" type="tns:SCATestUtilityService">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="ping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="pingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="pingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="asyncping">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="asyncpingRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="asyncpingResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_int">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_intRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_intResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_short">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_shortRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_shortResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_long">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_longRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_longResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_float">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_floatRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_floatResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_double">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_doubleRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_doubleResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_boolean">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_booleanRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_booleanResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_char">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_charRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_charResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_String">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_StringRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_StringResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigDecimal">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigDecimalRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigDecimalResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_BigInteger">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_BigIntegerRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_BigIntegerResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_Vector">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_VectorRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_VectorResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echo_GregorianCalendar">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="echo_GregorianCalendarRequest">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:input>
+
+ <wsdl:output name="echo_GregorianCalendarResponse">
+ <wsdlsoap:body use="literal" />
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SCATestUtilityService">
+ <wsdl:port binding="tns:SCATestUtilityServiceSoapBinding" name="SCATestUtilityServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8081/services/SCATestUtilityWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java
new file mode 100644
index 0000000000..4f1b0bfc3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sca.util;
+
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.api.SCARuntime;
+
+import junit.framework.TestCase;
+
+public class SCATestUtilityServerTestCase extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("bindingsutility-system.composite", "bindingsutility.composite");
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8081);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/pom.xml
new file mode 100644
index 0000000000..6d78f23c0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/bindings/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <version>${testing.version}</version>
+ <artifactId>bindingstest</artifactId>
+ <packaging>pom</packaging>
+ <name>SCA FVT Test Tool Suite</name>
+
+
+ <modules>
+ <module>bindingscomposite</module>
+ <module>bindingsutility</module>
+ <module>bindingsclient</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/pom.xml
new file mode 100644
index 0000000000..f556aec1e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-callback-api</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback API</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
new file mode 100644
index 0000000000..56e7ba7b3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackApiCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
new file mode 100644
index 0000000000..3e7c840e15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackApiClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
new file mode 100644
index 0000000000..72b56bafea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.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.sca.test;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import junit.framework.Assert;
+
+@Service(CallBackApiClient.class)
+public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack {
+
+ @Reference
+ protected CallBackApiService aCallBackService;
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public void run() {
+
+ // This tests basic callback patterns.
+
+ // Test3a is the basic callback where the target calls back prior to
+ // returning to the client.
+ test3a();
+
+ // Test3b is where the target does not call back to the client.
+ test3b();
+
+ // Test3c is where the target calls back multiple times to the client.
+ test3c();
+
+ return;
+ }
+
+ private void test3a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test3b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
+ return;
+ }
+
+ private void test3c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
new file mode 100644
index 0000000000..51d9f24723
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackApiCallBack.class)
+/**
+ *
+ */
+public interface CallBackApiService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
new file mode 100644
index 0000000000..7cb0f1553e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.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.sca.test;
+
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+
+@Service(CallBackApiService.class)
+public class CallBackApiServiceImpl implements CallBackApiService {
+
+ @Context
+ protected CompositeContext compositeContext;
+ protected CallBackApiCallBack callback;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callback = this.getCallBackInterface();
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ callback = this.getCallBackInterface();
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackApiServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackApiServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+
+ return;
+
+ }
+
+ private CallBackApiCallBack getCallBackInterface() {
+ System.out.println("CallBackApiServiceImpl getting request context");
+ RequestContext rc = compositeContext.getRequestContext();
+ System.out.println("CallBackApiServiceImpl getting callback from request context");
+ callback = (CallBackApiCallBack) ((ServiceReference) rc.getServiceReference()).getCallback();
+ System.out.println("CallBackApiServiceImpl returning callback");
+ return callback;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite
new file mode 100644
index 0000000000..c6956eb860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/main/resources/CallBackApiTest.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackApiTest">
+
+ <component name="CallBackApiClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiClientImpl"/>
+ <reference target="CallBackApiService" name="aCallBackService">
+ CallBackApiService
+ </reference>
+ </component>
+
+ <component name="CallBackApiService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java
new file mode 100644
index 0000000000..d28c67fcf2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackApiTest extends TestCase {
+
+ private CallBackApiClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackApiTest.composite");
+
+ aCallBackClient =
+ CurrentCompositeContext.getContext().locateService(CallBackApiClient.class, "CallBackApiClient");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/pom.xml
new file mode 100644
index 0000000000..70c6bf62ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-Callback-Basic</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback Basic</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java
new file mode 100644
index 0000000000..ab1f39c057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackBasicCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java
new file mode 100644
index 0000000000..9f4019f28c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackBasicClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java
new file mode 100644
index 0000000000..73a5320faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import junit.framework.Assert;
+
+@Service(CallBackBasicClient.class)
+public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack {
+
+ @Reference
+ protected CallBackBasicService aCallBackService;
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public void run() {
+
+ // This tests basic callback patterns.
+
+ // Test1 is the basic callback where the target calls back prior to
+ // returning to the client.
+ test1a();
+
+ // Test2 is where the target does not call back to the client.
+ test1b();
+
+ // Test3 is where the target calls back multiple times to the client.
+ test1c();
+
+ return;
+ }
+
+ private void test1a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test1b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackBasicITest - test1b", 1, 1);
+
+ return;
+ }
+
+ private void test1c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java
new file mode 100644
index 0000000000..bd41fa7037
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackBasicCallBack.class)
+/**
+ *
+ */
+public interface CallBackBasicService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java
new file mode 100644
index 0000000000..4ca2dc9af9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackBasicService.class)
+public class CallBackBasicServiceImpl implements CallBackBasicService {
+
+ @Callback
+ protected CallBackBasicCallBack callback;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ // System.out.println("CallBackBasicServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
new file mode 100644
index 0000000000..19263b2dac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackBasicTest">
+
+ <component name="CallBackBasicClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicClientImpl"/>
+ <reference name="aCallBackService" target="CallBackBasicService">
+ CallBackBasicService
+ </reference>
+ </component>
+
+ <component name="CallBackBasicService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java
new file mode 100644
index 0000000000..73da73b6d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java
@@ -0,0 +1,28 @@
+package org.apache.tuscany.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackBasicTestCase extends TestCase {
+
+ private CallBackBasicClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackBasicTest.composite");
+
+ aCallBackClient = CurrentCompositeContext.getContext().locateService(CallBackBasicClient.class, "CallBackBasicClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/pom.xml
new file mode 100644
index 0000000000..d61a83a85c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-callback-complexType</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback CType</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java
new file mode 100644
index 0000000000..70e22f4ef2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackCTypeCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java
new file mode 100644
index 0000000000..739983c277
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackCTypeClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java
new file mode 100644
index 0000000000..a9781a3bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.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.sca.test;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import junit.framework.Assert;
+
+@Service(CallBackCTypeClient.class)
+public class CallBackCTypeClientImpl implements CallBackCTypeClient, CallBackCTypeCallBack {
+
+ @Reference
+ protected CallBackCTypeService aCallBackService;
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public CallBackCTypeClientImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public void run() {
+
+ // This test is the same as the Basic Callback except it uses a
+ // componentType side file.
+ // This test currently fails because the integration test environment
+ // does not properly copy
+ // the componentType files to the target folder. This is documented in
+ // Tuscany-967.
+
+ // Test12a is the basic callback where the target calls back prior to
+ // returning to the client.
+ test12a();
+
+ // Test12b is where the target does not call back to the client.
+ test12b();
+
+ // Test12c is where the target calls back multiple times to the client.
+ test12c();
+
+ return;
+ }
+
+ private void test12a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test12a -", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test12b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackBasicITest - test12b -", 1, 1);
+ return;
+ }
+
+ private void test12c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test12c -", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java
new file mode 100644
index 0000000000..ffbf4f35fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+// @Callback(CallBackCTypeCallBack.class)
+/**
+ *
+ */
+public interface CallBackCTypeService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java
new file mode 100644
index 0000000000..60abf841b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackCTypeService.class)
+public class CallBackCTypeServiceImpl implements CallBackCTypeService {
+
+ @Callback
+ protected CallBackCTypeCallBack callback;
+
+ public CallBackCTypeServiceImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ System.out.println("CallBackCTypeServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/CallBackCTypeClient.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/CallBackCTypeClient.composite
new file mode 100644
index 0000000000..0b771ae874
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/CallBackCTypeClient.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackCTypeTest">
+
+ <component name="CallBackCTypeClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeClientImpl"/>
+ <reference name="aCallBackService">
+ CallBackCTypeService
+ </reference>
+ </component>
+
+ <component name="CallBackCTypeService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType
new file mode 100644
index 0000000000..aca84e8537
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" >
+ <service name="CallBackCTypeService">
+ <interface.java interface="org.apache.tuscany.sca.test.CallBackCTypeService"
+ callbackInterface="org.apache.tuscany.sca.test.CallBackCTypeCallBack"/>
+ </service>
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java
new file mode 100644
index 0000000000..d9e0dea7bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-complexType/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackCTypeTest extends TestCase {
+
+ private CallBackCTypeClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackCTypeClient.composite");
+
+ aCallBackClient =
+ CurrentCompositeContext.getContext().locateService(CallBackCTypeClient.class, "CallBackCTypeClient");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/pom.xml
new file mode 100644
index 0000000000..e647136da8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-Callback-ID</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback ID</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java
new file mode 100644
index 0000000000..e86c7e9ed7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackIdCallBack {
+
+ public void callBackMessage(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java
new file mode 100644
index 0000000000..a9e551f8b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackIdClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java
new file mode 100644
index 0000000000..702e27775b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import junit.framework.Assert;
+
+@Service(CallBackIdClient.class)
+public class CallBackIdClientImpl implements CallBackIdClient, CallBackIdCallBack {
+
+ @Context
+ private CompositeContext compositeContext;
+ @Reference
+ protected CallBackIdService aCallBackService;
+
+ private static String returnMessage = null;
+ private static Object monitor = new Object();
+ private static Object callBackId;
+
+ public void run() {
+
+ // This tests the use of the set/get callbackId API both SCA generated
+ // and client specified.
+
+ // Test1 uses a SCA generated callback ID and compare that with the
+ // callbackID returned during callback.
+ test11a();
+
+ // Test2 uses a Client specified callback ID and compare that with the
+ // callbackID returned during callback.
+ test11b();
+
+ return;
+ }
+
+ private void test11a() {
+
+ // Retrieve this services callback ID and save it. Once the callback is
+ // received the callback ID will be compared with the one
+ // returned. Equal is good.
+
+ Object origCallBackId = ((ServiceReference)aCallBackService).getCallbackID();
+ aCallBackService.knockKnock("Knock Knock - Test1");
+ int count = 0;
+
+ //
+ // If we cannot get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackIdITest - test11a - SCA Generated Id", origCallBackId, this.getCallBackId());
+
+ }
+
+ private void test11b() {
+
+ // Set the services callback ID and save it. Once the callback is
+ // received the callback ID will be compared with the one
+ // returned. Equal is good.
+
+ String origCallBackId = "CallBackId1";
+ ((ServiceReference)aCallBackService).setCallbackID(origCallBackId);
+
+ aCallBackService.knockKnock("Knock Knock - Test2");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert
+ .assertEquals("CallBackIdITest - 11b - Client Specified Id", origCallBackId, (String)this.getCallBackId());
+
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering callback callBackMessage: " + aString);
+ RequestContext rc = compositeContext.getRequestContext();
+ Object callBackId = rc.getServiceReference().getCallbackID();
+
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ this.setCallBackId(callBackId);
+ monitor.notify();
+ }
+ }
+
+ protected Object getCallBackId() {
+ return callBackId;
+ }
+
+ protected void setCallBackId(Object aCallBackId) {
+ callBackId = aCallBackId;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java
new file mode 100644
index 0000000000..18c592a1c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackIdCallBack.class)
+/**
+ *
+ */
+public interface CallBackIdService {
+
+ public void knockKnock(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java
new file mode 100644
index 0000000000..cf0270c407
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.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.sca.test;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackIdService.class)
+public class CallBackIdServiceImpl implements CallBackIdService {
+
+ @Callback
+ protected CallBackIdCallBack callback;
+ @Context
+ protected CompositeContext compositeContext;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackIdServiceImpl message received: " + aString);
+ RequestContext rc = compositeContext.getRequestContext();
+ Object callBackId = rc.getServiceReference().getCallbackID();
+ System.out.println("CallBackIdServiceImpl callbackID: " + callBackId.toString());
+
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackIdServiceImpl response sent");
+ return;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/resources/CallBackIdClient.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/resources/CallBackIdClient.composite
new file mode 100644
index 0000000000..014a604003
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/main/resources/CallBackIdClient.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackIdTest">
+
+ <component name="CallBackIdClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdClientImpl"/>
+ <reference name="aCallBackService">
+ CallBackIdService
+ </reference>
+ </component>
+
+ <component name="CallBackIdService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java
new file mode 100644
index 0000000000..f7cf33fdca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java
@@ -0,0 +1,25 @@
+package org.apache.tuscany.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackIdTest extends TestCase {
+
+ private CallBackIdClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackIdClient.composite");
+
+ aCallBackClient = CurrentCompositeContext.getContext().locateService(CallBackIdClient.class, "CallBackIdClient");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/pom.xml
new file mode 100644
index 0000000000..6daf2271e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-callback-setCallback</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback SetCallback</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java
new file mode 100644
index 0000000000..b352a2f1f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+
+// @Remotable
+@Callback(CallBackSetCallbackCallback.class)
+/**
+ *
+ */
+public interface CallBackSetCalbackService {
+
+ public void knockKnock(String aString);
+
+ public void setCallbackIllegally(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java
new file mode 100644
index 0000000000..766d47c654
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.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.sca.test;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackBadCallback {
+
+ private String anAttribure = null;
+ private int anIntAttribute = 0;
+
+ public CallBackSetCallbackBadCallback() {
+ super();
+ }
+
+ public void callback(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("CallBackSetCallbackBadCallback: callback called");
+ Assert.fail("CallBackSetCallbackBadCallback: callback called");
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java
new file mode 100644
index 0000000000..26a6ecc879
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.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.sca.test;
+
+// @Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackSetCallbackCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java
new file mode 100644
index 0000000000..0a22b0e01f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.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.sca.test;
+
+import java.io.File;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackCallback.class)
+public class CallBackSetCallbackCallbackImpl implements CallBackSetCallbackCallback {
+
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackCallbackImpl callBackMessage: " + aString);
+
+ File aFile = new File("target/test4_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test4_marker marker file");
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ this.incrementCallBackCount();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java
new file mode 100644
index 0000000000..94cb6aa73b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackSetCallbackClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
new file mode 100644
index 0000000000..9fafb05835
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackClient.class)
+public class CallBackSetCallbackClientImpl implements CallBackSetCallbackClient {
+
+ @Reference
+ protected CallBackSetCalbackService aCallBackService;
+ @Reference
+ protected CallBackSetCallbackCallback callBack;
+
+ public void run() {
+
+ // This test various aspects of the setCallback() API in a stateless
+ // scope.
+
+ /*
+ * test4 Client does not implement the callback interface but calls
+ * setCallback with a service reference before invoking the target,
+ * Verify successful executon.
+ */
+
+ test4();
+
+ /*
+ * test5 The client does not implement the callback interface and does
+ * not call setCallback() before invoking the target. Verify a
+ * NoRegisteredCallbackException is thrown.
+ */
+
+ test5();
+
+ /*
+ * test6() The client calls setCallback() with an object that is not a
+ * service reference and the callback interface is stateless. Verify
+ * that an appropriate exception is thrown. When calling setCallback
+ * with an object the interface must be stateful. Stateless interfaces
+ * require a service Reference.
+ */
+
+ test6();
+
+ /*
+ * test10 The target calls setCallback() on its own service reference,
+ * e.g. getRequestContext().getServiceReference().getCallback(). Verify
+ * an appropriate exeception occurs.
+ */
+
+ test10();
+
+ return;
+ }
+
+ private void test4() {
+
+ //
+ // Since callbacks do not synchronously return and this test results in
+ // a callback to a component other
+ // than this client I am using a marker file to determine the outcome.
+ // The presence of the marker
+ // file will be used for the Assertion test. If it exists then the
+ // callback occurred and all is good.
+ //
+
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File("target/test4_marker");
+ if (aFile.exists())
+ aFile.delete();
+
+ ((ServiceReference)aCallBackService).setCallback(callBack);
+
+ aCallBackService.knockKnock("Knock Knock");
+
+ // Lets give the callback a little time to complete....
+
+ int count = 0;
+ long timeout = 1000;
+
+ while (count++ < 30 && (aFile.exists() == false)) {
+ try {
+ Thread.sleep(timeout);
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test4", true, aFile.exists());
+
+ }
+
+ private void test5() {
+
+ boolean correctException = false;
+
+ //
+ // The backend service is expecting a callback reference to be set. This
+ // test will not
+ // set one so an exception is expected. According to the spec if a
+ // client calls a method on
+ // a service reference prior to calling setCallback() then a
+ // NoRegisteredCallbackException
+ // will be thrown on the client.
+ //
+
+ try {
+ aCallBackService.knockKnock("Knock Knock");
+ } catch (NoRegisteredCallbackException NotRegEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test5", true, correctException);
+
+ }
+
+ private void test6() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does impliment
+ // the callback interface. However because this callback service is
+ // stateless the expected
+ // result is an appropriate exception.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackObjectCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (NoRegisteredCallbackException NotRegEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test6", true, correctException);
+
+ }
+
+ private void test10() {
+ //
+ // Since callbacks do not synchronously return and this test results in
+ // a failure on the service
+ // side of the fence I am using a marker file to determine the outcome.
+ // The presence of the marker
+ // file will be used for the Assertion test. If it exists then all is
+ // good.
+ //
+
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File("target/test10_marker");
+ if (aFile.exists())
+ aFile.delete();
+
+ aCallBackService.setCallbackIllegally("Try to set callback on your own service reference");
+
+ Assert.assertEquals("CallBackSetCallback - Test10", true, aFile.exists());
+
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java
new file mode 100644
index 0000000000..afedcdf7f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.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.sca.test;
+
+public class CallBackSetCallbackObjectCallback implements CallBackSetCallbackCallback {
+
+ private int callBackCount = 0;
+
+ public CallBackSetCallbackObjectCallback() {
+ super();
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ this.incrementCallBackCount();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java
new file mode 100644
index 0000000000..6fb13f81b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.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.sca.test;
+
+import java.io.File;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCalbackService.class)
+public class CallBackSetCallbackServiceImpl implements CallBackSetCalbackService {
+
+ @Callback
+ private CallBackSetCallbackCallback callback;
+ @Context
+ private CompositeContext context;
+
+ public void knockKnock(String aString) {
+
+ try {
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ // Context is not working properly so we can't trust that this is
+ // working.....
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ } catch (Exception ex) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + ex.toString());
+ ex.printStackTrace();
+ return;
+ }
+
+ // Ok, call setCallback with my own service reference.
+ try {
+ serviceRef.setCallback(serviceRef);
+ } catch (NullPointerException npe) // This needs to be removed once
+ // appropriate exception is
+ // identified.
+ {
+ // This is not an appropriate exception.
+ System.out.println("Test10 NPE exception during setCallback to own service reference");
+ npe.printStackTrace();
+ return;
+ }
+ // This needs to catch the appropriate exception, once we figure out
+ // what is needs to be!
+ catch (Exception ex) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ }
+ ;
+
+ // If we get the exception we are looking for then create the marker
+ // file.
+ if (exceptionProduced == true) {
+ File aFile = new File("target/test10_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test10_marker marker file");
+ ex.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/resources/CallBackSetCallbackTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/resources/CallBackSetCallbackTest.composite
new file mode 100644
index 0000000000..06910dba27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/main/resources/CallBackSetCallbackTest.composite
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackSetCallbackTest">
+
+ <component name="CallBackSetCallbackClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackClientImpl"/>
+ <reference name="aCallBackService">
+ CallBackSetCallbackService
+ </reference>
+ <reference name="callBack">
+ CallBackSetCallbackCallback
+ </reference>
+ </component>
+
+ <component name="CallBackSetCallbackCallback">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackCallbackImpl"/>
+ </component>
+
+ <component name="CallBackSetCallbackService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java
new file mode 100644
index 0000000000..1df80b5d34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackSetCallbackTest extends TestCase {
+
+ private CallBackSetCallbackClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackSetCallbackTest.composite");
+
+ aCallBackClient =
+ CurrentCompositeContext.getContext().locateService(CallBackSetCallbackClient.class,
+ "CallBackSetCallbackClient");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/pom.xml
new file mode 100644
index 0000000000..453c70aa3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-callback-setCallbackConversation</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Callback SetCallback Conversation</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java
new file mode 100644
index 0000000000..685dd83c62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.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.sca.test;
+
+import java.io.Serializable;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackConvBadCallback implements Serializable {
+
+ public CallBackSetCallbackConvBadCallback() {
+ super();
+ }
+
+ public void callback(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("CallBackSetCallbackBadCallback: callback called");
+ Assert.fail("CallBackSetCallbackConvBadCallback: callback called");
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
new file mode 100644
index 0000000000..7483e834b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.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.sca.test;
+
+// @Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackSetCallbackConvCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java
new file mode 100644
index 0000000000..013424bf5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackSetCallbackConvClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
new file mode 100644
index 0000000000..a62ed43c91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackConvClient.class)
+@Scope("CONVERSATION")
+public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient {
+
+ @Reference
+ protected CallBackSetCallbackConvService aCallBackService;
+ @Reference
+ protected CallBackSetCallbackConvCallback callBack;
+ private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
+ private Object monitor = new Object();
+
+ public void run() {
+
+ // This tests aspects of the setCallback() API within a conversational
+ // scope.
+
+ /*
+ * test7 The client calls setCallback() with an object that is not a
+ * service reference and the callback interface is stateful. Verify
+ * successful execution.
+ */
+ test7();
+
+ /*
+ * test8() The client calls setCallback() with an object that does not
+ * implement the callback interface. Verify an appropriate exception is
+ * thrown. This requires a STATEFUL interface.
+ */
+ test8();
+
+ /*
+ * test9 The client calls setCallback() with an object that is not
+ * serializable. Verify an appropriate exception is thrown. This
+ * requires a STATEFUL callback interface. Move from the stateless test
+ * case.
+ */
+ test9();
+
+ return;
+ }
+
+ private void test7() {
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does implement
+ // the callback interface and is Serializeable. Verify successful
+ // execution.
+ //
+
+ aCallbackObject = new CallBackSetCallbackConvObjectCallback();
+ aCallbackObject.incrementCallBackCount();
+ aCallbackObject.setMonitor(monitor);
+
+ ((ServiceReference)aCallBackService).setCallback(aCallbackObject);
+ aCallBackService.knockKnock("Knock Knock");
+
+ // Lets give the callback a little time to complete....
+
+ int count = 0;
+
+ synchronized (monitor) {
+ while (aCallbackObject.getCount() != 2 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test7", 2, aCallbackObject.getCount());
+
+ }
+
+ private void test8() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does not impliment
+ // the callback interface. The expected result is an appropriate
+ // exception.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvBadCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+
+ //
+ // This should catch an appropriate exception.
+ //
+
+ catch (NoRegisteredCallbackException NotRegEx) // This needs to be
+ // changed to proper
+ // exception once we
+ // know what it is ;-)
+ {
+ correctException = true;
+ }
+
+ catch (Exception ex) {
+ // This means an inappropriate exception occurred
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test8", true, correctException);
+
+ }
+
+ private void test9() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does impliment
+ // the callback interface but does not implement Serializeable. Verify
+ // an appropriate exception
+ // is thrown.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvNonSerCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (NoRegisteredCallbackException NotRegEx) // This needs to be
+ // changed to
+ // appropriate exception
+ // when we know what it
+ // is ;-)
+ {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java
new file mode 100644
index 0000000000..789e04e907
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.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.sca.test;
+
+public class CallBackSetCallbackConvNonSerCallback implements CallBackSetCallbackConvCallback {
+
+ private int callBackCount = 0;
+ private Object monitor;
+
+ public CallBackSetCallbackConvNonSerCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return callBackCount;
+ }
+
+ public void setMonitor(Object anObject) {
+ monitor = anObject;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackConvNonSerCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+
+ System.out.println("Entering callback increment: " + aString);
+
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
new file mode 100644
index 0000000000..fead6705fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.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.sca.test;
+
+import java.io.Serializable;
+
+public class CallBackSetCallbackConvObjectCallback implements CallBackSetCallbackConvCallback, Serializable {
+
+ private int callBackCount = 0;
+ private Object monitor;
+
+ public CallBackSetCallbackConvObjectCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return callBackCount;
+ }
+
+ public void setMonitor(Object anObject) {
+ monitor = anObject;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+
+ System.out.println("Entering callback increment: " + aString);
+
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
new file mode 100644
index 0000000000..d8e8b8ccb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+// @Remotable
+@Callback(CallBackSetCallbackConvCallback.class)
+/**
+ *
+ */
+public interface CallBackSetCallbackConvService {
+
+ public void knockKnock(String aString);
+
+ public void setCallbackIllegally(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
new file mode 100644
index 0000000000..a051277b2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test;
+
+import java.io.File;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackConvService.class)
+@Scope("CONVERSATION")
+public class CallBackSetCallbackConvServiceImpl implements CallBackSetCallbackConvService {
+
+ @Callback
+ private CallBackSetCallbackConvCallback callback;
+ @Context
+ private CompositeContext context;
+
+ public void knockKnock(String aString) {
+
+ try {
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ // Context is not working properly so we can't trust that this is
+ // working.....
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ } catch (Exception ex) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + ex.toString());
+ ex.printStackTrace();
+ return;
+ }
+
+ // Ok, call setCallback with my own service reference.
+ try {
+ serviceRef.setCallback(serviceRef);
+ } catch (NullPointerException npe) {
+ // This is not an appropriate exception.
+ System.out.println("Test10 NPE exception during setCallback to own service reference");
+ npe.printStackTrace();
+ return;
+ }
+ // This needs to catch the appropriate exception, once we figure out
+ // what is needs to be!
+ catch (Exception ex) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ }
+ ;
+
+ // If we get the exception we are looking for then create the marker
+ // file.
+ if (exceptionProduced == true) {
+ File aFile = new File("target/test10_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test10_marker marker file");
+ ex.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/resources/CallBackSetCallbackConvTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/resources/CallBackSetCallbackConvTest.composite
new file mode 100644
index 0000000000..cfac7d11d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/main/resources/CallBackSetCallbackConvTest.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="CallBackSetCallbackConvTest">
+
+ <component name="CallBackSetCallbackConvClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvClientImpl"/>
+ <reference name="aCallBackService">
+ CallBackSetCallbackConvService
+ </reference>
+ </component>
+
+
+ <component name="CallBackSetCallbackConvService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java
new file mode 100644
index 0000000000..3e62ea5e8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/callback-setCallbackConversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CallBackSetCallbackConvTest extends TestCase {
+
+ private CallBackSetCallbackConvClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CallBackSetCallbackConvTest.composite");
+
+ aCallBackClient =
+ CurrentCompositeContext.getContext().locateService(CallBackSetCallbackConvClient.class,
+ "CallBackSetCallbackConvClient");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml
new file mode 100644
index 0000000000..5da30f99d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-Contribution</artifactId>
+ <version>SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Contribution</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite
new file mode 100644
index 0000000000..2b5153a28a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="ContributionTest">
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java
new file mode 100644
index 0000000000..466ba18c78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.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.sca.test.contribution;
+
+import org.apache.tuscany.core.services.deployment.ContributionDirectoryWatcher;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.test.SCATestCase;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionDirectoryWatcherTestCase extends SCATestCase {
+ @Autowire
+ private ContributionDirectoryWatcher contributionDirectoryWatcher; // NOPMD
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testContributeURL() throws Exception {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
new file mode 100644
index 0000000000..2bd9de672a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.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.sca.test.contribution;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.core.bootstrap.DefaultSCARuntime;
+import org.apache.tuscany.core.util.FileHelper;
+import org.apache.tuscany.host.deployment.ContributionService;
+import org.apache.tuscany.spi.bootstrap.ComponentNames;
+import org.apache.tuscany.spi.model.Contribution;
+import org.apache.tuscany.test.SCATestCase;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceTestCase extends SCATestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String FOLDER_CONTRIBUTION = "/repository/calculator/";
+
+ private ContributionService contributionService;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.contributionService = (ContributionService) ((DefaultSCARuntime)SCARuntime.getInstance()).getSystemService(ComponentNames.TUSCANY_CONTRIBUTION_SERVICE);
+ }
+
+ public void testContributeJAR() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ URI contributionId = contributionService.contribute(contributionLocation, false);
+ assertNotNull(contributionId);
+ }
+
+ public void testStoreContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ URI contributionId = contributionService.contribute(contributionLocation, true);
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = (Contribution) contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(contributionModel.getLocation());
+ assertTrue(contributionFile.exists());
+ }
+
+ public void testStoreDuplicatedContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ URI contributionId1 = contributionService.contribute(contributionLocation, true);
+ assertNotNull(contributionId1);
+ URI contributionId2 = contributionService.contribute(contributionLocation, true);
+ assertNotNull(contributionId2);
+ }
+
+
+// public void testContributeFolder() throws Exception {
+// File rootContributionFolder = new File(FOLDER_CONTRIBUTION);
+//
+// URI contributionURI = contributionService.contribute(rootContributionFolder.toURL(), false);
+// assertNotNull(contributionURI);
+// }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/pom.xml
new file mode 100644
index 0000000000..0fa482dcae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-conversations</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA conversations</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java
new file mode 100644
index 0000000000..f8256e6446
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java
@@ -0,0 +1,18 @@
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.ServiceReference;
+
+@Remotable
+
+/**
+ *
+ */
+public interface AnotherService {
+
+ public void setService(ServiceReference aServiceReference);
+ public void add(int anInt);
+ public int getCount();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java
new file mode 100644
index 0000000000..184ff20727
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java
@@ -0,0 +1,59 @@
+package org.apache.tuscany.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import java.io.File;
+import org.apache.tuscany.sca.test.ConversationsClient;
+
+@Service(AnotherService.class)
+@Scope("CONVERSATION")
+
+public class AnotherServiceImpl implements AnotherService {
+
+ // This is a simple pass-thru service used to test propogation
+ // of ServiceReference and maintenance of Session state.
+
+ private ServiceReference aServiceReference;
+
+ public void add(int anInt) {
+
+ Assert.assertNotNull("AnotherServiceImpl - add ", aServiceReference);
+ ((ConversationsService) aServiceReference).add(anInt);
+
+ }
+
+
+ public void initializeCount() {
+
+ Assert.assertNotNull("AnotherServiceImpl - initializeCount ", aServiceReference);
+ ((ConversationsService) aServiceReference).initializeCount();
+
+ }
+
+
+ public void setService(ServiceReference aRef) {
+
+ Assert.assertNotNull("AnotherServiceImpl - setService ", aRef);
+ aServiceReference = aRef;
+
+ }
+
+
+ public int getCount() {
+
+ Assert.assertNotNull("AnotherServiceImpl - getCount ", aServiceReference);
+ return ((ConversationsService) aServiceReference).getLocalCount();
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java
new file mode 100644
index 0000000000..1aa4089805
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @author lamodeo
+ *
+ */
+public interface ConversationsCallback {
+
+ public void callBackMessage(String aString);
+ public void callBackIncrement(String aString);
+ public void callBackEndSession();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java
new file mode 100644
index 0000000000..1d2ecb4903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java
@@ -0,0 +1,12 @@
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+@Remotable
+public interface ConversationsClient {
+
+ public void run();
+ public int count();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java
new file mode 100644
index 0000000000..b464899922
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java
@@ -0,0 +1,11 @@
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+@Remotable
+public interface ConversationsClient2 {
+ public String getDateTime();
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
new file mode 100644
index 0000000000..5b7165de34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
@@ -0,0 +1,466 @@
+package org.apache.tuscany.sca.test;
+
+import java.io.File;
+import java.text.DateFormat;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces={ConversationsClient.class,ConversationsClient2.class})
+
+
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="10 minutes",
+ singlePrincipal=false)
+
+
+public class ConversationsClientImpl implements ConversationsClient, ConversationsClient2, ConversationsCallback {
+
+ @Reference
+ protected ConversationsService aService;
+ @Reference
+ protected AnotherService anotherService;
+ @Reference
+ protected ConversationsLifeCycleService aLifeCycleService;
+ @Context
+ protected CompositeContext myContext; // This is broken Tuscany-965 defect has been opened.
+ @ConversationID
+ protected String conversationID;
+
+ private Object monitor = new Object();
+ private int count=0;
+ private String message;
+ private String initialState;
+ private int initialCount = 56;
+ private String dateTime;
+ private final static String markerFileName = "target/testConversations_test3_marker";
+
+ public void run() {
+
+ // This tests various aspects of session lifecycle and maintenance of session state.
+ // None of these test are working due to various issues.
+
+ /* test0()
+ This test verifies annotations and API's for ConversationID.
+ */
+ test0(); // - Tuscany-1001.
+
+ /* test1()
+ Test stateful callbacks. Verify that the client�s state is maintained throughout the execution of
+ all callback methods.
+ */
+ test1(); // This test is working for MODULE scope. Cant claim succcess because it needs Conversation scope.
+
+ /* test2()
+ Test each method of starting a session. Test @Init.
+ */
+ test2(); // Tuscany-965, Tuscany-1001
+
+ /* test3()
+ Test each method of ending a session. Test @Destroy.
+ */
+ test3(); // Tuscany-965, Tuscany-1001
+
+ /* test4()
+ Pass an existing service reference with an active session to another service. Verify the session is maintained
+ */
+ test4(); // Tuscany-964, Tuscant-1001
+
+ /* test5()
+ Call the createServiceReferenceForSession() API to get a service reference for the active session.
+ Pass the service reference to another service. Verify the session is maintained.
+ */
+ test5();
+
+ /* test6()
+ * Allow a session to timeout.
+ */
+ test6(); // Tuscany-965, Tuscany-1001
+
+
+ return;
+ }
+
+ private void test0()
+ {
+
+ // Verify that conversationID was injected.
+ Assert.assertNotNull("test0 - conversationID injected", conversationID);
+ System.out.println("ConversationID: " + conversationID);
+
+ //
+ // The client may access the ConversationID by calling getConversationID on a Service Reference.
+ // This also verifies a session was created during injection of this Service Reference.
+ //
+ //FIXME Port to the 1.0 spec API
+ //Object aServicesSessionID =((ServiceReference)aService).getSessionID();
+ //Assert.assertNotNull("test0 - ConversationID from service reference", aServicesSessionID);
+
+ //FIXME Port to the 1.0 spec API
+ //Object aLifeCycleServicesSessionID =((ServiceReference)aLifeCycleService).getSessionID();
+ //Assert.assertNotNull("test0 - ConversationID from LifeCycleService service reference", aLifeCycleServicesSessionID);
+
+ // This will verify the @Init() is working for a session created during injection. See test2().
+ aLifeCycleService.knockKnock("Hello");
+
+ }
+
+ private void test1()
+ {
+
+ //
+ // This test verifies that the state of the client is preserved across method calls. Each
+ // call to the service results in 2 callbacks. One to increment a count and the other to set a string.
+ // At the end of the test the count should equal 5 and the string should be set. Also the original strings
+ // values should be preserved.
+ //
+ //
+ initialState = "Initial State";
+
+ int numCalls = 0;
+
+ for(int i=0; i < 10; i++)
+ {
+ aService.knockKnock("Knock Knock " + ++numCalls);
+ }
+
+ // I want to drive multiple callbacks and then give them time to complete. Don't want to
+ // force serialization. After 20 seconds check the assertions.
+
+ synchronized(monitor)
+ {
+ try
+ {
+ monitor.wait(20000L);
+ }
+ catch (Exception ex)
+ {ex.printStackTrace();}
+ }
+
+ // Here we test for the expected state of several different variables. State needs to be maintained
+ // across method calls to the service. If the same client instance is used then the state should match
+ // the following assertions.
+
+ // instance variable count should equal the number of calls to the backend service. count is incremented
+ // during callback processing.
+ Assert.assertEquals("Conversations - Test1 count", numCalls, count);
+ // The returned message should be like the following.
+ Assert.assertEquals("Conversations - Test1 message", true, message.startsWith("Who's There"));
+ // any initial state set prior to running the callbacks should be maintained.
+ Assert.assertEquals("Conversations - Test1 initialState", "Initial State", initialState);
+ Assert.assertEquals("Conversations - Test1 initialCount", 56, initialCount);
+
+ return;
+
+ }
+
+ private void test2()
+ {
+
+ // Verify the various methods to create a new Session.
+ // Sesssions can be started:
+ //
+ // 1) When a service reference is injected into a client. This is verified in test0().
+ // 2) By the client calling newSession() API with and without a ConversationID.
+ //
+ // Verify init() is called prior to any business methods. This is performed in the Service when any
+ // business methos is called.
+
+ myContext = CurrentCompositeContext.getContext();
+ Assert.assertNotNull("current composite context",myContext);
+
+ // This tests creating a conversational session. And that @Init is run prior to business method.
+ ServiceReference aServRef;
+ aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test2 Service Reference 1 not returned", aServRef);
+
+ //FIXME Port to the 1.0 spec API
+ //Get the session ID.
+ //Object aConversationID = aServRef.getSessionID();
+ ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //Create a new session this time specifying a session ID. Verify the seesion id is what was specified.
+ aServRef = myContext.newSession("ConversationsLifeCycleService","Test2-12345");
+ Assert.assertNotNull("Conversations - Test2 Service Reference 2 not returned", aServRef);
+ //FIXME Port to the 1.0 spec API
+ //Get the session ID.
+ //Object aConversationID2 = aServRef.getSessionID();
+ //Assert.assertEquals("Conversations - Test2 Session not created with specified ConversationID", "Test2-12345", aConversationID2);
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //FIXME Port to the 1.0 spec API
+ //Assert.assertNotSame("Conversations - Test2 sessions are not different", aConversationID, aConversationID2);
+
+ }
+
+ private void test3()
+ {
+
+ // Note: The @EndSesion and @EndsConversation anotations are not implemented.
+ // So #1 an #2 cannot be done.
+
+ //
+ // Verify the various methods to end a session.
+ // Sesssions can be ended:
+ //
+ // 1) Server operation annotated with @EndsConversation.
+ // 2) Server operation calls an @EndSession annotated callback method.
+ // 3) Servers conversation lifetime times out. This is test6() so its not implimented in the test3 method.
+ // 4) The client calls ServiceReference.endSession();
+ //
+ // Verify @Destroy annotated method get called after completion of the business
+ // method that called the endSession.
+ //
+
+ ConversationsLifeCycleService aConversationsLifeCycleService;
+ Object aConversationID;
+ myContext = CurrentCompositeContext.getContext();
+ Assert.assertNotNull("current composite context",myContext);
+ ServiceReference aServRef;
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #1 - Cannot be done annotation not implimented yet. 12/15/2006
+ //
+
+ aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test3-1 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-1 ConversationID not found", aConversationID);
+
+ //Call the business method annotated with @EndsConversation.
+ aConversationsLifeCycleService.endThisSession(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-1 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-1 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #2 - Cannot be done annotation not implimented yet. 12/15/2006
+ //
+
+ aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test3-2 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-2 ConversationID not found", aConversationID);
+
+ //Call the business method that will invoke my @EndSession callback method.
+ aConversationsLifeCycleService.endThisSessionUsingCallback(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-2 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-2 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+
+ //
+ // test3 variation #4 - Client calls endSession()
+ //
+
+ aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test3-4 Service Reference not returned", aServRef);
+
+ aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNotNull("Conversations - Test3-4 ConversationID not found", aConversationID);
+
+ //Call the endSession() API on the Service Reference.
+ //FIXME Port to the 1.0 spec API
+ //aServRef.endSession(); // This should also drive @Destroy method.
+
+ // Verify session has ended. The ConversationID should be null;
+ //FIXME Port to the 1.0 spec API
+ //aConversationID = aServRef.getSessionID();
+ //Assert.assertNull("Conversations - Test3-4 session not null after endSession()", aConversationID);
+
+ // Verify Destroy was run. The baxckend service creates a marker file when @Destroy annotated method is run.
+ Assert.assertEquals("Conversations - Test3-4 @Destroy method not invoked", true, this.isMarkerFilePresent());
+ this.removeMarkerFile();
+ }
+
+ public void test4()
+ {
+
+ //
+ // This test uses the injected active session for the ConversationsService. It starts a conversation
+ // in this method building up state with a counter. It then passes this reference to another backend service adding
+ // additional state. It then returns and adds more state using original service and then performs the Assertions.
+ //
+
+ aService.initializeCount();
+ aService.add(1);
+ anotherService.setService((ServiceReference)aService);
+ anotherService.add(1);
+ anotherService.add(1);
+ aService.add(1);
+ aService.add(1);
+ int count = anotherService.getCount();
+
+ Assert.assertEquals("test4 - ConversationsClientImpl ", 5, count);
+
+ return;
+ }
+
+
+ public void test5()
+ {
+
+ // The first test verifies that the createServiceReferenceForSession(this) API is functioning.
+ // This is done in the backend serviced as it needs a single interface defined. The 2nd test
+ // uses the variant of this API when > 1 interfaces are implemented.
+ //
+ // The 2nd test obtains a service reference for myself and passes that reference to a backend service.
+ // The backend service then invokes the count() method on my service reference. It then returns
+ // the count that it retrieved. The test then asserts that the count returned from the backend
+ // service matches the client services internal state.
+ //
+
+ myContext = CurrentCompositeContext.getContext();
+ Assert.assertNotNull("current composite context",myContext);
+
+ boolean result = aService.createServiceReferenceForSelf();
+ System.out.println("Laa: returned from createServiceReferenceForSelf() " + result);
+ Assert.assertEquals("test5 - createServiceReferenceForSelf",true,result);
+
+ count = 6;
+ int returnCount = 0;
+ ServiceReference myServiceReference = myContext.createServiceReferenceForSession(this,"ConversationsClient2");
+ Assert.assertNotNull("test5 - createServiceReferenceForSession - myContext.createServiceReferenceForSession(this,ConversationsClient);", myServiceReference);
+ returnCount = aService.getCount(myServiceReference);
+
+ Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2)",count,returnCount);
+ String aRemoteDateTime = aService.getDateTime(myServiceReference);
+ Assert.assertEquals("test5 - createServiceReferenceForSession(this,ConversationsClient2 - dateTime)", dateTime, aRemoteDateTime);
+
+ return;
+ }
+
+ public void test6()
+ {
+
+ //
+ // Create a session and allow it to timeout and verify that it did.
+ // Invoking a business method on a service that has timed out should result in
+ // a SessionEndedException.
+ //
+
+ myContext = CurrentCompositeContext.getContext();
+ Assert.assertNotNull("current composite context",myContext);
+
+ // This tests creating a conversational session. This service has a maxAge="5 seconds".
+ ServiceReference aServRef;
+ aServRef = myContext.newSession("ConversationsLifeCycleService");
+ Assert.assertNotNull("Conversations - Test6 Service Reference not returned", aServRef);
+
+ // Run a business method.
+ ConversationsLifeCycleService aConversationsLifeCycleService = (ConversationsLifeCycleService) aServRef;
+ aConversationsLifeCycleService.knockKnock("Hello");
+
+ //
+ // wait 10 seconds so session will time out.
+ //
+ try {
+ Thread.sleep(10000L);
+ }
+ catch (InterruptedException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ // Run a busineess method after timeout period has elapsed.
+ boolean sessionEnded = false;
+ try
+ {
+ aConversationsLifeCycleService.knockKnock("Hello");
+ }
+ catch (ConversationEndedException sex)
+ {
+ sessionEnded = true;
+ }
+
+ Assert.assertEquals("Conversations - Test6 Session did not timeout ", true, sessionEnded);
+
+ return;
+ }
+
+
+ public synchronized void callBackIncrement(String aString) {
+
+ count++;
+ System.out.println("Laa: callBackIncrement invoked on client. count = " + count);
+
+ }
+
+ public synchronized void callBackMessage(String aString) {
+
+ message = aString;
+ System.out.println("Laa: callBackIMessage invoked on client. message = " + message);
+
+ }
+
+ // @EndSession - This is for test3() variation #2.
+ public void callBackEndSession() {
+
+ System.out.println("Laa: callBackEndSession method invoked on client.");
+
+ }
+
+ public int count()
+ {
+ return this.count;
+ }
+
+ public String getDateTime() {
+
+ dateTime = DateFormat.getDateTimeInstance().toString();
+ return dateTime;
+
+ }
+
+ private void removeMarkerFile()
+ {
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File(markerFileName);
+ if (aFile.exists())
+ aFile.delete();
+ }
+
+ private boolean isMarkerFilePresent()
+ {
+ File aFile = new File(markerFileName);
+ return aFile.exists();
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java
new file mode 100644
index 0000000000..744737dacd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java
@@ -0,0 +1,20 @@
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.ServiceReference;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+
+/**
+ *
+ */
+public interface ConversationsLifeCycleService {
+
+ public String knockKnock(String aString);
+ public void endThisSession();
+ public void endThisSessionUsingCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java
new file mode 100644
index 0000000000..61e349abed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java
@@ -0,0 +1,79 @@
+package org.apache.tuscany.sca.test;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationsLifeCycleService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="5 seconds")
+
+// This is a short-lived conversational service.
+
+public class ConversationsLifeCycleServiceImpl implements ConversationsLifeCycleService {
+
+ @Callback
+ protected ConversationsCallback callback;
+
+ private String state = "NOT READY";
+ private final static String markerFileName = "target/testConversations_test3_marker";
+
+
+ public String knockKnock(String aString) {
+
+ // Prior to any business methods being invoked the state must have been set to READY using the @Init.
+ System.out.println("ConversationsLifeCycleServiceImpl.knockKnock - State = " + state);
+ Assert.assertEquals("ConversationsLifeCycleServiceImpl.knockKnock - not in READY state ", "READY", state);
+
+ return "Who's There!";
+ }
+
+ @Init
+ public void init()
+ {
+ state = "READY";
+ System.out.println("ConversationsLifeCycleServiceImpl.init()");
+ }
+
+
+ @Destroy
+ public void destroy()
+ {
+ state = "DESTROYED";
+
+ File aFile = new File(markerFileName);
+ try
+ {
+ aFile.createNewFile();
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Error Creating " + markerFileName);
+ ex.printStackTrace();
+ }
+ System.out.println("ConversationsLifeCycleServiceImpl.destroy()");
+ }
+
+// @EndsConversation
+ public void endThisSession() {
+ //This method will end the current session by annotation.
+ System.out.println("ConversationsLifeCycleServiceImpl.endThisSession()");
+
+ }
+
+ public void endThisSessionUsingCallback() {
+
+ //This method will end the current session by a callback method annotated with @EndSession.
+ callback.callBackEndSession();
+ System.out.println("ConversationsLifeCycleServiceImpl.endThisSessionUsingCallback()");
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java
new file mode 100644
index 0000000000..d631cf91b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java
@@ -0,0 +1,24 @@
+package org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.ServiceReference;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+
+/**
+ *
+ */
+public interface ConversationsService {
+
+ public void knockKnock(String aString);
+ public void add(int anInt);
+ public void initializeCount();
+ public int getCount(ServiceReference aServiceReference);
+ public int getLocalCount();
+ public String getDateTime(ServiceReference aServiceReference);
+ public boolean createServiceReferenceForSelf();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java
new file mode 100644
index 0000000000..d764e79330
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java
@@ -0,0 +1,134 @@
+package org.apache.tuscany.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Scope;
+import java.io.File;
+import org.apache.tuscany.sca.test.ConversationsClient;
+
+@Service(ConversationsService.class)
+@Scope("CONVERSATION")
+
+public class ConversationsServiceImpl implements ConversationsService {
+
+ @Callback
+ // Note injection is not working with a private access modifier.
+ protected ConversationsCallback callback;
+ private int count=0;
+
+ public void knockKnock(String aString) {
+
+ try
+ {
+ count++;
+ //System.out.println("ConversationsServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There " + count);
+ callback.callBackIncrement("Add one please");
+ //System.out.println("ConversationsServiceImpl responses sent");
+ return;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public int getCount(ServiceReference aServiceReference)
+ {
+
+ //
+ // Invoke a method on the service reference and return back the result.
+ //
+
+ int count=0;
+ try
+ {
+ count = ((ConversationsClient) aServiceReference).count();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return count;
+
+ }
+
+ public int getLocalCount()
+ {
+
+ //
+ // Return my localc instance count. This is used for test4.
+ //
+
+ return count;
+
+ }
+
+ public String getDateTime(ServiceReference aServiceReference)
+ {
+
+ //
+ // Invoke a method on the service reference and return back the result.
+ //
+
+ String dateTime;
+ dateTime = ((ConversationsClient2) aServiceReference).getDateTime();
+ return dateTime;
+
+ }
+
+ public void add(int anInt) {
+
+ count +=anInt;
+
+ }
+
+ public void initializeCount() {
+
+ count =0;
+
+ }
+
+ public boolean createServiceReferenceForSelf() {
+
+ // This is done here because we need to test getting a ServiceReference
+ // from a component that implements a single interface. The client in this test
+ // impliments 2 interfaces to test the variant of this that takes interface name as an argumnet.
+
+ boolean aBoolean = false;
+
+ ServiceReference myServiceReference = null;
+ CompositeContext ctx = CurrentCompositeContext.getContext();
+
+ try
+ {
+ myServiceReference = ctx.createServiceReferenceForSession(this);
+ System.out.println("Laa: Created Service Reference for Session:" + myServiceReference);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+
+ if (myServiceReference != null)
+ {
+ aBoolean = true;
+ System.out.println("Laa: Service Reference is not null");
+ }
+
+ return aBoolean;
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/resources/ConversationsTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/resources/ConversationsTest.composite
new file mode 100644
index 0000000000..266cd8b386
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/main/resources/ConversationsTest.composite
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationsTest">
+
+ <component name="ConversationsClient">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsClientImpl"/>
+ <reference name="aService">
+ ConversationsService
+ </reference>
+ <reference name="anotherService">
+ AnotherService
+ </reference>
+ <reference name="aLifeCycleService">
+ ConversationLifeCycleService
+ </reference>
+ </component>
+
+ <component name="ConversationsService">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsServiceImpl"/>
+ </component>
+
+ <component name="AnotherService">
+ <implementation.java class="org.apache.tuscany.sca.test.AnotherServiceImpl"/>
+ </component>
+
+ <component name="ConversationLifeCycleService">
+ <implementation.java class="org.apache.tuscany.sca.test.ConversationsLifeCycleServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java
new file mode 100644
index 0000000000..3fb753cbf7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java
@@ -0,0 +1,27 @@
+package org.apache.tuscany.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class ConversationsTest extends TestCase {
+
+ private ConversationsClient aConversationsClient;
+
+ public void testConversations() {
+ aConversationsClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("ConversationsTest.composite");
+
+ aConversationsClient = CurrentCompositeContext.getContext().locateService(ConversationsClient.class, "ConversationsClient/org.apache.tuscany.sca.test.ConversationsClient");
+
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/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/testing/sca/itest/databindings/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/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/testing/sca/itest/databindings/common/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/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/testing/sca/itest/databindings/common/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/NOTICE.txt
new file mode 100644
index 0000000000..92ca715fbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2007 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/testing/sca/itest/databindings/common/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/pom.xml
new file mode 100644
index 0000000000..6680aafb2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-common</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Common elements of Databindings Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.4</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/generate/generate.xsd</fileName>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
new file mode 100644
index 0000000000..31dfdcfebb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.generate;
+
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.tuscany.generate.GenerateFactory;
+import org.apache.tuscany.generate.GenerateType;
+import org.apache.tuscany.generate.InputFileType;
+import org.apache.tuscany.generate.TemplateType;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * Generates test files based on the information in a configuration files (generate.xml)
+ * and a set of velocity templates. The process is
+ *
+ * for each template
+ * for each file
+ * add a line to pom for code gen
+ * include the factory into the composite
+ * for each type
+ * add client iface method
+ * add client impl method
+ * add service iface method
+ * add service impl method
+ * add test method
+ * add wsdl type and method
+ *
+ * @version $Rev$ $Date$
+ */
+public class Generate {
+
+ /**
+ * Does all the hard work of running the velocity templates against the
+ * the list of types to test. Both the list of templates and the list of
+ * XSD files is held in the configuration file (generate.xsd) which lives in the
+ * resources/generate directory of the project being generated.
+ *
+ * @param projectBuildDir the path to the target dir of the project being generated.
+ */
+ public static void generate(String projectBuildDir) {
+ System.out.println(">> Building project from dir: " + projectBuildDir);
+ FileInputStream fis = null;
+
+ try {
+ // Load the config file into a stream
+ fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml");
+
+ // Load the stream into SDO
+ // We are just using SDO as a conveniet way to parse the XML config file
+ HelperContext scope = SDOUtil.createHelperContext();
+ GenerateFactory.INSTANCE.register(scope);
+ XMLDocument xmlDoc = scope.getXMLHelper().load(fis);
+ GenerateType generateType = (GenerateType)xmlDoc.getRootObject();
+
+ // Get the file list. This is the list of XSD that is passed into the
+ // the velocity templates. Each confiured file holds a list of types
+ // that the velocity templates expand into appropriate methods and method calls
+ List fileList = generateType.getInputFile();
+
+ //Intialise velocity ready to generate the various files
+ Properties p = new Properties();
+ p.setProperty("file.resource.loader.path", projectBuildDir + "/classes/generate");
+ Velocity.init(p);
+ VelocityContext context = new VelocityContext();
+ context.put("fileList", fileList);
+
+ List templateList = generateType.getTemplate();
+
+ // For each velocity template in the template list pass in the XSD file list
+ for ( Object item: templateList){
+ TemplateType template = (TemplateType)item;
+ context.put("template", template);
+ String tmp = template.getTemplateName();
+ String filename = projectBuildDir + "/" + template.getTemplateTargetDir() + "/" + tmp.substring(0,tmp.length() - 3);
+ FileWriter fw = new FileWriter(filename);
+ System.out.println(">> Processing " + template.getTemplateName() + " to " + filename);
+ Velocity.mergeTemplate(template.getTemplateName(), context, fw );
+ fw.flush();
+ fw.close();
+ }
+
+ } catch (Exception e) {
+ System.out.println("Exception : " + e.toString());
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ /**
+ * The mainline
+ *
+ * @param args the target directory where project in which files are being generated
+ */
+ public static void main(String[] args) {
+ Generate gen = new Generate();
+ gen.generate(args[0]);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
new file mode 100644
index 0000000000..742929ec86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import org.apache.tuscany.api.SCARuntime;
+import ${template.getJavaPackage()}.GreeterService;
+
+// Data types
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+import $file.getJavaPackage().$file.getFactory();
+#end
+#end
+
+/**
+ * Automatically generated test case. Calls the greeter client for a number of
+ * bindings and a number of data types.
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+public class DatabindingTestCase extends TestCase {
+
+ private static boolean initalised = false;
+ private GreeterService greeterClient;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ SCARuntime.start("greeter.composite");
+ super.setUp();
+ initalised = true;
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ protected void tearDown() {
+
+ }
+
+ /**
+ * Finds the SCA component that relates to the protocol being tested. This test
+ * always connects locally to the client component but the client component will
+ * connect to the back end component using the appropriate protocol
+ *
+ * @param ext the protcol required
+ */
+ private void setUpClient(String ext) throws Exception {
+ CompositeContext ctx = CurrentCompositeContext.getContext();
+ greeterClient = ctx.locateService(GreeterService.class, ext + "GreeterServiceClient");
+ }
+
+ /**
+ * Invokes the SDO Greet service using web service bindings with SDO payload
+ */
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the SDO Greet service using default bindings with SDO payload
+ */
+ public void testDefaultGreet() throws Exception {
+ setUpClient("Default");
+ greet();
+ }
+
+ /**
+ * A generic method which, regarless of which client is connected, sends out a
+ * series of requrests passing different data types.
+ */
+ public void greet() {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ // test $typeInstance.getTypeName()
+ {
+ $typeInstance.getTypeName() param = null;
+ $typeInstance.getCreateTypeCode()
+ $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param);
+ $typeInstance.getResultComparison()
+ }
+#end
+#end
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
new file mode 100644
index 0000000000..f08d56c55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/GreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
new file mode 100644
index 0000000000..b0e298b823
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The automcatically generated interface to the service that reflects data objects
+ * that are sent to it
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+@Remotable
+public interface GreeterService {
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ /**
+ * Take the provided data object, change it slightly and return it
+ *
+ * @param param the data object to be changed and returned
+ * @return the change data object
+ */
+ $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param);
+#end
+#end
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm
new file mode 100644
index 0000000000..ee73db6152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * GreeterServiceClient
+ */
+@AllowsPassByReference
+public interface GreeterServiceClient {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param);
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
new file mode 100644
index 0000000000..57827d27b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
@@ -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 $template.getJavaPackage();
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+/**
+ * The automcatically generated service that simply forwards data objects on to
+ * the GreeterService and passes back the responses
+ *
+ * @version $Rev: 508831 $ $Date: 2007-02-18 00:12:31 +0000 (Sun, 18 Feb 2007) $
+ */
+@Service(GreeterService.class)
+public class GreeterServiceClientImpl implements GreeterService {
+
+ /**
+ * the reference the the GreeterService that will
+ * change each data object slightly and return it
+ */
+ private GreeterService service;
+
+ @Reference
+ public void setGreeterService(GreeterService service) {
+ this.service = service;
+ }
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.sdodatabinding.GreeterService#greet$typeInstance.getTypeName()($typeInstance.getTypeName() param)
+ */
+ public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) {
+ return service.greet$typeInstance.getTypeName()(param);
+ }
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
new file mode 100644
index 0000000000..1fd7509667
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The automcatically generated service implementation that reflects data objects
+ * that are sent to it
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+@Service(GreeterService.class)
+public class GreeterServiceImpl implements GreeterService {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ /**
+ * Take the provided data object, change it slightly and return it
+ *
+ * @param param the data object to be changed and returned
+ * @return the change data object
+ */
+ public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) {
+ $typeInstance.getModifyTypeCode()
+ return param;
+ }
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/generate.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/generate.xsd
new file mode 100644
index 0000000000..1fabedf55f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/generate.xsd
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/generate"
+ xmlns:tns="http://www.apache.org/tuscany/generate">
+
+ <complexType name="TypeType">
+ <sequence>
+ <element name="TypeName" type="string"/>
+ <element name="CreateTypeCode" type="string"/>
+ <element name="ModifyTypeCode" type="string"/>
+ <element name="ResultComparison" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="InputFileType">
+ <sequence>
+ <element name="FileName" type="string"/>
+ <element name="FilePath" type="string"/>
+ <element name="JavaPackage" type="string"/>
+ <element name="Factory" type="string"/>
+ <element name="Namespace" type="string"/>
+ <element name="Prefix" type="string"/>
+ <element name="Type" type="tns:TypeType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="TemplateType">
+ <sequence>
+ <element name="TemplateName" type="string"/>
+ <element name="TemplateTargetDir" type="string"/>
+ <element name="JavaPackage" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="GenerateType">
+ <sequence>
+ <element name="Template" type="tns:TemplateType" maxOccurs="unbounded"/>
+ <element name="InputFile" type="tns:InputFileType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="Generate" type="tns:GenerateType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/pom.xml.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/pom.xml.vm
new file mode 100644
index 0000000000..01267a1d38
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/generate/pom.xml.vm
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-sdoDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SDO Databindings</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${project.build.directory}/classes/wsdl/Greeter.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage>
+ </configuration>
+ #foreach( $file in $fileList )
+ <configuration>
+ <fileName>${project.build.directory}/classes/$file.getFilePath()/$file.getFileName()</fileName>
+ <javaPackage>$file.getJavaPackage()</javaPackage>
+ </configuration>
+ #end
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/wsdl/Dummy.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/wsdl/Dummy.wsdl
new file mode 100644
index 0000000000..5aa7faaa16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/wsdl/Dummy.wsdl
@@ -0,0 +1,4 @@
+A dummy WSDL file that causes the target/classes/wsdl dir to be created in the generated test project. This is
+required because the test generator must run in the process-resource phase, after generate.xml has been copied
+into target. The generator needs to write out target/classes/wsdl and will fail the directory isn't there. So
+this file just gets unpacked and overwritten.
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xml
new file mode 100644
index 0000000000..fd84119c93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Annotation xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Annotation.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:Annotation>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xsd
new file mode 100644
index 0000000000..911e386f68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Annotation.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <annotation>
+ <appinfo>SDO 2.0.1</appinfo>
+ <documentation>
+ A schema that tests the presence of annotations in schema read by SDO
+ </documentation>
+ </annotation>
+
+ <complexType name="AnnotationComplexType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="Annotation" type="tns:AnnotationComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xml
new file mode 100644
index 0000000000..c20c80b658
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Attribute xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Attribute.xsd ">
+ <AttributeElement Attribute="Attribute"/>
+</tns:Attribute>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xsd
new file mode 100644
index 0000000000..458b38647f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Attribute.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeType">
+ <sequence>
+ </sequence>
+ <attribute name="Attribute" type="string"/>
+ </complexType>
+
+ <element name="Attribute">
+ <complexType>
+ <sequence>
+ <element name="AttributeElement" type="tns:AttributeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml
new file mode 100644
index 0000000000..30e4979dca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeReference xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeReference.xsd ">
+ <AttributeReferenceElement tns:ReferencedAttribute="AttributeReference"/>
+</tns:AttributeReference>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd
new file mode 100644
index 0000000000..5842a8d629
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <attribute name="ReferencedAttribute" type="string"/>
+
+ <complexType name="AttributeReferenceType">
+ <sequence>
+ </sequence>
+ <attribute ref="tns:ReferencedAttribute"/>
+ </complexType>
+
+ <element name="AttributeReference">
+ <complexType>
+ <sequence>
+ <element name="AttributeReferenceElement" type="tns:AttributeReferenceType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml
new file mode 100644
index 0000000000..9552421e2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithDefaultValueElement xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithDefaultValue.xsd ">
+ <AttributeWithDefaultValueElement AttributeWithDefaultValue="AttributeWithDefaultValueDefaultValue"/>
+</tns:AttributeWithDefaultValueElement>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd
new file mode 100644
index 0000000000..c7b9655749
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithDefaultValueType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithDefaultValue" type="string" default="AttributeWithDefaultValueDefaultValue"/>
+ </complexType>
+
+ <element name="AttributeWithDefaultValueElement">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithDefaultValueElement" type="tns:AttributeWithDefaultValueType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml
new file mode 100644
index 0000000000..5e5e7fbd55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithFixedValueType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithFixedValue.xsd ">
+ <AttributeWithFixedValueElement AttributeWithFixedValue="AttributeWithFixedValueFixedValue"/>
+</tns:AttributeWithFixedValueType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd
new file mode 100644
index 0000000000..5c455c2ab5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithFixedValueType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithFixedValue" type="string" fixed="AttributeWithFixedValueFixedValue"/>
+ </complexType>
+
+ <element name="AttributeWithFixedValueType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithFixedValueElement" type="tns:AttributeWithFixedValueType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml
new file mode 100644
index 0000000000..635e851632
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOAliasName.xsd ">
+ <AttributeWithSDOAliasNameElement AttributeWithSDOAliasName="AttributeWithSDOAliasName"/>
+</tns:AttributeWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..004dab4fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOAliasNameType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOAliasName" sdo:aliasName="AttributeWithSDOAliasNameSDOAliasName" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOAliasNameElement" type="tns:AttributeWithSDOAliasNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml
new file mode 100644
index 0000000000..136092951b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDODataType.xsd ">
+ <AttributeWithSDODataTypeTypeElement AttributeWithSDODataType="AttributeWithSDODataType"/>
+</tns:AttributeWithSDODataType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd
new file mode 100644
index 0000000000..796f08e1cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDODataTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDODataType" sdo:dataType="string" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDODataType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDODataTypeTypeElement" type="tns:AttributeWithSDODataTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml
new file mode 100644
index 0000000000..927b94885c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOName.xsd ">
+ <AttributeWithSDONameElement AttributeWithSDOName="AttributeWithSDOName"/>
+</tns:AttributeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd
new file mode 100644
index 0000000000..93f83cd0a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDONameType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOName" sdo:name="AttributeWithSDONameSDOName" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDONameElement" type="tns:AttributeWithSDONameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml
new file mode 100644
index 0000000000..ea7db70595
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDOPropertySDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertySDOOppositePropertyType.xsd ">
+ <AttributeWithSDOPropertySDOOppositePropertyTypeElement AttributeWithSDOPropertySDOOppositePropertyType="idvalue0"/>
+</tns:AttributeWithSDOPropertySDOOppositePropertyType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..c64323e7e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOPropertySDOOppositePropertyTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertySDOOppositePropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:AttributeWithSDOPropertyType"/>
+ </complexType>
+
+ <element name="AttributeWithSDOPropertySDOOppositePropertyType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOPropertySDOOppositePropertyTypeElement" type="tns:AttributeWithSDOPropertySDOOppositePropertyTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..85c7d85fd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertyType.xsd ">
+ <AttributeWithSDOPropertyTypeElement AttributeWithSDOPropertyType="idvalue0"/>
+</tns:AttributeWithSDOPropertyType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..543f276c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOPropertyTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ </complexType>
+
+ <element name="AttributeWithSDOPropertyType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOPropertyTypeElement" type="tns:AttributeWithSDOPropertyTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml
new file mode 100644
index 0000000000..fcd281539b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:AttributeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOString.xsd ">
+ <AttributeWithSDOStringElement AttributeWithSDOString="AttributeWithSDOString"/>
+</tns:AttributeWithSDOString>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd
new file mode 100644
index 0000000000..1610c2b861
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOStringType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOString" type="string" sdo:string="true"/>
+ </complexType>
+
+ <element name="AttributeWithSDOString">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOStringElement" type="tns:AttributeWithSDOStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml
new file mode 100644
index 0000000000..36a0760a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInAnySimpleType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnySimpleType.xsd ">
+ <anySimpleType>anySimpleType</anySimpleType>
+</tns:BuiltInAnySimpleType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd
new file mode 100644
index 0000000000..999b72bb35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnySimpleType">
+ <complexType>
+ <sequence>
+ <element name="anySimpleType" type="anySimpleType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml
new file mode 100644
index 0000000000..5849165fe0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInAnyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyType.xsd ">
+ <anyType xsi:type="anyType"/>
+</tns:BuiltInAnyType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd
new file mode 100644
index 0000000000..71dad561ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnyType">
+ <complexType>
+ <sequence>
+ <element name="anyType" type="anyType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml
new file mode 100644
index 0000000000..8acf9376d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInAnyURI xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyURI.xsd ">
+ <anyURI>http://tempuri.org</anyURI>
+</tns:BuiltInAnyURI>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd
new file mode 100644
index 0000000000..a49987c352
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnyURI">
+ <complexType>
+ <sequence>
+ <element name="anyURI" type="anyURI" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml
new file mode 100644
index 0000000000..a35b6e174a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuildInBase64Binary xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBase64Binary.xsd ">
+ <base64Binary>ABCDEF</base64Binary>
+</tns:BuildInBase64Binary>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd
new file mode 100644
index 0000000000..e1995890f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuildInBase64Binary">
+ <complexType>
+ <sequence>
+ <element name="base64Binary" type="base64Binary" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml
new file mode 100644
index 0000000000..91cfce51b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInBoolean xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBoolean.xsd ">
+ <boolean>true</boolean>
+ <boolean>false</boolean>
+ <boolean>1</boolean>
+ <boolean>0</boolean>
+</tns:BuiltInBoolean>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd
new file mode 100644
index 0000000000..a2f86ba8c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInBoolean">
+ <complexType>
+ <sequence>
+ <element name="boolean" type="boolean" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml
new file mode 100644
index 0000000000..907474cd1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInByte xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInByte.xsd ">
+ <byte>127</byte>
+ <byte>-127</byte>
+</tns:BuiltInByte>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd
new file mode 100644
index 0000000000..a2f6bcfa77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInByte">
+ <complexType>
+ <sequence>
+ <element name="byte" type="byte" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml
new file mode 100644
index 0000000000..c5820e1a2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDate xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDate.xsd ">
+ <date>2001-01-01</date>
+</tns:BuiltInDate>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd
new file mode 100644
index 0000000000..f4d596bfe3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDate">
+ <complexType>
+ <sequence>
+ <element name="date" type="date" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml
new file mode 100644
index 0000000000..0debe2fec5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDateTime xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDateTime.xsd ">
+ <dateTime>2001-12-31T12:00:00</dateTime>
+</tns:BuiltInDateTime>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd
new file mode 100644
index 0000000000..b5bcfdcfd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDateTime">
+ <complexType>
+ <sequence>
+ <element name="dateTime" type="dateTime" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml
new file mode 100644
index 0000000000..7f001254cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDecimal xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDecimal.xsd ">
+ <decimal>-1.23456789</decimal>
+ <decimal>1.23456789</decimal>
+</tns:BuiltInDecimal>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd
new file mode 100644
index 0000000000..8d4d106f59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDecimal">
+ <complexType>
+ <sequence>
+ <element name="decimal" type="decimal" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml
new file mode 100644
index 0000000000..f875b9f94d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDouble xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDouble.xsd ">
+ <double>0.0</double>
+ <double>12.3E-4</double>
+</tns:BuiltInDouble>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd
new file mode 100644
index 0000000000..4c8a39b06c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDouble">
+ <complexType>
+ <sequence>
+ <element name="double" type="double" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml
new file mode 100644
index 0000000000..7d343d6dda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDuration xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDuration.xsd ">
+ <duration>P1D</duration>
+</tns:BuiltInDuration>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd
new file mode 100644
index 0000000000..bb12bc04a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDuration">
+ <complexType>
+ <sequence>
+ <element name="duration" type="duration" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml
new file mode 100644
index 0000000000..7a81f3b0dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInFloat xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInFloat.xsd ">
+ <float>0.0</float>
+</tns:BuiltInFloat>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd
new file mode 100644
index 0000000000..f0e1c21233
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInFloat">
+ <complexType>
+ <sequence>
+ <element name="float" type="float" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml
new file mode 100644
index 0000000000..d35568b3c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInGDay xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGDay.xsd ">
+ <gDay>---01</gDay>
+</tns:BuiltInGDay>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd
new file mode 100644
index 0000000000..92bd9a4b66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGDay">
+ <complexType>
+ <sequence>
+ <element name="gDay" type="gDay" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml
new file mode 100644
index 0000000000..52cdfa8c4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInGMonth xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonth.xsd ">
+ <gMonth>--01--</gMonth>
+</tns:BuiltInGMonth>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd
new file mode 100644
index 0000000000..78d001a585
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGMonth">
+ <complexType>
+ <sequence>
+ <element name="gMonth" type="gMonth" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml
new file mode 100644
index 0000000000..2609a858f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInGMonthDay xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonthDay.xsd ">
+ <gMonthDay>--01-01</gMonthDay>
+</tns:BuiltInGMonthDay>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd
new file mode 100644
index 0000000000..38f6c55059
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGMonthDay">
+ <complexType>
+ <sequence>
+ <element name="gMonthDay" type="gMonthDay" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml
new file mode 100644
index 0000000000..7868a47ca3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInGYear xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYear.xsd ">
+ <gYear>2001</gYear>
+</tns:BuiltInGYear>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd
new file mode 100644
index 0000000000..0d65b124ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGYear">
+ <complexType>
+ <sequence>
+ <element name="gYear" type="gYear" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml
new file mode 100644
index 0000000000..3f5080d49f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInGYearMonth xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYearMonth.xsd ">
+ <gYearMonth>2001-01</gYearMonth>
+</tns:BuiltInGYearMonth>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd
new file mode 100644
index 0000000000..340555dc5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGYearMonth">
+ <complexType>
+ <sequence>
+ <element name="gYearMonth" type="gYearMonth" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml
new file mode 100644
index 0000000000..0deb7af980
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInHexBinary xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInHexBinary.xsd ">
+ <hexBinary>0F00</hexBinary>
+</tns:BuiltInHexBinary>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd
new file mode 100644
index 0000000000..8059fe6da0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInHexBinary">
+ <complexType>
+ <sequence>
+ <element name="hexBinary" type="hexBinary" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml
new file mode 100644
index 0000000000..06c92ce19b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInID xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInID.xsd ">
+ <ID>idvalue0</ID>
+</tns:BuiltInID>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd
new file mode 100644
index 0000000000..7b1f02d1d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInID">
+ <complexType>
+ <sequence>
+ <element name="ID" type="ID" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml
new file mode 100644
index 0000000000..9bc0cefd0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInIDREF xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREF.xsd ">
+ <IDREF>idvalue0</IDREF>
+</tns:BuiltInIDREF>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd
new file mode 100644
index 0000000000..0c207983bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInIDREF">
+ <complexType>
+ <sequence>
+ <element name="IDREF" type="IDREF" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml
new file mode 100644
index 0000000000..f91b602f99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInIDREFS xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREFS.xsd ">
+ <IDREFS>idvalue0</IDREFS>
+</tns:BuiltInIDREFS>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd
new file mode 100644
index 0000000000..b99bf01b73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInIDREFS">
+ <complexType>
+ <sequence>
+ <element name="IDREFS" type="IDREFS" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml
new file mode 100644
index 0000000000..c99698e175
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInInt xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInt.xsd ">
+ <int>-2147483648</int>
+ <int>2147483647</int>
+</tns:BuiltInInt>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd
new file mode 100644
index 0000000000..b5b9b0d1eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInInt">
+ <complexType>
+ <sequence>
+ <element name="int" type="int" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml
new file mode 100644
index 0000000000..80d22ce057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInteger.xsd ">
+ <integer>-2147483648</integer>
+ <integer>2147483647</integer>
+</tns:BuiltInInteger>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd
new file mode 100644
index 0000000000..4902935db5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInInteger">
+ <complexType>
+ <sequence>
+ <element name="integer" type="integer" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml
new file mode 100644
index 0000000000..664bf824b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInLanguage xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLanguage.xsd ">
+ <language>EN</language>
+</tns:BuiltInLanguage>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd
new file mode 100644
index 0000000000..5d3658d224
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInLanguage">
+ <complexType>
+ <sequence>
+ <element name="language" type="language" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml
new file mode 100644
index 0000000000..c5861fa92a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInLong xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLong.xsd ">
+ <long>-9223372036854775808</long>
+ <long>9223372036854775807</long>
+</tns:BuiltInLong>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd
new file mode 100644
index 0000000000..0aa4710057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+<notation name="interop50" public="commonj.sdo"/>
+
+ <element name="BuiltInLong">
+ <complexType>
+ <sequence>
+ <element name="long" type="long" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml
new file mode 100644
index 0000000000..1f95950394
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNCName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNCName.xsd ">
+ <NCName>NCName</NCName>
+</tns:BuiltInNCName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd
new file mode 100644
index 0000000000..6ee9c435db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNCName">
+ <complexType>
+ <sequence>
+ <element name="NCName" type="NCName" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml
new file mode 100644
index 0000000000..0297f1aeb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuildInNMTOKEN xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKEN.xsd ">
+ <NMTOKEN>NMTOKEN</NMTOKEN>
+</tns:BuildInNMTOKEN>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd
new file mode 100644
index 0000000000..56d027bdbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuildInNMTOKEN">
+ <complexType>
+ <sequence>
+ <element name="NMTOKEN" type="NMTOKEN" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml
new file mode 100644
index 0000000000..81ba1069bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNMTOKENS xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKENS.xsd ">
+ <NMTOKENS>NMTOKENS</NMTOKENS>
+</tns:BuiltInNMTOKENS>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd
new file mode 100644
index 0000000000..866ab73024
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNMTOKENS">
+ <complexType>
+ <sequence>
+ <element name="NMTOKENS" type="NMTOKENS" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml
new file mode 100644
index 0000000000..8bb3a08b94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNOTATION xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNOTATION.xsd ">
+ <NOTATION>tns:BuiltInNotationNotation</NOTATION>
+</tns:BuiltInNOTATION>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd
new file mode 100644
index 0000000000..c7c62f812b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <notation name="BuiltInNotationNotation" public="http://cwiki.apache.org/confluence/display/TUSCANY/Home"/>
+
+ <element name="BuiltInNOTATION">
+ <complexType>
+ <sequence>
+ <element name="NOTATION" maxOccurs="unbounded">
+ <simpleType >
+ <restriction base="NOTATION">
+ <enumeration value="tns:BuiltInNotationNotation"/>
+ </restriction>
+ </simpleType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml
new file mode 100644
index 0000000000..8235718c5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInName.xsd ">
+ <Name>Name</Name>
+</tns:BuiltInName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd
new file mode 100644
index 0000000000..36caba2f16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInName">
+ <complexType>
+ <sequence>
+ <element name="Name" type="Name" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml
new file mode 100644
index 0000000000..599c428a44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNegativeInteger.xsd ">
+ <negativeInteger>-1</negativeInteger>
+</tns:BuiltInNegativeInteger>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd
new file mode 100644
index 0000000000..389d5a99f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNegativeInteger">
+ <complexType>
+ <sequence>
+ <element name="negativeInteger" type="negativeInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml
new file mode 100644
index 0000000000..919c4a20ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNonNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonNegativeInteger.xsd ">
+ <nonNegativeInteger>0</nonNegativeInteger>
+</tns:BuiltInNonNegativeInteger>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd
new file mode 100644
index 0000000000..59887078b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNonNegativeInteger">
+ <complexType>
+ <sequence>
+ <element name="nonNegativeInteger" type="nonNegativeInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml
new file mode 100644
index 0000000000..79011f26ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNonPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonPositiveInteger.xsd ">
+ <nonPositiveInteger>-1</nonPositiveInteger>
+</tns:BuiltInNonPositiveInteger>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd
new file mode 100644
index 0000000000..5de7d64d7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNonPositiveInteger">
+ <complexType>
+ <sequence>
+ <element name="nonPositiveInteger" type="nonPositiveInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml
new file mode 100644
index 0000000000..c40be9e18b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInNormalizedString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNormalizedString.xsd ">
+ <normalizedString>normalizedString</normalizedString>
+</tns:BuiltInNormalizedString>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd
new file mode 100644
index 0000000000..d4a78787b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNormalizedString">
+ <complexType>
+ <sequence>
+ <element name="normalizedString" type="normalizedString" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml
new file mode 100644
index 0000000000..c30434de66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInPositiveInteger.xsd ">
+ <positiveInteger>1</positiveInteger>
+</tns:BuiltInPositiveInteger>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd
new file mode 100644
index 0000000000..5381590cd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInPositiveInteger">
+ <complexType>
+ <sequence>
+ <element name="positiveInteger" type="positiveInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml
new file mode 100644
index 0000000000..4cd6ea7e72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInQName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInQName.xsd ">
+ <QName>QName</QName>
+</tns:BuiltInQName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd
new file mode 100644
index 0000000000..e8faf6225b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInQName">
+ <complexType>
+ <sequence>
+ <element name="QName" type="QName" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml
new file mode 100644
index 0000000000..b4375467c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInShort xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInShort.xsd ">
+ <short>-32768</short>
+ <short>32767</short>
+</tns:BuiltInShort>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd
new file mode 100644
index 0000000000..a4f564d9b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInShort">
+ <complexType>
+ <sequence>
+ <element name="short" type="short" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml
new file mode 100644
index 0000000000..d30ab85530
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInString.xsd ">
+ <string>string</string>
+</tns:BuiltInString>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd
new file mode 100644
index 0000000000..8abb34b5a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInString">
+ <complexType>
+ <sequence>
+ <element name="string" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml
new file mode 100644
index 0000000000..7fd9a061ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInTime xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInTime.xsd ">
+ <time>12:00:00</time>
+</tns:BuiltInTime>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd
new file mode 100644
index 0000000000..1615976813
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInTime">
+ <complexType>
+ <sequence>
+ <element name="time" type="time" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml
new file mode 100644
index 0000000000..cd567ba528
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInToken xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInToken.xsd ">
+ <token>token</token>
+</tns:BuiltInToken>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd
new file mode 100644
index 0000000000..0beaac571f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInToken">
+ <complexType>
+ <sequence>
+ <element name="token" type="token" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml
new file mode 100644
index 0000000000..025362defb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedByte xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedByte.xsd ">
+ <unsignedByte>0</unsignedByte>
+ <unsignedByte>255</unsignedByte>
+</tns:BuiltInUnsignedByte>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd
new file mode 100644
index 0000000000..d6d951fe5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedByte">
+ <complexType>
+ <sequence>
+ <element name="unsignedByte" type="unsignedByte" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml
new file mode 100644
index 0000000000..5736a8c121
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedInt xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedInt.xsd ">
+ <unsignedInt>0</unsignedInt>
+ <unsignedInt>4294967295</unsignedInt>
+</tns:BuiltInUnsignedInt>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd
new file mode 100644
index 0000000000..242be1d53b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedInt">
+ <complexType>
+ <sequence>
+ <element name="unsignedInt" type="unsignedInt" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml
new file mode 100644
index 0000000000..d728115a77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedLong xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedLong.xsd ">
+ <unsignedLong>0</unsignedLong>
+ <unsignedLong>18446744073709551615</unsignedLong>
+</tns:BuiltInUnsignedLong>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd
new file mode 100644
index 0000000000..108e3a8619
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedLong">
+ <complexType>
+ <sequence>
+ <element name="unsignedLong" type="unsignedLong" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml
new file mode 100644
index 0000000000..d4ffae5e17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedShort xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedShort.xsd ">
+ <unsignedShort>0</unsignedShort>
+ <unsignedShort>65535</unsignedShort>
+</tns:BuiltInUnsignedShort>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd
new file mode 100644
index 0000000000..5ee5e0229e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedShort">
+ <complexType>
+ <sequence>
+ <element name="unsignedShort" type="unsignedShort" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..3d5aed5aa8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeComplexContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeComplexContentRestrictingComplexType.xsd ">
+ <ComplexTypeComplexContentRestrictingComplexTypeElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeComplexContentRestrictingComplexTypeElement>
+</tns:ComplexTypeComplexContentRestrictingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..e7b80ab11c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/>
+
+ <complexType name="ComplexTypeComplexContentRestrictingComplexTypeType">
+ <complexContent>
+ <restriction base="tns:ComplexTypeExtendingComplexTypeType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeComplexContentRestrictingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeComplexContentRestrictingComplexTypeElement" type="tns:ComplexTypeComplexContentRestrictingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml
new file mode 100644
index 0000000000..2b4fe5594e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeExtendingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingComplexType.xsd ">
+ <ComplexTypeExtendingComplexTypeElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ <SimpleTypeWithNameExtended>SimpleTypeWithNameExtended</SimpleTypeWithNameExtended>
+ </ComplexTypeExtendingComplexTypeElement>
+</tns:ComplexTypeExtendingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd
new file mode 100644
index 0000000000..fc4deb63c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeWithContent.xsd"/>
+
+ <complexType name="ComplexTypeExtendingComplexTypeType">
+ <complexContent>
+ <extension base="tns:ComplexTypeWithContentType">
+ <sequence>
+ <element name="SimpleTypeWithNameExtended" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeExtendingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeExtendingComplexTypeElement" type="tns:ComplexTypeExtendingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml
new file mode 100644
index 0000000000..03570f41d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeExtendingSimpeType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingSimpleType.xsd ">
+ <ComplexTypeExtendingSimpeTypeElement AddedByExtension="">ComplexTypeExtendingSimpeTypeElement</ComplexTypeExtendingSimpeTypeElement>
+</tns:ComplexTypeExtendingSimpeType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd
new file mode 100644
index 0000000000..c754502645
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeExtendingSimpleTypeType">
+ <simpleContent>
+ <extension base="tns:SimpleTypeWithNameType">
+ <attribute name="AddedByExtension" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <element name="ComplexTypeExtendingSimpeType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeExtendingSimpeTypeElement" type="tns:ComplexTypeExtendingSimpleTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..4603793bfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeSimpleContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeSimpleContentRestrictingComplexType.xsd ">
+ <ComplexTypeSimpleContentRestrictingComplexTypeElement AddedByExtension="NCName">ComplexTypeSimpleContentRestrictingComplexTypeElement</ComplexTypeSimpleContentRestrictingComplexTypeElement>
+</tns:ComplexTypeSimpleContentRestrictingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..4bcd2f8c46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/>
+
+ <complexType name="ComplexTypeSimpleContentRestrictingComplexTypeType">
+ <simpleContent>
+ <restriction base="tns:ComplexTypeExtendingSimpleTypeType">
+ <attribute name="AddedByExtension" type="NCName" />
+ </restriction>
+ </simpleContent>
+ </complexType>
+
+ <element name="ComplexTypeSimpleContentRestrictingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeSimpleContentRestrictingComplexTypeElement" type="tns:ComplexTypeSimpleContentRestrictingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml
new file mode 100644
index 0000000000..a6861f803a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithAbstract.xsd ">
+ <ComplexTypeWithAbstractExtensionElement>
+ <BaseElement>BaseElement</BaseElement>
+ <ExtensionElement>ExtensionElement</ExtensionElement>
+ </ComplexTypeWithAbstractExtensionElement>
+</tns:ComplexTypeWithAbstract>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd
new file mode 100644
index 0000000000..8bb251cab2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithAbstractType" abstract="true">
+ <sequence>
+ <element name="BaseElement" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="ComplexTypeWithAbstractExtensionType">
+ <complexContent>
+ <extension base="tns:ComplexTypeWithAbstractType">
+ <sequence>
+ <element name="ExtensionElement" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeWithAbstract">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithAbstractExtensionElement" type="tns:ComplexTypeWithAbstractExtensionType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml
new file mode 100644
index 0000000000..467ec007ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithCDATA xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithCDATA.xsd ">
+ <ComplexTypeWithCDATAElement>
+ Some
+ <![CDATA[some data and some <MoreXML></MoreXML>]]>
+ Mixed
+ <SimpleTypeWithName>SimpleType<![CDATA[some data and some <MoreXML></MoreXML>]]>WithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithCDATAElement>
+</tns:ComplexTypeWithCDATA>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd
new file mode 100644
index 0000000000..8d00646678
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithCDATAType" mixed="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithCDATA">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithCDATAElement" type="tns:ComplexTypeWithCDATAType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml
new file mode 100644
index 0000000000..7deafd798a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithContent xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithContent.xsd ">
+ <ComplexTypeWithContentElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithContentElement>
+</tns:ComplexTypeWithContent>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd
new file mode 100644
index 0000000000..72ac75fee0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithContentType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithContentElement" type="tns:ComplexTypeWithContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml
new file mode 100644
index 0000000000..f6208f81b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithMixed xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithMixed.xsd ">
+ <ComplexTypeWithMixedElement>
+ Some
+ Mixed
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithMixedElement>
+</tns:ComplexTypeWithMixed>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd
new file mode 100644
index 0000000000..1f26e13673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithMixedType" mixed="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithMixed">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithMixedElement" type="tns:ComplexTypeWithMixedType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml
new file mode 100644
index 0000000000..97de7b98eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithOpenAttributes xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenAttributes.xsd ">
+ <ComplexTypeWithOpenAttributesElement SomeOpenAttribute="Some Open Attribute">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithOpenAttributesElement>
+</tns:ComplexTypeWithOpenAttributes>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd
new file mode 100644
index 0000000000..67716553d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <attribute name="SomeOpenAttribute" type="string"/>
+
+ <complexType name="ComplexTypeWithOpenAttributesType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ <anyAttribute namespace="##any"/>
+ </complexType>
+
+ <element name="ComplexTypeWithOpenAttributes">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithOpenAttributesElement" type="tns:ComplexTypeWithOpenAttributesType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml
new file mode 100644
index 0000000000..5941348921
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithOpenContent xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenContent.xsd ">
+ <ComplexTypeWithOpenContentElement>
+ <tns:ComplexTypeWithMixed>
+ <ComplexTypeWithMixedElement>
+ Some
+ Mixed
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithMixedElement>
+ </tns:ComplexTypeWithMixed>
+ </ComplexTypeWithOpenContentElement>
+</tns:ComplexTypeWithOpenContent>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd
new file mode 100644
index 0000000000..24d5d09054
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeWithMixed.xsd"/>
+
+ <complexType name="ComplexTypeWithOpenContentType">
+ <sequence>
+ <any namespace="##any"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithOpenContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithOpenContentElement" type="tns:ComplexTypeWithOpenContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml
new file mode 100644
index 0000000000..f684d06a4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithOppositeProperty xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOppositeProperty.xsd ">
+ <ComplexTypeReferencedDataObject DataObjectId="idvalue0">
+ <SomeData>SomeData</SomeData>
+ </ComplexTypeReferencedDataObject>
+ <ComplexTypeReferencingDataObject AttributeWithSDOPropertyType="idvalue0" DataObjectId="idvalue1">
+ <OppositeProperty>idvalue2</OppositeProperty>
+ </ComplexTypeReferencingDataObject>
+ <ComplexTypeWithOppositePropertyElement AttributeWithSDOPropertyType="idvalue1" DataObjectId="idvalue2"/>
+</tns:ComplexTypeWithOppositeProperty>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd
new file mode 100644
index 0000000000..de4a8a666d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeReferencedDataObjectType">
+ <sequence>
+ <element name="SomeData" type="string"/>
+ </sequence>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <complexType name="ComplexTypeReferencingDataObjectType">
+ <sequence>
+ <element name="OppositeProperty" type="IDREF"/>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF"
+ sdo:propertyType="tns:ComplexTypeReferencedDataObjectType"/>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <complexType name="ComplexTypeWithOppositePropertyType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF"
+ sdo:propertyType="tns:ComplexTypeReferencingDataObjectType"
+ sdo:oppositeProperty="OppositeProperty"/>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <element name="ComplexTypeWithOppositeProperty">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeReferencedDataObject" type="tns:ComplexTypeReferencedDataObjectType"/>
+ <element name="ComplexTypeReferencingDataObject" type="tns:ComplexTypeReferencingDataObjectType"/>
+ <element name="ComplexTypeWithOppositePropertyElement" type="tns:ComplexTypeWithOppositePropertyType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml
new file mode 100644
index 0000000000..242908bd27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOAliasName.xsd ">
+ <ComplexTypeWithSDOAliasNameElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDOAliasNameElement>
+</tns:ComplexTypeWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..4c00fbe295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeWithSDOAliasNameType" sdo:aliasName="ComplexTypeWithSDOAliasNameTypeSDOAliasName">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDOAliasNameElement" type="tns:ComplexTypeWithSDOAliasNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml
new file mode 100644
index 0000000000..925e8625d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOName.xsd ">
+ <ComplexTypeWithSDONameElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDONameElement>
+</tns:ComplexTypeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd
new file mode 100644
index 0000000000..b12bec040b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeWithSDONameType" sdo:name="ComplexTypeWithSDONameTypeSDOName">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDONameElement" type="tns:ComplexTypeWithSDONameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml
new file mode 100644
index 0000000000..c73708ce46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithSDOSequence xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOSequence.xsd ">
+ <ComplexTypeWithSDOSequenceElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDOSequenceElement>
+</tns:ComplexTypeWithSDOSequence>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd
new file mode 100644
index 0000000000..795c3ea7d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithSDOSequenceType" sdo:sequence="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType" />
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOSequence">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDOSequenceElement" type="tns:ComplexTypeWithSDOSequenceType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml
new file mode 100644
index 0000000000..3ebdc89ae0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithoutContent xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutContent.xsd ">
+ <ComplexTypeWithoutContentElement/>
+</tns:ComplexTypeWithoutContent>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd
new file mode 100644
index 0000000000..21546d0f67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithoutContentType"/>
+
+ <element name="ComplexTypeWithoutContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithoutContentElement" type="tns:ComplexTypeWithoutContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml
new file mode 100644
index 0000000000..89657e42ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ComplexTypeWithoutName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutName.xsd ">
+ <tns:ComplexTypeWithoutNameType>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </tns:ComplexTypeWithoutNameType>
+</tns:ComplexTypeWithoutName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd
new file mode 100644
index 0000000000..d01b4172e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ComplexTypeWithoutNameType">
+ <complexType>
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="ComplexTypeWithoutName">
+ <complexType>
+ <sequence>
+ <element ref="tns:ComplexTypeWithoutNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml
new file mode 100644
index 0000000000..82fd1eedaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<DefaultNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="DefaultNamespace.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</DefaultNamespace>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd
new file mode 100644
index 0000000000..e1dcf06194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
+
+ <!-- top level test type -->
+ <xsd:complexType name="DefaultNamespaceComplexType">
+ <xsd:sequence>
+ <!-- simple types -->
+ <xsd:element name="SimpleTypeWithName" type="xsd:string"/>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="Default" type="DefaultNamespaceComplexType"/>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml
new file mode 100644
index 0000000000..ebf03c9d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementInAll xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInAll.xsd ">
+ <ElementInAllElement>
+ <ElementInAllOne>ElementInAllOne</ElementInAllOne>
+ <ElementInAllTwo>ElementInAllTwo</ElementInAllTwo>
+ </ElementInAllElement>
+</tns:ElementInAll>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd
new file mode 100644
index 0000000000..8b9ba5b4b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeElementInAllTestType">
+ <all>
+ <element name="ElementInAllOne" type="string"/>
+ <element name="ElementInAllTwo" type="string"/>
+ </all>
+ </complexType>
+
+ <element name="ElementInAll">
+ <complexType>
+ <sequence>
+ <choice maxOccurs="3">
+ <element name="ElementInAllElement" type="tns:ComplexTypeElementInAllTestType"/>
+ </choice>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml
new file mode 100644
index 0000000000..26466b1b39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementInChoice xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInChoice.xsd ">
+ <Element1InChoice>Element1InChoice</Element1InChoice>
+ <Element2InChoice>Element2InChoice</Element2InChoice>
+</tns:ElementInChoice>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd
new file mode 100644
index 0000000000..ff418c56ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <group name="Group1">
+ <sequence>
+ <element name="Element1InChoice" type="string" maxOccurs="2"/>
+ <element name="Element2InChoice" type="string" />
+ </sequence>
+ </group>
+
+ <group name="Group2">
+ <sequence>
+ <element name="Element2InChoice" type="string" />
+ <element name="Element1InChoice" type="string" maxOccurs="2"/>
+ </sequence>
+ </group>
+
+ <element name="ElementInChoice">
+ <complexType>
+ <sequence>
+ <choice maxOccurs="3">
+ <group ref="tns:Group1"/>
+ <group ref="tns:Group2"/>
+ </choice>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml
new file mode 100644
index 0000000000..27bb1ce9cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSDOChangeSummaryType xmlns:sdo="commonj.sdo"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSDOChangeSummaryType.xsd commonj.sdo datagraph.xsd ">
+ <ElementOfSDOChangeSummaryTypeElement>
+ <ChangeSummaryElement>
+ ChangeSummaryText
+ </ChangeSummaryElement>
+ </ElementOfSDOChangeSummaryTypeElement>
+</tns:ElementOfSDOChangeSummaryType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd
new file mode 100644
index 0000000000..2bf1df8c99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <import schemaLocation="datagraph.xsd" namespace="commonj.sdo"/>
+
+ <element name="ElementOfSDOChangeSummaryType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSDOChangeSummaryTypeElement" type="sdo:ChangeSummaryType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml
new file mode 100644
index 0000000000..9b5561ed43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithDefault xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithDefault.xsd ">
+ <ElementOfSimpleTypeWithDefaultElement>ElementOfSimpleTypeWithDefaultDefault</ElementOfSimpleTypeWithDefaultElement>
+</tns:ElementOfSimpleTypeWithDefault>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd
new file mode 100644
index 0000000000..0b4e7bdf45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementOfSimpleTypeWithDefault">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithDefaultElement" type="string" default="ElementOfSimpleTypeWithDefaultDefault" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml
new file mode 100644
index 0000000000..f1b7cd264c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithFixed xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithFixed.xsd ">
+ <ElementOfSimpleTypeWithFixedElement>ElementOfSimpleTypeWithFixedFixed</ElementOfSimpleTypeWithFixedElement>
+</tns:ElementOfSimpleTypeWithFixed>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd
new file mode 100644
index 0000000000..a2c8456257
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementOfSimpleTypeWithFixed">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithFixedElement" type="string" fixed="ElementOfSimpleTypeWithFixedFixed" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml
new file mode 100644
index 0000000000..1f60b0423f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDODataType.xsd ">
+ <ElementOfSimpleTypeWithSDODataTypeElement>ElementOfSimpleTypeWithSDODataTypeElement</ElementOfSimpleTypeWithSDODataTypeElement>
+</tns:ElementOfSimpleTypeWithSDODataType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd
new file mode 100644
index 0000000000..21e55ab8c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+
+ <element name="ElementOfSimpleTypeWithSDODataType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDODataTypeElement" type="string" sdo:dataType="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml
new file mode 100644
index 0000000000..30762f4912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithSDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOOppositePropertyType.xsd ">
+ <ElementOfSimpleTypeWithSDOOppositePropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOOppositePropertyTypeElement>
+</tns:ElementOfSimpleTypeWithSDOOppositePropertyType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..5bf35d0d70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+
+ <element name="ElementOfSimpleTypeWithSDOOppositePropertyType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOOppositePropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:ElementOfSimpleTypeWithSDOPropertyType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..2dd01e4090
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOPropertyType.xsd ">
+ <ElementOfSimpleTypeWithSDOPropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOPropertyTypeElement>
+</tns:ElementOfSimpleTypeWithSDOPropertyType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..6920cd8dd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementOfSimpleTypeWithSDOPropertyType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOPropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml
new file mode 100644
index 0000000000..6a526bdc47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementOfSimpleTypeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOString.xsd ">
+ <ElementOfSimpleTypeWithSDOStringElement>ElementOfSimpleTypeWithSDOStringElement</ElementOfSimpleTypeWithSDOStringElement>
+</tns:ElementOfSimpleTypeWithSDOString>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd
new file mode 100644
index 0000000000..1117a95eb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementOfSimpleTypeWithSDOString">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOStringElement" type="string" sdo:string="true"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml
new file mode 100644
index 0000000000..ab91458bff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementSubstitutionGroupBase xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementSubstitutionGroupBase.xsd ">
+ <ElementSubstitutionGroupBaseElement>
+ <ElementInSubstitutionGroupBase>
+ ElementInSubstitutionGroupBase
+ </ElementInSubstitutionGroupBase>
+ </ElementSubstitutionGroupBaseElement>
+
+ <ElementSubstitutionUnrelated>Some Data</ElementSubstitutionUnrelated>
+
+ <ElementSubstitutionGroupExtends>
+ <ElementInSubstitutionGroupBase>
+ ElementInSubstitutionGroupBase
+ </ElementInSubstitutionGroupBase>
+ <ElementInSubstitutionGroupExtends>
+ ElementInSubstitutionGroupExtends
+ </ElementInSubstitutionGroupExtends>
+ </ElementSubstitutionGroupExtends>
+
+</tns:ElementSubstitutionGroupBase>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd
new file mode 100644
index 0000000000..3e015843b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupBase" type="string"/>
+ </sequence>
+ </complexType>
+ <element name="ElementSubstitutionGroupBaseElement" type="tns:ComplexTypeSubstitutionGroupBaseType"/>
+
+ <element name="ElementSubstitutionGroupUnrelated" type="string" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/>
+
+ <complexType name="ComplexTypeSubstitutionGroupExtendsType">
+ <complexContent>
+ <extension base="tns:ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupExtends" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ElementSubstitutionGroupExtends" type="tns:ComplexTypeSubstitutionGroupExtendsType" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/>
+
+ <element name="ElementSubstitutionGroupBase">
+ <complexType>
+ <sequence>
+ <element ref="tns:ElementSubstitutionGroupBaseElement" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml
new file mode 100644
index 0000000000..b6d68fd08a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementWithMaxOccurs xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithMaxOccurs.xsd ">
+ <ElementWithMaxOccursElement>ElementWithMaxOccursElement1</ElementWithMaxOccursElement>
+ <ElementWithMaxOccursElement>ElementWithMaxOccursElement2</ElementWithMaxOccursElement>
+</tns:ElementWithMaxOccurs>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd
new file mode 100644
index 0000000000..d4453a4477
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementWithMaxOccurs">
+ <complexType>
+ <sequence>
+ <element name="ElementWithMaxOccursElement" type="string" maxOccurs="2"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml
new file mode 100644
index 0000000000..6de3adc937
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementWithNillable xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithNillable.xsd ">
+ <ElementWithNillableElement>ElementWithNillableElement</ElementWithNillableElement>
+</tns:ElementWithNillable>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd
new file mode 100644
index 0000000000..786ab226da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementWithNillable">
+ <complexType>
+ <sequence>
+ <element name="ElementWithNillableElement" type="string" nillable="true" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml
new file mode 100644
index 0000000000..64093aa803
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOAliasName.xsd ">
+ <ElementWithSDOAliasName>ElementWithSDOAliasName</ElementWithSDOAliasName>
+</tns:ElementWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd
new file mode 100644
index 0000000000..01f4c2b1ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="ElementWithSDOAliasName" sdo:aliasName="ElementWithSDOAliasNameSDOAliasName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml
new file mode 100644
index 0000000000..774646f682
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOName.xsd ">
+ <ElementWithSDONameElement>ElementWithSDONameElement</ElementWithSDONameElement>
+</tns:ElementWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd
new file mode 100644
index 0000000000..34da37564c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="ElementWithSDONameElement" sdo:name="ElementWithSDONameSDOName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml
new file mode 100644
index 0000000000..a1fb3aa803
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:GlobalElementComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementComplexType.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:GlobalElementComplexType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd
new file mode 100644
index 0000000000..8eb7a4fce4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="GlobalElementComplexTypeComplexType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="GlobalElementComplexType" type="tns:GlobalElementComplexTypeComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml
new file mode 100644
index 0000000000..f68eb1939d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<GlobalElementSimpleType xmlns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementSimpleType.xsd">
+ GlobalElementSimpleType
+</GlobalElementSimpleType>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd
new file mode 100644
index 0000000000..b9f77e6658
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+
+ <element name="GlobalElementSimpleType" type="string"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xml
new file mode 100644
index 0000000000..fd28850050
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Import xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Import.xsd">
+
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ <Imported>
+ <AnElement>SomeString</AnElement>
+ <AnotherElement>SomeString</AnotherElement>
+ </Imported>
+</tns:Import>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xsd
new file mode 100644
index 0000000000..eae93fd44a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Import.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoJava="commonj.sdo">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+ <import schemaLocation="ImportedSchema.xsd"
+ namespace="http://www.apache.org/tuscany/interop/import"/>
+
+ <!-- top level test type -->
+ <complexType name="ImportComplexType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ <element name="Imported" type="imp:ImportedComplexType"/>
+ </sequence>
+ </complexType>
+
+ <element name="Import" type="tns:ImportComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd
new file mode 100644
index 0000000000..a7e568decf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ targetNamespace="http://www.apache.org/tuscany/interop/import">
+
+ <xsd:complexType name="ImportedComplexType">
+ <xsd:sequence>
+ <xsd:element name="AnElement" type="xsd:string"/>
+ <xsd:element name="AnotherElement" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xml
new file mode 100644
index 0000000000..d4b9e24fa6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Include xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Include.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:Include>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xsd
new file mode 100644
index 0000000000..9087ebc74d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Include.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <!-- top level test type -->
+ <complexType name="IncludeComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="IncludeElement" type="tns:IncludeComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Interop.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Interop.xsd
new file mode 100644
index 0000000000..8138413b9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Interop.xsd
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+<!--
+ <include schemaLocation="Annotation.xsd"/>
+ <include schemaLocation="Attribute.xsd"/>
+ <include schemaLocation="AttributeReference.xsd"/>
+ <include schemaLocation="AttributeWithDefaultValue.xsd"/>
+ <include schemaLocation="AttributeWithFixedValue.xsd"/>
+ <include schemaLocation="AttributeWithSDOAliasName.xsd"/>
+ <include schemaLocation="AttributeWithSDODataType.xsd"/>
+ <include schemaLocation="AttributeWithSDOName.xsd"/>
+ <include schemaLocation="AttributeWithSDOPropertySDOOppositePropertyType.xsd"/>
+ <include schemaLocation="AttributeWithSDOPropertyType.xsd"/>
+ <include schemaLocation="AttributeWithSDOString.xsd"/>
+ <include schemaLocation="BuiltInAnySimpleType.xsd"/>
+ <include schemaLocation="BuiltInAnyType.xsd"/>
+ <include schemaLocation="BuiltInAnyURI.xsd"/>
+ <include schemaLocation="BuiltInBase64Binary.xsd"/>
+ <include schemaLocation="BuiltInBoolean.xsd"/>
+ <include schemaLocation="BuiltInByte.xsd"/>
+ <include schemaLocation="BuiltInDate.xsd"/>
+ <include schemaLocation="BuiltInDateTime.xsd"/>
+ <include schemaLocation="BuiltInDecimal.xsd"/>
+ <include schemaLocation="BuiltInDouble.xsd"/>
+ <include schemaLocation="BuiltInDuration.xsd"/>
+ <include schemaLocation="BuiltInFloat.xsd"/>
+ <include schemaLocation="BuiltInGDay.xsd"/>
+ <include schemaLocation="BuiltInGMonth.xsd"/>
+ <include schemaLocation="BuiltInGMonthDay.xsd"/>
+ <include schemaLocation="BuiltInGYear.xsd"/>
+ <include schemaLocation="BuiltInGYearMonth.xsd"/>
+ <include schemaLocation="BuiltInHexBinary.xsd"/>
+ <include schemaLocation="BuiltInID.xsd"/>
+ <include schemaLocation="BuiltInIDREF.xsd"/>
+ <include schemaLocation="BuiltInIDREFS.xsd"/>
+ <include schemaLocation="BuiltInInt.xsd"/>
+ <include schemaLocation="BuiltInInteger.xsd"/>
+ <include schemaLocation="BuiltInLanguage.xsd"/>
+ <include schemaLocation="BuiltInLong.xsd"/>
+ <include schemaLocation="BuiltInNCName.xsd"/>
+ <include schemaLocation="BuiltInNMTOKEN.xsd"/>
+ <include schemaLocation="BuiltInNMTOKENS.xsd"/>
+ <include schemaLocation="BuiltInNOTATION.xsd"/>
+ <include schemaLocation="BuiltInName.xsd"/>
+ <include schemaLocation="BuiltInNegativeInteger.xsd"/>
+ <include schemaLocation="BuiltInNonNegativeInteger.xsd"/>
+ <include schemaLocation="BuiltInNonPositiveInteger.xsd"/>
+ <include schemaLocation="BuiltInNormalizedString.xsd"/>
+ <include schemaLocation="BuiltInPositiveInteger.xsd"/>
+ <include schemaLocation="BuiltInQName.xsd"/>
+ <include schemaLocation="BuiltInShort.xsd"/>
+ <include schemaLocation="BuiltInString.xsd"/>
+ <include schemaLocation="BuiltInTime.xsd"/>
+ <include schemaLocation="BuiltInToken.xsd"/>
+ <include schemaLocation="BuiltInUnsignedByte.xsd"/>
+ <include schemaLocation="BuiltInUnsignedInt.xsd"/>
+ <include schemaLocation="BuiltInUnsignedLong.xsd"/>
+ <include schemaLocation="BuiltInUnsignedShort.xsd"/>
+ <include schemaLocation="ComplexTypeComplexContentRestrictingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/>
+ <include schemaLocation="ComplexTypeSimpleContentRestrictingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeWithAbstract.xsd"/>
+ <include schemaLocation="ComplexTypeWithCDATA.xsd"/>
+-->
+ <include schemaLocation="ComplexTypeWithContent.xsd"/>
+<!--
+ <include schemaLocation="ComplexTypeWithMixed.xsd"/>
+ <include schemaLocation="ComplexTypeWithOpenAttributes.xsd"/>
+ <include schemaLocation="ComplexTypeWithOpenContent.xsd"/>
+ <include schemaLocation="ComplexTypeWithOppositeProperty.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOAliasName.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOName.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOSequence.xsd"/>
+ <include schemaLocation="ComplexTypeWithoutContent.xsd"/>
+ <include schemaLocation="ComplexTypeWithoutName.xsd"/>
+ <include schemaLocation="DefaultNamespace.xsd"/>
+ <include schemaLocation="ElementInAll.xsd"/>
+ <include schemaLocation="ElementInChoice.xsd"/>
+ <include schemaLocation="ElementOfSDOChangeSummaryType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithDefault.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithFixed.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDODataType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOOppositePropertyType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOPropertyType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOString.xsd"/>
+ <include schemaLocation="ElementSubstitutionGroupBase.xsd"/>
+ <include schemaLocation="ElementWithMaxOccurs.xsd"/>
+ <include schemaLocation="ElementWithNillable.xsd"/>
+ <include schemaLocation="ElementWithSDOAliasName.xsd"/>
+ <include schemaLocation="ElementWithSDOName.xsd"/>
+ <include schemaLocation="GlobalElementComplexType.xsd"/>
+ <include schemaLocation="GlobalElementSimpleType.xsd"/>
+ <include schemaLocation="Import.xsd"/>
+ <include schemaLocation="ImportedSchema.xsd"/>
+ -->
+ <include schemaLocation="Include.xsd"/>
+<!--
+ <include schemaLocation="Notation.xsd"/>
+ <include schemaLocation="SDOJavaPackage.xsd"/>
+ <include schemaLocation="SimpleTypeWithAbstract.xsd"/>
+ <include schemaLocation="SimpleTypeWithExtendedInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithList.xsd"/>
+-->
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+<!--
+ <include schemaLocation="SimpleTypeWithSDOName.xsd"/>
+ <include schemaLocation="SimpleTypeWithUnion.xsd"/>
+ <include schemaLocation="SimpleTypeWithoutName.xsd"/>
+ <include schemaLocation="TargetNamespace.xsd"/>
+-->
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xml
new file mode 100644
index 0000000000..b75ac6500a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Notation xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Notation.xsd ">
+tns:Tuscany
+</tns:Notation>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xsd
new file mode 100644
index 0000000000..6ad019cb81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Notation.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <notation name="Tuscany" public="http://cwiki.apache.org/TUSCANY/"/>
+ <notation name="PHP_SCA_SDO" public="http://pecl.php.net/package/sca_sdo/"/>
+
+ <simpleType name="NotationSimpleType">
+ <restriction base="NOTATION">
+ <enumeration value="tns:Tuscany"/>
+ <enumeration value="tns:PHP_SCA_SDO"/>
+ </restriction>
+ </simpleType>
+
+ <element name="Notation" type="tns:NotationSimpleType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Person.xsd
new file mode 100644
index 0000000000..5f5021b15e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/Person.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/types">
+
+ <xsd:complexType name="PersonType">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="greeting" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml
new file mode 100644
index 0000000000..6c5ad88ff4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SDOJavaPackage xmlns:p="commonj.sdo"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop interop05.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:SDOJavaPackage>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd
new file mode 100644
index 0000000000..6b7e39b334
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo/java"
+ sdoJava:package="org.apache.tuscany">
+
+ <!-- should be a reference to the real schema wherever that is going to be -->
+ <import schemaLocation="sdoJava.xsd" namespace="commonj.sdo/java"/>
+
+ <!-- top level test type -->
+ <complexType name="SDOJavaPackageComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="string"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="SDOJavaPackage" type="tns:SDOJavaPackageComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml
new file mode 100644
index 0000000000..f9d4a24a49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithAbstract.xsd ">
+ <SimpleTypeWithAbstractExtensionElement>SimpleTypeWithAbstractExtensionElement</SimpleTypeWithAbstractExtensionElement>
+</tns:SimpleTypeWithAbstract>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd
new file mode 100644
index 0000000000..4bf0f0f4af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <simpleType name="SimpleTypeWithAbstractType" abstract="true">
+ <restriction base="string"/>
+ </simpleType>
+
+ <simpleType name="SimpleTypeWithAbstractExtensionType">
+ <restriction base="tns:SimpleTypeWithAbstractType"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithAbstractComplexType">
+ <sequence>
+ <element name="SimpleTypeWithAbstractExtensionElement" type="tns:SimpleTypeWithAbstractExtensionType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithAbstract" type="SimpleTypeWithAbstractComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml
new file mode 100644
index 0000000000..410df4b7e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithExtendedInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithExtendedInstanceClass.xsd ">
+ <SimpleTypeWithExtendedInstanceClassElement>SimpleTypeWithExtendedInstanceClassElement</SimpleTypeWithExtendedInstanceClassElement>
+</tns:SimpleTypeWithExtendedInstanceClass>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
new file mode 100644
index 0000000000..36629e8295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithExtendedInstanceClassType" sdoJava:extendedInstanceClass="String">
+ <restriction base="string"/>
+ </simpleType>
+
+ <complexType name="SimpleTypeWithExtendedInstanceClassComplexType">
+ <sequence>
+ <element name="SimpleTypeWithExtendedInstanceClassElement" type="tns:SimpleTypeWithExtendedInstanceClassType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithExtendedInstanceClass" type="SimpleTypeWithExtendedInstanceClassComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml
new file mode 100644
index 0000000000..7b74867c03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithInstanceClass.xsd ">
+ <SimpleTypeWithInstanceClassElement>SimpleTypeWithInstanceClassElement</SimpleTypeWithInstanceClassElement>
+</tns:SimpleTypeWithInstanceClass>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
new file mode 100644
index 0000000000..7a08de84be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithInstanceClassType" sdoJava:instanceClass="String">
+ <restriction base="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithInstanceClassComplexType">
+ <sequence>
+ <element name="SimpleTypeWithInstanceClassElement" type="tns:SimpleTypeWithInstanceClassType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithInstanceClass" type="SimpleTypeWithInstanceClassComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml
new file mode 100644
index 0000000000..708d526f44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithList xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithList.xsd ">
+ <SimpleTypeWithListElement>listmember1 listmember2</SimpleTypeWithListElement>
+</tns:SimpleTypeWithList>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
new file mode 100644
index 0000000000..681cf7d5af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithListType">
+ <list itemType="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithListComplexType">
+ <sequence>
+ <element name="SimpleTypeWithListElement" type="tns:SimpleTypeWithListType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithList" type="SimpleTypeWithListComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml
new file mode 100644
index 0000000000..e404ac86b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithName.xsd ">
+ <SimpleTypeWithNameElement>SimpleTypeWithNameElement</SimpleTypeWithNameElement>
+</tns:SimpleTypeWithName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd
new file mode 100644
index 0000000000..af0431f048
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <simpleType name="SimpleTypeWithNameType">
+ <restriction base="string"/>
+ </simpleType>
+
+ <complexType name="SimpleTypeWithNameComplexType">
+ <sequence>
+ <element name="SimpleTypeWithNameElement" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameComplexType"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml
new file mode 100644
index 0000000000..c86a0f6bcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithSDOName.xsd ">
+ <SimpleTypeWithSDONameElement>SimpleTypeWithSDONameElement</SimpleTypeWithSDONameElement>
+</tns:SimpleTypeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd
new file mode 100644
index 0000000000..889b819e3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithSDONameType" sdo:name="SimpleTypeWithSDONameTypeSDOName">
+ <restriction base="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithSDONameComplexType">
+ <sequence>
+ <element name="SimpleTypeWithSDONameElement" type="tns:SimpleTypeWithSDONameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithSDOName" type="SimpleTypeWithSDONameComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml
new file mode 100644
index 0000000000..399b0d8175
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithUnion xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithUnion.xsd ">
+ <SimpleTypeWithUnionElement>EN</SimpleTypeWithUnionElement>
+ <SimpleTypeWithUnionElement>01:02:03</SimpleTypeWithUnionElement>
+</tns:SimpleTypeWithUnion>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
new file mode 100644
index 0000000000..fee04b9f24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithUnionType">
+ <union>
+ <simpleType>
+ <restriction base="language">
+ </restriction>
+ </simpleType>
+ <simpleType>
+ <restriction base="time">
+ </restriction>
+ </simpleType>
+ </union>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithUnionComplexType">
+ <sequence>
+ <element name="SimpleTypeWithUnionElement" type="tns:SimpleTypeWithUnionType" minOccurs="2" maxOccurs="2"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithUnion" type="SimpleTypeWithUnionComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml
new file mode 100644
index 0000000000..bc8cf35368
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+ <SimpleTypeWithoutName xmlns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithoutName.xsd">
+ <SimpleTypeWithoutNameElement>
+ SimpleTypeWithoutName
+ </SimpleTypeWithoutNameElement>
+</SimpleTypeWithoutName>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
new file mode 100644
index 0000000000..536aa822de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="SimpleTypeWithoutNameElement">
+ <simpleType>
+ <restriction base="string"/>
+ </simpleType>
+ </element>
+
+
+ <complexType name="SimpleTypeWithoutNameComplexType">
+ <sequence>
+ <element ref="tns:SimpleTypeWithoutNameElement"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithoutName" type="SimpleTypeWithoutNameComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml
new file mode 100644
index 0000000000..da2929776e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:TargetNamespace xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop TargetNamespace.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:TargetNamespace>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd
new file mode 100644
index 0000000000..ace5427786
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <!-- top level test type -->
+ <complexType name="TargetNamespaceComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="string"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="TargetNamespace" type="tns:TargetNamespaceComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/datagraph.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/datagraph.xsd
new file mode 100644
index 0000000000..e6b9697a8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/datagraph.xsd
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+-->
+
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoJava="commonj.sdo/java"
+ targetNamespace="commonj.sdo">
+
+ <xsd:element name="datagraph" type="sdo:DataGraphType"/>
+
+ <xsd:complexType name="DataGraphType">
+ <xsd:complexContent>
+ <xsd:extension base="sdo:BaseDataGraphType">
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="1" namespace="##other" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="BaseDataGraphType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="models" type="sdo:ModelsType" minOccurs="0"/>
+ <xsd:element name="xsd" type="sdo:XSDType" minOccurs="0"/>
+ <xsd:element name="changeSummary" type="sdo:ChangeSummaryType" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="ModelsType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Expected type is emof:Package.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="XSDType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Expected type is xsd:schema.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- FB TEMP -->
+ <xsd:simpleType name="ChangeSummaryType" sdoJava:instanceClass="commonj.sdo.ChangeSummary">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+<!--
+ <xsd:complexType name="ChangeSummaryType">
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="create" type="xsd:string"/>
+ <xsd:attribute name="delete" type="xsd:string"/>
+ <xsd:attribute name="logging" type="xsd:boolean"/>
+ </xsd:complexType>
+-->
+
+ <xsd:attribute name="ref" type="xsd:string"/>
+ <xsd:attribute name="unset" type="xsd:string"/>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd
new file mode 100644
index 0000000000..7387568942
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+-->
+
+<xsd:schema
+ targetNamespace="commonj.sdo/java"
+ xmlns:sdoJava="commonj.sdo/java"
+ xmlns:sdo="commonj.sdo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
+
+<!--
+ These attributes are used to customize the Java mapping of
+ XSD to SDO Types and Properties.
+-->
+
+<xsd:attribute name="package" type="xsd:string" />
+<xsd:attribute name="instanceClass" type="xsd:string" />
+<xsd:attribute name="extendedInstanceClass" type="xsd:string" />
+<xsd:attribute name="nestedInterfaces" type="xsd:boolean" />
+
+<!--
+ Global properties used in open content for
+ the Java binding of SDO Types and Properties.
+-->
+
+<xsd:attribute name="javaClass" type="sdo:String"/>
+
+<!-- JavaInfo deprecated in 2.1.0 -->
+<xsd:complexType name="JavaInfo">
+ <xsd:attribute name="javaClass" type="sdo:String"/>
+</xsd:complexType>
+
+<!--
+ The Java object data types.
+-->
+
+<xsd:simpleType name="BooleanObject" sdoJava:instanceClass="java.lang.Boolean">
+ <xsd:restriction base="xsd:boolean"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="ByteObject" sdoJava:instanceClass="java.lang.Byte">
+ <xsd:restriction base="xsd:byte"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="CharacterObject" sdoJava:instanceClass="java.lang.Character">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="DoubleObject" sdoJava:instanceClass="java.lang.Double">
+ <xsd:restriction base="xsd:double"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="FloatObject" sdoJava:instanceClass="java.lang.Float">
+ <xsd:restriction base="xsd:float"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="IntObject" sdoJava:instanceClass="java.lang.Integer">
+ <xsd:restriction base="xsd:int"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="LongObject" sdoJava:instanceClass="java.lang.Long">
+ <xsd:restriction base="xsd:long"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="ShortObject" sdoJava:instanceClass="java.lang.Short">
+ <xsd:restriction base="xsd:short"/>
+</xsd:simpleType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd
new file mode 100644
index 0000000000..c5aabc9cc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+
+-->
+
+<xsd:schema
+ targetNamespace="commonj.sdo"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoXML="commonj.sdo/xml"
+ xmlns:sdoJava="commonj.sdo/java"
+ elementFormDefault="qualified"
+ xsi:schemaLocation="commonj.sdo/xml sdoXML.xsd
+ commonj.sdo/java sdoJava.xsd">
+
+<xsd:include schemaLocation="datagraph.xsd"/>
+
+<!-- Root element for defining several Types in one document.
+ Is not part of the model.
+-->
+<xsd:element name="types" type="sdo:Types"/>
+<xsd:complexType name="Types">
+ <xsd:sequence>
+ <xsd:element name="type" type="sdo:Type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<!-- Any data object may be serialized with this element,
+ with xsi:type to declare the
+ actual type of the DataObject serialized.
+-->
+<xsd:element name="dataObject" type="xsd:anyType"/>
+
+<!-- Model Types
+ SDO Type and Property are defined in terms of themselves.
+-->
+<xsd:element name="type" type="sdo:Type"/>
+<xsd:complexType name="Type">
+ <xsd:sequence>
+ <xsd:element name="baseType" type="sdo:URI"
+ minOccurs="0" maxOccurs="unbounded"
+ sdoXML:propertyType="sdo:Type" />
+ <xsd:element name="property" type="sdo:Property"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="aliasName" type="sdo:String"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" sdoXML:dataType="sdo:String"/>
+ <xsd:attribute name="uri" type="sdo:URI"/>
+ <xsd:attribute name="dataType" type="sdo:Boolean"/>
+ <xsd:attribute name="open" type="sdo:Boolean"/>
+ <xsd:attribute name="sequenced" type="sdo:Boolean"/>
+ <xsd:attribute name="abstract" type="sdo:Boolean"/>
+ <xsd:anyAttribute namespace="##any" processContents="lax"/>
+</xsd:complexType>
+
+<xsd:complexType name="Property">
+ <xsd:sequence>
+ <xsd:element name="aliasName" type="sdo:String"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="sdo:String"/>
+ <xsd:attribute name="many" type="sdo:Boolean"/>
+ <xsd:attribute name="containment" type="sdo:Boolean"/>
+ <xsd:attribute name="default" type="sdo:String"/>
+ <xsd:attribute name="readOnly" type="sdo:Boolean"/>
+ <xsd:attribute name="type" type="sdo:URI" sdoXML:propertyType="sdo:Type"/>
+ <xsd:attribute name="opposite" type="sdo:URI" sdoXML:propertyType="sdo:Property"/>
+ <xsd:attribute name="nullable" type="sdo:Boolean"/>
+ <xsd:anyAttribute namespace="##any" processContents="lax"/>
+</xsd:complexType>
+
+<!-- Special Types -->
+<xsd:complexType name="DataObject" abstract="true"/>
+
+<!-- TextType deprecated in 2.1.0 -->
+ <xsd:complexType name="TextType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="text" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- ChangeSummaryType is defined in datagraph.xsd.
+ Although declared there as a ComplexType,
+ at the model level it is treated as a SimpleType
+ with a special XML serialization.
+-->
+
+<!-- Data Types -->
+<xsd:simpleType name="Boolean" sdoJava:instanceClass="boolean">
+ <xsd:restriction base="xsd:boolean"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Byte" sdoJava:instanceClass="byte">
+ <xsd:restriction base="xsd:byte"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Bytes" sdoJava:instanceClass="byte[]">
+ <xsd:restriction base="xsd:hexBinary"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Character" sdoJava:instanceClass="char">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Date" sdoJava:instanceClass="java.util.Date">
+ <xsd:restriction base="xsd:dateTime"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="DateTime" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:dateTime"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Day" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gDay"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Decimal" sdoJava:instanceClass="java.math.BigDecimal">
+ <xsd:restriction base="xsd:decimal"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Double" sdoJava:instanceClass="double">
+ <xsd:restriction base="xsd:double"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Duration" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:duration"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Float" sdoJava:instanceClass="float">
+ <xsd:restriction base="xsd:float"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Int" sdoJava:instanceClass="int">
+ <xsd:restriction base="xsd:int"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Integer" sdoJava:instanceClass="java.math.BigInteger">
+ <xsd:restriction base="xsd:integer"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Long" sdoJava:instanceClass="long">
+ <xsd:restriction base="xsd:long"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Month" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gMonth"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="MonthDay" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gMonthDay"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Object" sdoJava:instanceClass="java.lang.Object">
+ <!-- Only the schema for schemas is allowed to restrict anySimpleType.
+ <xsd:restriction base="xsd:anySimpleType"/>
+ The equivalent declaration is a union of the predefined XSD data types.
+ -->
+ <xsd:union memberTypes="xsd:anyURI xsd:base64Binary xsd:boolean xsd:byte
+ xsd:date xsd:dateTime xsd:decimal xsd:double xsd:duration xsd:ENTITIES xsd:ENTITY xsd:float
+ xsd:gDay xsd:gMonth xsd:gMonthDay xsd:gYear xsd:gYearMonth xsd:hexBinary xsd:ID xsd:IDREF xsd:IDREFS
+ xsd:int xsd:integer xsd:language xsd:long xsd:Name xsd:NCName xsd:negativeInteger
+ xsd:NMTOKEN xsd:NMTOKENS xsd:nonNegativeInteger xsd:nonPositiveInteger
+ xsd:normalizedString xsd:NOTATION xsd:positiveInteger xsd:QName xsd:short xsd:string
+ xsd:time xsd:token xsd:unsignedByte xsd:unsignedInt xsd:unsignedLong xsd:unsignedShort"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Short" sdoJava:instanceClass="short">
+ <xsd:restriction base="xsd:short"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="String" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Strings" sdoJava:instanceClass="java.util.List">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Time" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:time"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Year" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gYear"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="YearMonth" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gYearMonth"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="YearMonthDay" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:date"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="URI" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:anyURI"/>
+</xsd:simpleType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java
new file mode 100644
index 0000000000..131e11012a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.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.sca.itest.generate;
+
+import junit.framework.TestCase;
+
+
+/**
+ *
+ */
+public class GenerateTestCase extends TestCase {
+
+ private Generate generator = null;
+ private static boolean initalised = false;
+
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ generator = new Generate();
+ initalised = true;
+ }
+ }
+
+ protected void tearDown() {
+
+ }
+
+ /**
+ * Invokes the Generate class to generate databinding test classes and resources.
+ *
+ * @throws Exception
+ */
+ public void testGenerate() throws Exception {
+ // generator.generate();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/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/testing/sca/itest/databindings/interop/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/NOTICE.txt
new file mode 100644
index 0000000000..92ca715fbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2007 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/testing/sca/itest/databindings/interop/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/pom.xml
new file mode 100644
index 0000000000..fd3796fa36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/pom.xml
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-interopDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Interoperability Databindings Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-sdoDatabinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-jaxbDatabinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxb-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</packageName>
+ <wsdlDirectory>${project.build.directory}/classes/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>JAXBGreeter.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>true</verbose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
new file mode 100644
index 0000000000..e6c2cd0f94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
@@ -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 $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import org.apache.tuscany.api.SCARuntime;
+import ${template.getJavaPackage()}.GreeterService;
+
+// Data types
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+import $file.getJavaPackage().$file.getFactory();
+#end
+#end
+
+/**
+ * Automatically generated test case. Calls the greeter client for a number of
+ * bindings and a number of data types.
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+public class InteropDatabindingTestCase extends TestCase {
+
+ private static boolean initalised = false;
+ private GreeterService greeterClient;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ SCARuntime.start("interopgreeter.composite");
+ super.setUp();
+ initalised = true;
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ protected void tearDown() {
+
+ }
+
+ /**
+ * Finds the SCA component that relates to the protocol being tested. This test
+ * always connects locally to the client component but the client component will
+ * connect to the back end component using the appropriate protocol
+ *
+ * @param ext the protcol required
+ */
+ private void setUpClient(String ext) throws Exception {
+ CompositeContext ctx = CurrentCompositeContext.getContext();
+ greeterClient = ctx.locateService(GreeterService.class, ext + "GreeterServiceClient");
+ }
+
+ /**
+ * Invokes the SDO Greet service using web service bindings with SDO payload
+ */
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the SDO Greet service using default bindings with SDO payload
+ */
+// Not sure that transformations should work with
+// local connections because the interface type will
+// be incorrect when specified in the SCDL
+// public void testDefaultGreet() throws Exception {
+// setUpClient("Default");
+// greet();
+// }
+
+ /**
+ * A generic method which, regarless of which client is connected, sends out a
+ * series of requrests passing different data types.
+ */
+ public void greet() {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ // test $typeInstance.getTypeName()
+ {
+ $typeInstance.getTypeName() param = null;
+ $typeInstance.getCreateTypeCode()
+ $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param);
+ $typeInstance.getResultComparison()
+ }
+#end
+#end
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
new file mode 100644
index 0000000000..00cfea5e9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
new file mode 100644
index 0000000000..00cfea5e9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..6d6da4d366
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/generate.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+
+ <Template>
+ <TemplateName>InteropDatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>interopgreeter.composite.vm</TemplateName>
+ <TemplateTargetDir>classes</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>SDOGreeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>JAXBGreeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
new file mode 100644
index 0000000000..4d41e3de19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="SDOGreeterService">
+
+ <!-- SDO factory classes -->
+<!--
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+-->
+ <!--
+ manually inserted bcause the generator for interop
+ is set to generate JAXB methods not SDO methods. Need
+ to switch this round so the client is SDO based
+ -->
+ <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.types.TypesFactory"/>
+ <dbsdo:import.sdo factory="org.apache.tuscany.interop.InteropFactory"/>
+
+
+ <!-- Default binding test -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">SDODefaultGreeterServiceClient</reference>
+ </component>
+
+ <component name="SDODefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">JAXBGreeterService</reference>
+ </component>
+
+ <component name="JAXBGreeterService">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+
+ <!-- WS binding test -->
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">SDOGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="SDOGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/SDOGreeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/SDOGreeter.wsdl" />
+ </reference>
+
+ <service name="SDOGreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/SDOGreeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/SDOGreeter.wsdl" />
+ <reference>SDOWSGreeterServiceClient</reference>
+ </service>
+
+ <component name="SDOWSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">JAXBGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="JAXBGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/JAXBGreeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/JAXBGreeter.wsdl" />
+ </reference>
+
+ <service name="JAXBGreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/JAXBGreeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/JAXBGreeter.wsdl" />
+ <reference>JAXBWSGreeterService</reference>
+ </service>
+
+ <component name="JAXBWSGreeterService">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/pom.xml
new file mode 100644
index 0000000000..3f8eeaed17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/pom.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-jaxbDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for JAXB Databindings</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxb-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</packageName>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>true</verbose>
+ </configuration>
+ </plugin>
+
+ <!-- plugin ## Now using jaxws wsimport ## >
+ <groupId>com.sun.tools.xjc.maven2</groupId>
+ <artifactId>maven-jaxb-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
+ <schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
+ <includeSchemas>
+ <includeSchema>Person.xsd</includeSchema>
+ </includeSchemas>
+ </configuration>
+ </plugin -->
+ </plugins>
+</build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterService.java
new file mode 100644
index 0000000000..cb508dd109
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterService.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.sca.itest.jaxbdatabinding;
+
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface GreeterService {
+
+ // @DataType(name = "javax.xml.bind.JAXBElement")
+ PersonType greet(PersonType who);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClient.java
new file mode 100644
index 0000000000..c47d5143ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClient.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.sca.itest.jaxbdatabinding;
+
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ *
+ */
+@AllowsPassByReference
+public interface GreeterServiceClient {
+
+ // @DataType(name = "javax.xml.bind.JAXBElement")
+ PersonType greet(PersonType who);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClientImpl.java
new file mode 100644
index 0000000000..fbad08f5ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceClientImpl.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.sca.itest.jaxbdatabinding;
+
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(GreeterServiceClient.class)
+public class GreeterServiceClientImpl implements GreeterServiceClient {
+
+ private GreeterService service;
+
+ @Reference
+ public void setGreeterService(GreeterService service) {
+ this.service = service;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClient#greet(org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType)
+ */
+ public PersonType greet(PersonType who) {
+ return service.greet(who);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceImpl.java
new file mode 100644
index 0000000000..0d6c0f01e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding/GreeterServiceImpl.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.sca.itest.jaxbdatabinding;
+
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType;
+
+/**
+ *
+ */
+@Service(GreeterService.class)
+public class GreeterServiceImpl implements GreeterService {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterService#greet(javax.xml.bind.JAXBElement)
+ */
+ public PersonType greet(PersonType who) {
+ // System.out.println(who.toString());
+ who.setGreeting("Hello");
+ // System.out.println(who.toString());
+ return who;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/greeterws.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/greeterws.composite
new file mode 100644
index 0000000000..4a27a8ba5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/greeterws.composite
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="JAXBGreeterService">
+
+ <!-- Services Exposed via different bindings -->
+ <service name="JAXBGreeterServiceDefaultBinding">
+ <interface.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterService" />
+ <reference>JAXBGreeterServiceComponent</reference>
+ </service>
+
+ <service name="JAXBGreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ <reference>JAXBGreeterServiceComponent</reference>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="JAXBGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+
+
+ <!-- Clients to test the services -->
+ <component name="DefaultJAXBGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">JAXBGreeterServiceDefaultRef</reference>
+ </component>
+
+ <component name="JAXBGreeterServiceDefaultRef">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+
+ <component name="WSJAXBGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">JAXBGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="JAXBGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/wsdl/Greeter.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/wsdl/Greeter.wsdl
new file mode 100644
index 0000000000..4977cfc274
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/wsdl/Greeter.wsdl
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:dataTypes="http://apache.org/tuscany/sca/itest/databinding/types"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services" elementFormDefault="qualified">
+
+ <xsd:import namespace="http://apache.org/tuscany/sca/itest/databinding/types" schemaLocation="../xsd/Person.xsd" />
+
+ <xsd:element name="Person" type="dataTypes:PersonType" />
+
+ <element name="greet">
+ <complexType>
+ <sequence>
+ <element name="person" type="dataTypes:PersonType" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="greetResponse">
+ <complexType>
+ <sequence>
+ <element name="person" type="dataTypes:PersonType" />
+ </sequence>
+ </complexType>
+ </element>
+
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="request">
+ <wsdl:part element="tns:greet" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="response">
+ <wsdl:part element="tns:greetResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="GreeterPortType">
+ <wsdl:operation name="greet">
+ <wsdl:input message="tns:request" name="requestMsg" />
+ <wsdl:output message="tns:response" name="responseMsg" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="greet">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="requestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="responseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/xsd/Person.xsd
new file mode 100644
index 0000000000..5f5021b15e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/main/resources/xsd/Person.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/types">
+
+ <xsd:complexType name="PersonType">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="greeting" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/test/java/org/apache/tuscany/sca/itest/JaxbDatabindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/test/java/org/apache/tuscany/sca/itest/JaxbDatabindingTestCase.java
new file mode 100644
index 0000000000..da65bea4b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxb/src/test/java/org/apache/tuscany/sca/itest/JaxbDatabindingTestCase.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.sca.itest;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClient;
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.ObjectFactory;
+import org.apache.tuscany.sca.itest.jaxbdatabinding.generated.PersonType;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ *
+ */
+public class JaxbDatabindingTestCase {
+ private GreeterServiceClient greeterClient;
+
+ @BeforeClass
+ public static void init() {
+ SCARuntime.start("greeterws.composite");
+ }
+
+ private void setUpClient(String binding) throws Exception {
+ CompositeContext ctx = CurrentCompositeContext.getContext();
+ greeterClient = ctx.locateService(GreeterServiceClient.class, binding + "JAXBGreeterServiceClient");
+ }
+
+ /**
+ * Invokes the JAXB Greet service using web service bindings with JAXB payload
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the JAXB Greet service using default with JAXB payload
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testDefaultGreet() throws Exception {
+ setUpClient("Default");
+ greet();
+ }
+
+ public void greet() {
+ ObjectFactory factory = new ObjectFactory();
+ PersonType person = factory.createPersonType();
+ person.setFirstName("George");
+ person.setLastName("Doors");
+ // System.out.println("Client side: " + person.getFirstName() + " " + person.getLastName() + " " +
+ // person.getGreeting());
+ PersonType greetedPerson = greeterClient.greet(person);
+ // System.out.println("Client side: " + greetedPerson.getFirstName() + " " + greetedPerson.getLastName() + " " +
+ // greetedPerson.getGreeting());
+ Assert.assertNotSame("greetedPerson.getGreeting() not set", "", greetedPerson.getGreeting());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/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/testing/sca/itest/databindings/jaxbgen/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/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/testing/sca/itest/databindings/jaxbgen/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/pom.xml
new file mode 100644
index 0000000000..13a65b7961
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/pom.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-jaxbDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>JAXB Databinding Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxb-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</packageName>
+ <wsdlDirectory>${project.build.directory}/classes/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>Greeter.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>true</verbose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..0a148a40c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+
+
+ <Template>
+ <TemplateName>GreeterService.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClient.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>DatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>Greeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/greeter.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/greeter.composite
new file mode 100644
index 0000000000..867829c1b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/jaxbgen/src/main/resources/greeter.composite
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="JAXBGreeterService">
+
+ <!-- Services Exposed via different bindings -->
+ <service name="JAXBGreeterServiceDefaultBinding">
+ <interface.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterService" />
+ <reference>JAXBGreeterServiceComponent</reference>
+ </service>
+
+ <service name="GreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ <reference>JAXBGreeterServiceComponent</reference>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="JAXBGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <!--reference name="greeterService">JAXBGreeterServiceDefaultRef</reference-->
+ <reference name="greeterService">JAXBGreeterServiceComponent</reference>
+ </component>
+
+ <reference name="JAXBGreeterServiceDefaultRef">
+ <interface.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterService" />
+ </reference>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">JAXBGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="JAXBGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/pom.xml
new file mode 100644
index 0000000000..f1be232286
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <name>SCA Databindings Integration Tests</name>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+
+
+ <packaging>pom</packaging>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+ <modules>
+ <module>jaxb</module>
+ <module>sdo</module>
+ <module>transformers</module>
+ <!-- module>xmlbeans</module -->
+ <!-- module>interComposite</module -->
+ <!-- module>intraNestedComposite</module -->
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/pom.xml
new file mode 100644
index 0000000000..25de0f25d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-sdoDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SDO Databindings</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency -->
+ <!-- dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency -->
+ <!-- dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency -->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/wsdl/Greeter.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/xsd/Person.xsd</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.types</javaPackage>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterService.java
new file mode 100644
index 0000000000..61def7f9f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterService.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.sca.itest.sdodatabinding;
+
+import org.apache.tuscany.sca.itest.databinding.types.PersonType;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface GreeterService {
+
+ // @DataType(name = "commonj.sdo.DataObject")
+ PersonType greet(PersonType who);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClient.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClient.java
new file mode 100644
index 0000000000..87de5f5d3b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClient.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.sca.itest.sdodatabinding;
+
+import org.apache.tuscany.sca.itest.databinding.types.PersonType;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ *
+ */
+@AllowsPassByReference
+public interface GreeterServiceClient {
+
+ // @DataType(name = "commonj.sdo.DataObject")
+ PersonType greet(PersonType who);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClientImpl.java
new file mode 100644
index 0000000000..3dcf34bb59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceClientImpl.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.sca.itest.sdodatabinding;
+
+import org.apache.tuscany.sca.itest.databinding.types.PersonType;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(GreeterServiceClient.class)
+public class GreeterServiceClientImpl implements GreeterServiceClient {
+ private GreeterService service;
+
+ @Reference
+ public void setGreeterService(GreeterService service) {
+ this.service = service;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClient#greet(org.apache.tuscany.sca.itest.sdodatabinding.generated.PersonType)
+ */
+ public PersonType greet(PersonType who) {
+ return service.greet(who);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceImpl.java
new file mode 100644
index 0000000000..6bbc957a0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/java/org/apache/tuscany/sca/itest/sdodatabinding/GreeterServiceImpl.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.sca.itest.sdodatabinding;
+
+import org.apache.tuscany.sca.itest.databinding.types.PersonType;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+/**
+ *
+ */
+@Service(GreeterService.class)
+public class GreeterServiceImpl implements GreeterService {
+ /**
+ * It will be injected with a HelperContext for the composite
+ */
+ @Autowire
+ protected HelperContext helperContext;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.sdodatabinding.GreeterService#greet(org.apache.tuscany.sca.itest.sdodatabinding.generated.PersonType)
+ */
+ public PersonType greet(PersonType who) {
+ System.out.println(helperContext.getXMLHelper().save((DataObject) who, "http://person/", "person"));
+ PersonType copy = (PersonType) helperContext.getCopyHelper().copy((DataObject) who);
+ copy.setGreeting("Hello");
+ System.out.println(who.toString());
+ return copy;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/greetersdo.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/greetersdo.composite
new file mode 100644
index 0000000000..e419e1487a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/greetersdo.composite
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="SDOGreeterService">
+
+ <!-- SDO factory classes -->
+ <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.services.ServicesFactory"/>
+ <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.types.TypesFactory"/>
+
+ <!-- Services Exposed via different bindings -->
+ <service name="SDOGreeterServiceDefaultBinding">
+ <interface.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterService" />
+ <reference>SDOGreeterServiceComponent</reference>
+ </service>
+
+ <service name="SDOGreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ <reference>SDOGreeterServiceComponent</reference>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="SDOGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+
+ <!-- Clients to test the services -->
+ <component name="DefaultSDOGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">SDOGreeterServiceComponent</reference>
+ </component>
+
+
+ <component name="WSSDOGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">SDOGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="SDOGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/wsdl/Greeter.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/wsdl/Greeter.wsdl
new file mode 100644
index 0000000000..6960178f2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/wsdl/Greeter.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:p="http://apache.org/tuscany/sca/itest/databinding/types"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services" elementFormDefault="qualified">
+
+ <xsd:import namespace="http://apache.org/tuscany/sca/itest/databinding/types" schemaLocation="../xsd/Person.xsd" />
+ <!--
+ <xsd:element name="Person" type="p:PersonType" />
+ -->
+
+ <element name="greet">
+ <complexType>
+ <sequence>
+ <element name="parm" type="p:PersonType" />
+ </sequence>
+ </complexType>
+ </element>
+
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="request">
+ <wsdl:part element="tns:greet" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="response">
+ <wsdl:part element="tns:greet" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="GreeterPortType">
+ <wsdl:operation name="greet">
+ <wsdl:input message="tns:request" name="requestMsg" />
+ <wsdl:output message="tns:response" name="responseMsg" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="greet">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="requestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="responseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/SDOGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/xsd/Person.xsd
new file mode 100644
index 0000000000..5f5021b15e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/main/resources/xsd/Person.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/types">
+
+ <xsd:complexType name="PersonType">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="greeting" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/test/java/org/apache/tuscany/sca/itest/SdoDatabindingTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/test/java/org/apache/tuscany/sca/itest/SdoDatabindingTestCase.java
new file mode 100644
index 0000000000..c2df998f4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdo/src/test/java/org/apache/tuscany/sca/itest/SdoDatabindingTestCase.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.sca.itest;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.itest.databinding.types.PersonType;
+import org.apache.tuscany.sca.itest.databinding.types.TypesFactory;
+import org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClient;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ *
+ */
+public class SdoDatabindingTestCase extends TestCase {
+
+ GreeterServiceClient greeterClient;
+ private static boolean initalised = false;
+
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ SCARuntime.start("greetersdo.composite");
+ initalised = true;
+ }
+ }
+
+ protected void tearDown() {
+
+ }
+
+ private void setUpClient(String ext) throws Exception {
+ CompositeContext ctx = CurrentCompositeContext.getContext();
+ greeterClient = ctx.locateService(GreeterServiceClient.class, ext + "SDOGreeterServiceClient");
+ }
+
+ /**
+ * Invokes the SDO Greet service using web service bindings with SDO payload
+ *
+ * @throws Exception
+ */
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the SDO Greet service using default bindings with SDO payload
+ *
+ * @throws Exception
+ */
+ public void testDefaultGreet() throws Exception {
+ setUpClient("Default");
+ greet();
+ }
+
+ public void greet() {
+ TypesFactory factory = TypesFactory.INSTANCE;
+ PersonType person = factory.createPersonType();
+ person.setFirstName("George");
+ person.setLastName("Doors");
+ // System.out.println("Client side: " + person.getFirstName() + " " +
+ // person.getLastName() + " " + person.getGreeting());
+ PersonType greetedPerson = greeterClient.greet(person);
+ // System.out.println("Client side: " + greetedPerson.getFirstName() + "
+ // " + greetedPerson.getLastName() + " " + greetedPerson.getGreeting());
+ assertNotSame("greetedPerson.getGreeting() not set", "", greetedPerson.getGreeting());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/LICENSE.txt
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/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/testing/sca/itest/databindings/sdogen/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/NOTICE.txt
new file mode 100644
index 0000000000..92ca715fbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/NOTICE.txt
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2007 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/testing/sca/itest/databindings/sdogen/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/pom.xml
new file mode 100644
index 0000000000..6b16fa2205
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/pom.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>iTest-sdoDatabinding</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SDO Databindings</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>itest-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${project.build.directory}/classes/wsdl/Greeter.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${project.build.directory}/classes/xsd/Person.xsd</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.types</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${project.build.directory}/classes/xsd/Interop.xsd</fileName>
+ <javaPackage>org.apache.tuscany.interop</javaPackage>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..b87ddc8f02
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/generate.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+ <Template>
+ <TemplateName>pom.xml.vm</TemplateName>
+ <TemplateTargetDir>..</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>greeter.composite.vm</TemplateName>
+ <TemplateTargetDir>classes</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>GreeterService.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>DatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>Greeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage>
+ <Factory>TypesFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ TypesFactory factory = TypesFactory.INSTANCE;
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.interop</JavaPackage>
+ <Factory>InteropFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
new file mode 100644
index 0000000000..301c3de322
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="SDOGreeterService">
+
+ <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.services.ServicesFactory"/>
+ <!-- SDO factory classes -->
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+
+ <!-- Services Exposed via different bindings -->
+ <service name="SDOGreeterServiceDefaultBinding">
+ <interface.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterService" />
+ <reference>SDOGreeterServiceComponent</reference>
+ </service>
+
+ <service name="GreeterServiceWebServiceBinding">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ <reference>SDOGreeterServiceComponent</reference>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="SDOGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <!--reference name="greeterService">SDOGreeterServiceDefaultRef</reference-->
+ <reference name="greeterService">SDOGreeterServiceComponent</reference>
+ </component>
+
+ <reference name="SDOGreeterServiceDefaultRef">
+ <interface.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterService" />
+ </reference>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService">SDOGreeterServiceWSRef</reference>
+ </component>
+
+ <reference name="SDOGreeterServiceWSRef">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"
+ wsdli:wsdlLocation="http://apache.org/tuscany/sca/itest/databinding/services wsdl/Greeter.wsdl" />
+ <binding.ws
+ endpoint="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.endpoint(GreeterService/GreeterPort)"
+ location="wsdl/Greeter.wsdl" />
+ </reference>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/.ruleset b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/.ruleset
new file mode 100644
index 0000000000..e615e93a4b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/.ruleset
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset name="pmd-eclipse">
+ <description>PMD Plugin preferences rule set</description>
+
+
+ <rule ref="rulesets/basic.xml/BooleanInstantiation"/>
+ <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/>
+ <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/>
+<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>-->
+ <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/>
+<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>-->
+<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>-->
+ <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/>
+ <rule ref="rulesets/basic.xml/JumbledIncrementer"/>
+<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>-->
+ <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/>
+ <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
+ <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
+<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>-->
+
+<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>-->
+<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>-->
+
+<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>-->
+<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>-->
+<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>-->
+
+<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
+<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
+<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
+
+<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
+<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
+<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>-->
+<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>-->
+<!--<rule ref="rulesets/controversial.xml/SingularField"/>-->
+<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>-->
+<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>-->
+<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/>
+<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>-->
+
+<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>-->
+<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>-->
+<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>-->
+
+<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>-->
+<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>-->
+<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>-->
+<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/>
+<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>-->
+<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>-->
+<!--<rule ref="rulesets/design.xml/BadComparison"/>-->
+<!--<rule ref="rulesets/design.xml/CloseConnection"/>-->
+<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>-->
+<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>-->
+<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/>
+<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>-->
+<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>-->
+<rule ref="rulesets/design.xml/IdempotentOperations"/>
+<!--<rule ref="rulesets/design.xml/ImmutableField"/>-->
+<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>-->
+<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>-->
+<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>-->
+<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>-->
+<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>-->
+<rule ref="rulesets/design.xml/OptimizableToArrayCall"/>
+<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/>
+<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/>
+<rule ref="rulesets/design.xml/SimplifyConditional"/>
+<!--<rule ref="rulesets/design.xml/SwitchDensity"/>-->
+<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>-->
+<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/>
+<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>-->
+<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>-->
+<!--<rule ref="rulesets/design.xml/UseSingleton"/>-->
+
+<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>-->
+<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>-->
+<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>-->
+
+<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>-->
+<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>-->
+<!--<rule ref="rulesets/imports.xml/UnusedImports"/>-->
+<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>-->
+
+<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>-->
+<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>-->
+
+<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>-->
+<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>-->
+<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>-->
+<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>-->
+<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>-->
+
+ <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>-->
+ <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>-->
+ <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>-->
+
+ <!--<rule ref="rulesets/naming.xml/ShortVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/LongVariable"/>-->
+ <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>-->
+ <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>-->
+ <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>-->
+ <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>-->
+ <!--<rule ref="rulesets/naming.xml/NoPackage"/>-->
+ <!--<rule ref="rulesets/naming.xml/PackageCase"/>-->
+
+ <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>-->
+ <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>-->
+
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>-->
+ <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>-->
+
+ <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>-->
+ <!--<rule ref="rulesets/strings.xml/StringToString"/>-->
+ <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>-->
+ <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>-->
+
+ <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>-->
+ <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>-->
+
+ <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
+ <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
+ <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+
+</ruleset>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/LICENSE.txt
new file mode 100755
index 0000000000..d645695673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/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/testing/sca/itest/databindings/transformers/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/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/testing/sca/itest/databindings/transformers/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/pom.xml
new file mode 100755
index 0000000000..688a7e464d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/pom.xml
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>databindings</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-databinding-transformers</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany DataBinding Transformers Integration Test</name>
+ <description>Apache Tuscany DataBinding Transformers Integration Test</description>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-spi</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-xmlbeans</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.4</version>
+ <scope>test</scope>
+ <!-- Relacing stax 1.0 with stax 1.0.1 -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jsr173_api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/jaxb-source</source>
+ <source>target/sdo-source</source>
+ <source>target/xmlbeans-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
+ <javaPackage>com.example.ipo.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>com.sun.tools.xjc.maven2</groupId>
+ <artifactId>maven-jaxb-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <generatePackage>com.example.ipo.jaxb</generatePackage>
+ <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
+ <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
+ <includeSchemas>
+ <includeSchema>ipo.xsd</includeSchema>
+ </includeSchemas>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>generate-xmlbeans</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="maven.compile.classpath"/>
+ <xmlbean schema="${basedir}/src/test/resources" classpathref="maven.compile.classpath"
+ destfile="${project.build.directory}/ipo-xmlbeans.jar" srcgendir="${project.build.directory}/xmlbeans-source"
+ javasource="1.5" classgendir="${project.build.directory}/test-classes" />
+ </tasks>
+ <!--
+ <sourceRoot>${project.build.directory}/xmlbeans-source</sourceRoot>
+ <testSourceRoot>${project.build.directory}/xmlbeans-source</testSourceRoot>
+ -->
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java
new file mode 100755
index 0000000000..894bee16e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.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.databinding;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB;
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+public class JAXBTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ DataType targetDataType = new DataType<Class>(Object.class, null);
+ targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ // XMLStreamReader to JAXB
+ XMLStreamReader2JAXB t2 = new XMLStreamReader2JAXB();
+ Object object2 = t2.transform(reader, tContext);
+
+ DataType sourceDataType = new DataType<Class>(Object.class, null);
+ sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t3 = new JAXB2Node();
+ Node node = t3.transform(object2, tContext1);
+
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+
+ Assert.assertNotNull(object3);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
new file mode 100755
index 0000000000..62183bd09d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.TransformerRegistryImpl;
+import org.apache.tuscany.core.databinding.xml.Node2String;
+import org.apache.tuscany.core.databinding.xml.String2Node;
+import org.apache.tuscany.core.databinding.xml.String2XMLStreamReader;
+import org.apache.tuscany.core.databinding.xml.XMLStreamReader2String;
+import org.apache.tuscany.databinding.axiom.OMElement2String;
+import org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader;
+import org.apache.tuscany.databinding.axiom.String2OMElement;
+import org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement;
+import org.apache.tuscany.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB;
+import org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader;
+import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2Node;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.tuscany.sdo.util.SDOUtil;
+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.TransformerRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class TransformationTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private TransformerRegistry registry;
+
+ private String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new TransformerRegistryImpl();
+
+ List<Transformer> transformers = new ArrayList<Transformer>();
+
+ // Adding JAXB transformers
+ transformers.add(new JAXB2Node());
+ transformers.add(new Node2JAXB());
+ transformers.add(new XMLStreamReader2JAXB());
+
+ // Adding XMLBeans transformers
+ transformers.add(new XmlObject2Node());
+ transformers.add(new XmlObject2XMLStreamReader());
+ transformers.add(new Node2XmlObject());
+ transformers.add(new XMLStreamReader2XmlObject());
+
+ transformers.add(new DataObject2XMLStreamReader());
+ transformers.add(new XMLStreamReader2DataObject());
+
+ transformers.add(new XMLDocument2XMLStreamReader());
+ transformers.add(new XMLStreamReader2XMLDocument());
+
+ transformers.add(new String2XMLStreamReader());
+ transformers.add(new XMLStreamReader2String());
+
+ transformers.add(new String2Node());
+ transformers.add(new Node2String());
+
+ transformers.add(new OMElement2String());
+ transformers.add(new String2OMElement());
+
+ transformers.add(new XMLStreamReader2OMElement());
+ transformers.add(new OMElement2XMLStreamReader());
+
+ for (Transformer transformer : transformers) {
+ registry.registerTransformer(transformer);
+ }
+
+ // System.out.println(registry);
+
+ URL xsdFile = getClass().getClassLoader().getResource("ipo.xsd");
+ XSDHelper.INSTANCE.define(xsdFile.openStream(), null);
+ }
+
+ @SuppressWarnings("unchecked")
+ // XMLBeans --> SDO
+ public void testTransformation1() throws Exception {
+ URL xsdFile = getClass().getClassLoader().getResource("ipo.xsd");
+ HelperContext helperContext = SDOUtil.createHelperContext();
+ XSDHelper xsdHelper = helperContext.getXSDHelper();
+ xsdHelper.define(xsdFile.openStream(), xsdFile.toExternalForm());
+
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ List<Transformer> path =
+ registry.getTransformerChain(XmlObject.class.getName(), DataObject.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+ // tContext.getMetadata().put(ImportSDO.class, new ImportSDO(helperContext));
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof DataObject);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ // SDO --> DOM
+ public void testTransformation2() throws Exception {
+ // System.out.println(registry);
+
+ URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ XMLDocument object = XMLHelper.INSTANCE.load(xmlFile.openStream());
+
+ List<Transformer> path =
+ registry.getTransformerChain(XMLDocument.class.getName(), Node.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof Node);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ // SDO --> JAXB
+ public void testTransformation3() throws Exception {
+ // System.out.println(registry);
+
+ URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ XMLDocument object = XMLHelper.INSTANCE.load(xmlFile.openStream());
+
+ List<Transformer> path =
+ registry.getTransformerChain(XMLDocument.class.getName(), JAXBElement.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof Object);
+
+ }
+
+ private TransformationContext createTransformationContext() {
+ DataType dataType = new DataType<Class>(Object.class, null);
+ dataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(dataType).anyTimes();
+
+ expect(tContext.getSourceDataType()).andReturn(dataType).anyTimes();
+ Map<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+ expect(tContext.getMetadata()).andReturn(metadata).anyTimes();
+ replay(tContext);
+ return tContext;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java
new file mode 100755
index 0000000000..78d51352cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2Node;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+public class XmlObjectTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ XmlObject object2 = t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ /*
+ * public void testGeneratedXmlObject() throws Exception { URL xmlFile =
+ * getClass().getClassLoader().getResource("ipo.xml"); // URL/Stream/Reader
+ * to XmlObject PurchaseOrderDocument object =
+ * PurchaseOrderDocument.Factory.parse(xmlFile); // XmlObject to
+ * XMLStreamReader XmlObject2XMLStreamReader t1 = new
+ * XmlObject2XMLStreamReader(); XMLStreamReader reader =
+ * t1.transform(object, null); // XMLStreamReader to XmlObject
+ * XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject(); XmlObject
+ * object2 = t2.transform(reader, null); // XmlObject to Node XmlObject2Node
+ * t3 = new XmlObject2Node(); Node node = t3.transform(object2, null); //
+ * Node to XmlObject Node2XmlObject t4 = new Node2XmlObject(); XmlObject
+ * object3 = t4.transform(node, null); Assert.assertNotNull(object3); }
+ */
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Client.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Client.java
new file mode 100644
index 0000000000..8ddc625d66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Client.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.databinding.sample;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Client {
+ void call(Object po);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java
new file mode 100644
index 0000000000..2d33a8666b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.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.sample;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * @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(Object po) {
+ Object ret = null;
+ if (po instanceof PurchaseOrderType) {
+ ret = echoReference.echoJAXB((PurchaseOrderType)po);
+ } else if (po instanceof com.example.ipo.sdo.PurchaseOrderType) {
+ ret = echoReference.echoSDO((com.example.ipo.sdo.PurchaseOrderType)po);
+ } else if (po instanceof com.example.ipo.xmlbeans.PurchaseOrderType) {
+ ret = echoReference.echoXMLBeans((com.example.ipo.xmlbeans.PurchaseOrderType)po);
+ }
+ System.out.println("Returned message: " + ret);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTestCase.java
new file mode 100644
index 0000000000..f74b3558e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTestCase.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sample;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.databinding.sdo.String2DataObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.idl.XMLType;
+import org.apache.tuscany.spi.model.DataType;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.xmlbeans.PurchaseOrderDocument;
+import commonj.sdo.DataObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingBootStrapTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private Client client;
+ private String contextPath = "com.example.ipo.jaxb";
+
+ @SuppressWarnings("unchecked")
+ public void testDataBindingBootstrap() throws Exception {
+ DataType targetDataType = new DataType<XMLType>(Object.class, XMLType.UNKNOWN);
+ targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ String2DataObject t1 = new String2DataObject();
+ DataObject po1 = t1.transform(IPO_XML, null);
+ client.call(po1);
+
+ PurchaseOrderDocument.Factory.newInstance();
+
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ PurchaseOrderDocument po2 = (PurchaseOrderDocument)t2.transform(reader, null);
+ client.call(po2.getPurchaseOrder());
+
+ QName root = new QName("http://www.example.com/IPO", "purchaseOrder");
+ DataType targetDataType1 = new DataType<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getTargetDataType()).andReturn(targetDataType1).anyTimes();
+ replay(tContext1);
+ Reader2JAXB t3 = new Reader2JAXB();
+ PurchaseOrderType po3 = (PurchaseOrderType)t3.transform(new StringReader(IPO_XML), tContext1);
+ client.call(po3);
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("DataBindingTest.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/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Echo.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Echo.java
new file mode 100644
index 0000000000..c44e575e26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/Echo.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.databinding.sample;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Service
+public interface Echo {
+ @DataType(name="javax.xml.bind.JAXBElement")
+ PurchaseOrderType echoJAXB(PurchaseOrderType po);
+
+ @DataType(name="commonj.sdo.DataObject")
+ com.example.ipo.sdo.PurchaseOrderType echoSDO(com.example.ipo.sdo.PurchaseOrderType po);
+
+ @DataType(name="org.apache.xmlbeans.XmlObject")
+ com.example.ipo.xmlbeans.PurchaseOrderType echoXMLBeans(com.example.ipo.xmlbeans.PurchaseOrderType po);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java
new file mode 100644
index 0000000000..775c0317a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.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.databinding.sample;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoImpl implements Echo {
+
+ public PurchaseOrderType echoJAXB(PurchaseOrderType po) {
+ System.out.println("JAXB: " + po);
+ return po;
+ }
+
+ public com.example.ipo.sdo.PurchaseOrderType echoSDO(com.example.ipo.sdo.PurchaseOrderType po) {
+ System.out.println("SDO: " + po);
+ return po;
+ }
+
+ public com.example.ipo.xmlbeans.PurchaseOrderType echoXMLBeans(com.example.ipo.xmlbeans.PurchaseOrderType po) {
+ System.out.println("XMLBeans: " + po);
+ return po;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/DataBindingTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/DataBindingTest.composite
new file mode 100644
index 0000000000..9f9d0467a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/DataBindingTest.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:db="http://tuscany.apache.org/xmlns/databinding/1.0"
+ name="DataBindingTest">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" factory="com.example.ipo.sdo.SdoFactory"/>
+
+ <component name="Client">
+ <implementation.java class="org.apache.tuscany.databinding.sample.ClientImpl" />
+ <reference name="echoReference">Echo</reference>
+ </component>
+
+ <component name="Echo">
+ <implementation.java class="org.apache.tuscany.databinding.sample.EchoImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xml
new file mode 100755
index 0000000000..58058dbe1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<ipo:purchaseOrder
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ipo="http://www.example.com/IPO"
+ xsi:schemaLocation="http://www.example.com/IPO ipo.xsd"
+ orderDate="1999-12-01">
+
+ <shipTo exportCode="1" xsi:type="ipo:UKAddress">
+ <name>Helen Zoe</name>
+ <street>47 Eden Street</street>
+ <city>Cambridge</city>
+ <postcode>CB1 1JR</postcode>
+ </shipTo>
+
+ <billTo xsi:type="ipo:USAddress">
+ <name>Robert Smith</name>
+ <street>8 Oak Avenue</street>
+ <city>Old Town</city>
+ <state>PA</state>
+ <zip>95819</zip>
+ </billTo>
+
+ <items>
+ <item partNum="833-AA">
+ <productName>Lapis necklace</productName>
+ <quantity>1</quantity>
+ <USPrice>99.95</USPrice>
+ <ipo:comment>Want this for the holidays</ipo:comment>
+ <shipDate>1999-12-05</shipDate>
+ </item>
+ </items>
+</ipo:purchaseOrder>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..5468542693
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsd
@@ -0,0 +1,118 @@
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsdconfig b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsdconfig
new file mode 100755
index 0000000000..a397182672
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/databindings/transformers/src/test/resources/ipo.xsdconfig
@@ -0,0 +1,21 @@
+<!-- Copyright 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <xb:namespace uri="http://www.example.com/IPO">
+ <xb:package>com.example.ipo.xmlbeans</xb:package>
+ </xb:namespace>
+
+</xb:config>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-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/testing/sca/itest/exceptions-crossBinding-ws/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-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/testing/sca/itest/exceptions-crossBinding-ws/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/pom.xml
new file mode 100644
index 0000000000..c27a6c62a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/pom.xml
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-exceptions-crossBinding-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Exception Handling cross bindings WS</name>
+ <!-- JAX-WS temporary only until java.net maven2 repo is ready-->
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <dependencies>
+ <!-- Required extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <!-- End of Required extensions -->
+ <!-- sun's jax-ws -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- you will need to install these on your internal repo
+ https://jax-ws.dev.java.net/2.1/ download binary
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=http" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\http.jar"
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=resolver" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\resolver.jar"
+ -->
+ <!--
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>http</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>resolver</artifactId>
+ <version>2.1</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- ENDOF sun's jax-ws -->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/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 b/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
new file mode 100644
index 0000000000..2c9b2d25cb
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+@DataType(name = "javax.xml.bind.JAXBElement")
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..65751175fb
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(StockExceptionTestJAXB.class)
+public class StockExchangeJaxB implements StockExceptionTestJAXB {
+
+ /**
+ *
+ */
+ public StockExchangeJaxB() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer)
+ */
+ public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{
+
+ System.out.println("stockQuoteOffer '" + input + "'");
+
+ String symbol = input.getSymbol();
+ if ("IBM".equals(symbol)) {
+ input.setPrice(99.00F);
+ return input;
+
+ }
+ else if ("CLOSED".equals(input.getName())) {
+ throw new MarketClosedFault("TO LATE!", 3);
+
+ } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ }
+ ObjectFactory jaxbOjectFactory = new ObjectFactory();
+
+ InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault();
+
+ faultinfo.setOffer(input);
+
+ throw new InvalidSymbolFault_Exception("bad symbol", faultinfo);
+
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..5f65d293ea
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public interface StockTraderSDO {
+
+ StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ Object testNotDeclaredAtSourceTest();
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..7d303887e7
--- /dev/null
+++ b/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
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockexceptiontestservice.scatesttool.ScatesttoolFactory;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/**
+ *
+ */
+@Service(StockTraderSDO.class)
+public class StockTraderSDOImpl implements StockTraderSDO {
+
+ private StockExceptionTest exchangeJaxb;
+
+ /**
+ *
+ */
+
+ public StockTraderSDOImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Reference
+ public void setExchangeJaxb(StockExceptionTest exchangeJaxb) {
+ this.exchangeJaxb = exchangeJaxb;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest()
+ */
+ public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ stockOffer.setName("IBM");
+ stockOffer.setSymbol("IBM");
+ stockOffer.setPrice(100.00F); // offer to buy at max $100.00
+
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ return stockOfferAccepted;
+
+ }
+
+ public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException,
+ MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ // set up for a InvalidSymbolSDOException
+ stockOffer.setName("");
+ stockOffer.setSymbol("IBM0");
+
+ stockOffer.setPrice(11.0F); // offer to buy at max $100.00
+ exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ }
+
+ public void marketClosedSDOExceptionTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("CLOSED");
+ stockOffer.setSymbol("MBI");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+ stockOfferAccepted.getPrice(); // the price actually bought.
+ } catch (RemoteException e) {
+
+ e.printStackTrace();
+ } catch (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("testNotDeclaredAtSourceTest");
+ stockOffer.setSymbol("TNDAS");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..e9df6ba473
--- /dev/null
+++ b/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
@@ -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 org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+public class InvalidSymbolSDOException extends Exception {
+
+ public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault");
+
+ /**
+ *
+ */
+ public InvalidSymbolSDOException() {
+
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param cause
+ */
+ public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ // *** Below was hand added ... tooling needs to do this ***/
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..39b702afe3
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ */
+public class MarketClosedSDOException extends Exception {
+ public static final QName FAULT_ELEMENT =
+ new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault");
+
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private int faultInfo;
+
+ /**
+ *
+ */
+ public MarketClosedSDOException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public MarketClosedSDOException(String message, int faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param cause
+ */
+ public MarketClosedSDOException(int faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public MarketClosedSDOException(String message, int faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean: int
+ */
+ public int getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..7b4b3a0f29
--- /dev/null
+++ b/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
@@ -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.
+ */
+/**
+ * StockExceptionTest.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+@DataType(name = "commonj.sdo.DataObject")
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0)
+ throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..f955ba093c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/ExceptionTest.composite
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="ExceptionTest">
+
+ <include name="intracomposite" scdlLocation="intracomposite.composite"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..4dc2464c33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/intracomposite.composite
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite name="intracomposite" xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+ <dbsdo:import.sdo factory="stockexceptiontestservice.scatesttool.ScatesttoolFactory"/>
+
+ <service name="exchangeJaxbService">
+ <interface.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExceptionTestJAXB"/>
+ <binding.ws wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" wsdlLocation="http://scatesttool.stockexceptiontestservice wsdl/StockExceptionTest.wsdl"/>
+ <reference target="exchangeJaxbComponent">exchangeJaxbComponent</reference>
+ </service>
+
+ <component name="exchangeJaxbComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB"/>
+ </component>
+
+ <component name="stockTraderSDOComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl"/>
+ <reference name="exchangeJaxb"></reference>
+ </component>
+
+ <reference name="stockTraderSDOReference" promote="stockTraderSDOComponent">
+ <interface.java class="org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest"/>
+ <binding.ws wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" wsdlLocation="http://scatesttool.stockexceptiontestservice wsdl/StockExceptionTest.wsdl"/>
+ </reference>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..f5e716de94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..b4ed2b90cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding-ws/src/main/resources/xsd/StockExceptionTest.xsd
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice"
+ >
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema> \ No newline at end of file
diff --git a/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 b/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
new file mode 100644
index 0000000000..e8efe86945
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private StockTraderSDO stockTrader;
+
+ private CompositeContext context;
+
+ public void testTrading() {
+ try {
+ StockOffer sp = stockTrader.testTrading();
+ assertNotNull(sp);
+ assertEquals(99.00F, sp.getPrice());
+ assertEquals("IBM", sp.getSymbol());
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ fail(e + "");
+
+ }
+
+ }
+
+ public void testInvalidSymbolSDOException() {
+ try {
+ stockTrader.testInvalidSymbolSDOException();
+ fail("Expected InvalidSymbolSDOException");
+ } catch (InvalidSymbolSDOException e) {
+ InvalidSymbolFault isf = e.getFaultInfo();
+
+ assertNotNull(isf);
+ StockOffer sp = isf.getOffer();
+ assertEquals(11.00F, sp.getPrice());
+ assertEquals("IBM0", sp.getSymbol());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Expected InvalidSymbolSDOException" + e);
+
+ }
+ }
+
+ public void _testNotDeclaredAtSourceException() {
+
+ Object ret = stockTrader.testNotDeclaredAtSourceTest();
+
+ assertNotNull(ret);
+
+ assertEquals(TransformationException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("ExceptionTest.composite");
+
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ stockTrader = context.locateService(StockTraderSDO.class, "stockTraderSDOComponent");
+
+ assertNotNull(context);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/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/testing/sca/itest/exceptions-crossBinding/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/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/testing/sca/itest/exceptions-crossBinding/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/pom.xml
new file mode 100644
index 0000000000..6b6d981a97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/pom.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-exceptions-crossBinding</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Exception Handling cross bindings</name>
+ <!-- JAX-WS temporary only until java.net maven2 repo is ready-->
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <dependencies>
+ <!-- Required extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <!-- End of Required extensions -->
+ <!-- sun's jax-ws -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- you will need to install these on your internal repo
+ https://jax-ws.dev.java.net/2.1/ download binary
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=http" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\http.jar"
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=resolver" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\resolver.jar"
+ -->
+ <!--
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>http</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>resolver</artifactId>
+ <version>2.1</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- ENDOF sun's jax-ws -->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/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 b/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
new file mode 100644
index 0000000000..2c9b2d25cb
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+@DataType(name = "javax.xml.bind.JAXBElement")
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..65751175fb
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(StockExceptionTestJAXB.class)
+public class StockExchangeJaxB implements StockExceptionTestJAXB {
+
+ /**
+ *
+ */
+ public StockExchangeJaxB() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer)
+ */
+ public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{
+
+ System.out.println("stockQuoteOffer '" + input + "'");
+
+ String symbol = input.getSymbol();
+ if ("IBM".equals(symbol)) {
+ input.setPrice(99.00F);
+ return input;
+
+ }
+ else if ("CLOSED".equals(input.getName())) {
+ throw new MarketClosedFault("TO LATE!", 3);
+
+ } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ }
+ ObjectFactory jaxbOjectFactory = new ObjectFactory();
+
+ InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault();
+
+ faultinfo.setOffer(input);
+
+ throw new InvalidSymbolFault_Exception("bad symbol", faultinfo);
+
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..5f65d293ea
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public interface StockTraderSDO {
+
+ StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ Object testNotDeclaredAtSourceTest();
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..7d303887e7
--- /dev/null
+++ b/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
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockexceptiontestservice.scatesttool.ScatesttoolFactory;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/**
+ *
+ */
+@Service(StockTraderSDO.class)
+public class StockTraderSDOImpl implements StockTraderSDO {
+
+ private StockExceptionTest exchangeJaxb;
+
+ /**
+ *
+ */
+
+ public StockTraderSDOImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Reference
+ public void setExchangeJaxb(StockExceptionTest exchangeJaxb) {
+ this.exchangeJaxb = exchangeJaxb;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest()
+ */
+ public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ stockOffer.setName("IBM");
+ stockOffer.setSymbol("IBM");
+ stockOffer.setPrice(100.00F); // offer to buy at max $100.00
+
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ return stockOfferAccepted;
+
+ }
+
+ public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException,
+ MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ // set up for a InvalidSymbolSDOException
+ stockOffer.setName("");
+ stockOffer.setSymbol("IBM0");
+
+ stockOffer.setPrice(11.0F); // offer to buy at max $100.00
+ exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ }
+
+ public void marketClosedSDOExceptionTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("CLOSED");
+ stockOffer.setSymbol("MBI");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+ stockOfferAccepted.getPrice(); // the price actually bought.
+ } catch (RemoteException e) {
+
+ e.printStackTrace();
+ } catch (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("testNotDeclaredAtSourceTest");
+ stockOffer.setSymbol("TNDAS");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..e9df6ba473
--- /dev/null
+++ b/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
@@ -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 org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+public class InvalidSymbolSDOException extends Exception {
+
+ public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault");
+
+ /**
+ *
+ */
+ public InvalidSymbolSDOException() {
+
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param cause
+ */
+ public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ // *** Below was hand added ... tooling needs to do this ***/
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..39b702afe3
--- /dev/null
+++ b/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
@@ -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.sca.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ */
+public class MarketClosedSDOException extends Exception {
+ public static final QName FAULT_ELEMENT =
+ new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault");
+
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private int faultInfo;
+
+ /**
+ *
+ */
+ public MarketClosedSDOException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public MarketClosedSDOException(String message, int faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param cause
+ */
+ public MarketClosedSDOException(int faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public MarketClosedSDOException(String message, int faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean: int
+ */
+ public int getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..7b4b3a0f29
--- /dev/null
+++ b/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
@@ -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.
+ */
+/**
+ * StockExceptionTest.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+@DataType(name = "commonj.sdo.DataObject")
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0)
+ throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..f955ba093c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/ExceptionTest.composite
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="ExceptionTest">
+
+ <include name="intracomposite" scdlLocation="intracomposite.composite"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..ffdc22e934
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/intracomposite.composite
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" name="intracomposite">
+
+ <component name="stockTraderSDOComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl" />
+ <reference name="exchangeJaxb" target="exchangeJaxbComponent">exchangeJaxbComponent</reference>
+ </component>
+
+ <component name="exchangeJaxbComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB" />
+ </component>
+
+ <!-- Move to the end to verify the fix for TUSCANY-1165 -->
+ <dbsdo:import.sdo factory="stockexceptiontestservice.scatesttool.ScatesttoolFactory" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..f5e716de94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..58367acac1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/wsdl/StockExceptionTest.wsdl
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/main/resources/xsd/StockExceptionTest.xsd
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice"
+ >
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..c589c5611c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions-crossBinding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.sca.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private StockTraderSDO stockTrader;
+
+ private CompositeContext context;
+
+ public void testTrading() {
+ try {
+ StockOffer sp = stockTrader.testTrading();
+ assertNotNull(sp);
+ assertEquals(99.00F, sp.getPrice());
+ assertEquals("IBM", sp.getSymbol());
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ fail(e + "");
+
+ }
+
+ }
+
+ public void testInvalidSymbolSDOException() {
+ try {
+ stockTrader.testInvalidSymbolSDOException();
+ fail("Expected InvalidSymbolSDOException");
+ } catch (InvalidSymbolSDOException e) {
+ InvalidSymbolFault isf = e.getFaultInfo();
+
+ assertNotNull(isf);
+ StockOffer sp = isf.getOffer();
+ assertEquals(11.00F, sp.getPrice());
+ assertEquals("IBM0", sp.getSymbol());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Expected InvalidSymbolSDOException" + e);
+
+ }
+ }
+
+ public void testNotDeclaredAtSourceException() {
+
+ Object ret = stockTrader.testNotDeclaredAtSourceTest();
+
+ assertNotNull(ret);
+
+ assertEquals(TransformationException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("ExceptionTest.composite");
+
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ stockTrader = context.locateService(StockTraderSDO.class, "stockTraderSDOComponent");
+
+ assertNotNull(context);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/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/testing/sca/itest/exceptions/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/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/testing/sca/itest/exceptions/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/pom.xml
new file mode 100644
index 0000000000..154f1748e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-exceptions</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Exception Handling</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java
new file mode 100644
index 0000000000..e90289a07d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.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.sca.test.exceptions;
+
+
+public class Checked extends Exception {
+
+ /**
+ *
+ */
+ public Checked() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public Checked(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public Checked(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public Checked(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java
new file mode 100644
index 0000000000..0d14240513
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.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.sca.test.exceptions;
+
+public interface ExceptionHandler {
+
+ public abstract void testing();
+
+ public abstract Checked getTheBad();
+
+ public abstract String getTheGood();
+
+ public abstract UnChecked getTheUgly();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java
new file mode 100644
index 0000000000..80073e7679
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.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.sca.test.exceptions;
+
+public interface ExceptionThrower {
+ public static final String SO_THEY_SAY = "All is good that ends good.";
+
+ public String theGood() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+ public String theBad() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+ public String theUgly() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java
new file mode 100644
index 0000000000..1a439711dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.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.sca.test.exceptions;
+
+public class UnChecked extends RuntimeException {
+
+ /**
+ *
+ */
+ public UnChecked() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public UnChecked(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public UnChecked(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public UnChecked(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java
new file mode 100644
index 0000000000..32a23c5e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionHandler;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.apache.tuscany.sca.test.exceptions.UnChecked;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ExceptionHandlerImpl implements ExceptionHandler {
+ static final String INIT = "INIT";
+
+ private ExceptionThrower exceptionThrower;
+
+ private String theGood;
+
+ private Checked theBad;
+
+ private UnChecked theUgly;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandler#testing()
+ */
+ public void testing() {
+
+ assert exceptionThrower != null : "'exceptionThrower' never wired";
+ String result = INIT;
+ try {
+ theGood = result = exceptionThrower.theGood();
+ assert result == ExceptionThrower.SO_THEY_SAY;
+ } catch (Throwable e) {
+ assert result == INIT;
+ assert false;
+ e.printStackTrace();
+ }
+
+ result = INIT;
+ try {
+ result = exceptionThrower.theBad();
+ // incredible
+ assert false : "Expected 'Check' Exception";
+
+ } catch (Checked e) {
+ // This is good...
+ assert result == INIT;
+ theBad = e;
+ } catch (Throwable t) {
+ // This is not so good.
+ t.printStackTrace();
+ assert result == INIT;
+ assert false : "Got wrong exception '" + t.getClass().getName();
+ }
+
+ result = INIT;
+ try {
+ result = exceptionThrower.theUgly();
+ // incredible
+ assert false : "Expected 'UnCheck' Exception";
+
+ } catch (Checked e) {
+ // This is not so good...
+ assert false : "Got wrong exception '" + e.getClass().getName();
+ assert result == INIT;
+ } catch (UnChecked e) {
+ theUgly = e;
+
+ } catch (Throwable t) {
+ // This is not good.
+ assert false;
+ assert result == INIT;
+
+ System.out.println(ExceptionThrower.SO_THEY_SAY + " " + INIT);
+ }
+
+ }
+
+ @Reference
+ public void setExceptionThrower(ExceptionThrower exceptionThrower) {
+ this.exceptionThrower = exceptionThrower;
+ }
+
+ public String getTheGood() {
+ return theGood;
+ }
+
+ public Checked getTheBad() {
+ return theBad;
+ }
+
+ public UnChecked getTheUgly() {
+ return theUgly;
+ }
+
+ public ExceptionThrower getExceptionThrower() {
+ return exceptionThrower;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java
new file mode 100644
index 0000000000..c1b7c23d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.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.sca.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.apache.tuscany.sca.test.exceptions.UnChecked;
+
+/**
+ * @author rineholt
+ *
+ */
+public class ExceptionThrowerImpl implements ExceptionThrower {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theBad()
+ */
+ public String theBad() throws Checked {
+
+ throw new Checked("theBad");
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theGood()
+ */
+ public String theGood() throws Checked {
+
+ return SO_THEY_SAY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theUgly()
+ */
+ public String theUgly() throws Checked {
+
+ throw new UnChecked("theUgly");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..f955ba093c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/ExceptionTest.composite
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="ExceptionTest">
+
+ <include name="intracomposite" scdlLocation="intracomposite.composite"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..0211e1f490
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/main/resources/intracomposite.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="intracomposite">
+
+ <component name="main">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandlerImpl"/>
+ <reference name="exceptionThrower" target="exceptionThrower">exceptionThrower</reference>
+ </component>
+
+ <component name="exceptionThrower">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionThrowerImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..da0803ed91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.sca.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class IntraCompositeTestCase extends TestCase {
+ private ExceptionHandler exceptionHandler;
+
+ private CompositeContext context;
+
+ public void testALL() {
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("ExceptionTest.composite");
+
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ exceptionHandler = context.locateService(ExceptionHandler.class, "main");
+ assertNotNull(context);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/LICENSE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/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/testing/sca/itest/operation-overloading/NOTICE.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/NOTICE.txt
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/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/testing/sca/itest/operation-overloading/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/pom.xml
new file mode 100644
index 0000000000..4b92e62197
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-operation-overloading</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Operator over loading.</name>
+ <!-- JAX-WS temporary only until java.net maven2 repo is ready-->
+ <dependencies>
+ <!-- Required extensions -->
+ <!-- End of Required extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java
new file mode 100644
index 0000000000..fd6d9038eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.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.sca.test.opoverload;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ *
+ */
+//@AllowsPassByReference
+public interface OverloadASourceTarget {
+ final String opName = "operationA:";
+
+ String operationA();
+
+ String operationA(int parm1);
+
+ String operationA(int parm1, String parm2);
+
+ String operationA(String parm1, int parm2);
+
+ String operationA(String string);
+
+ String[] operationAall();
+
+} \ No newline at end of file
diff --git a/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 b/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
new file mode 100644
index 0000000000..30687f9c78
--- /dev/null
+++ b/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
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.opoverload.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadASource implements OverloadASourceTarget{
+ public OverloadASourceTarget overloadASourceTarget;
+ /**
+ *
+ */
+ public OverloadASource() {
+
+ }
+ /**
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String[] operationAall() {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ ArrayList<String> ret = new ArrayList<String>();
+ ret.add(overloadASourceTarget.operationA());
+ ret.add(overloadASourceTarget.operationA(11));
+ ret.add(overloadASourceTarget.operationA("eleven"));
+ ret.add(overloadASourceTarget.operationA(3,"three"));
+ ret.add(overloadASourceTarget.operationA("four",4));
+ return (String[]) ret.toArray(new String[ret.size()]);
+ }
+
+
+ /**
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String operationA() {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA();
+ }
+ /**
+ * @param parm1
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int)
+ */
+ public String operationA(int parm1) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1);
+ }
+ /**
+ * @param parm1
+ * @param parm2
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, java.lang.String)
+ */
+ public String operationA(int parm1, String parm2) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1, parm2);
+ }
+ public String operationA(String string) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(string);
+ }
+ /**
+ * @param parm1
+ * @param parm2
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(java.lang.String, int)
+ */
+ public String operationA(String parm1, int parm2) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1, parm2);
+ }
+
+ @Reference
+ public void setOverloadASourceTarget(OverloadASourceTarget overloadASourceTarget) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is set tonull";
+ this.overloadASourceTarget = overloadASourceTarget;
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..e83952e573
--- /dev/null
+++ b/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
@@ -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 org.apache.tuscany.sca.test.opoverload.impl;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadATarget implements OverloadASourceTarget {
+
+ /**
+ *
+ */
+ public OverloadATarget() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int)
+ */
+ public String operationA(int parm1) {
+ final String ret = opName + parm1;
+ out(ret);
+ return ret;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int,
+ * java.lang.String)
+ */
+ public String operationA(int parm1, String parm2) {
+ final String ret = opName + parm1 + parm2;
+ out(ret);
+ return ret;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String operationA() {
+ out(opName);
+ return opName;
+
+ }
+
+ public String operationA(String parm1, int parm2) {
+ final String ret = opName + parm1 + parm2;
+ out(ret);
+ return ret;
+ }
+
+ public String operationA(String parm1) {
+ final String ret = opName + parm1;
+ out(ret);
+ return ret;
+ }
+
+ private void out(String msg) {
+
+ java.lang.System.out.println(msg);
+ }
+
+ public String[] operationAall() {
+ throw new IllegalArgumentException("not supported");
+
+ }
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..8d2447a66b
--- /dev/null
+++ b/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
@@ -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.sca.test.opoverload.interceptor;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+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 MessageInterceptor implements Interceptor {
+ private Interceptor next;
+
+ private CompositeComponent compositeComponent;
+
+ private Operation<?> sourceOperation;
+
+ private Operation<?> targetOperation;
+
+ protected FileWriter fw= null;
+
+
+ public MessageInterceptor(Wire sourceWire, Operation<?> sourceOperation, Operation<?> targetOperation) {
+ super();
+ // this.sourceWire = sourceWire;
+ this.sourceOperation = sourceOperation;
+ // this.targetWire = targetWire;
+ this.targetOperation = targetOperation;
+ this.compositeComponent = sourceWire.getContainer().getParent();
+
+
+ try {
+ fw = new FileWriter("MessageInterceptor.log", true);
+ } catch (IOException e) {
+ fw= null;
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @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) {
+ out(msg.toString());
+ return msg;
+ }
+
+
+
+ private void out(String string) {
+ if( null != fw){
+ try {
+ fw.write(string);
+ fw.flush();
+ } catch (IOException e) {
+
+ }
+ }
+
+ }
+
+ /**
+ * @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;
+ }
+
+
+}
diff --git a/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 b/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
new file mode 100644
index 0000000000..5c258e2307
--- /dev/null
+++ b/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
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.opoverload.interceptor;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.SCAObject;
+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;
+
+/**
+ * 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 MessageInterceptorWirePostProcessor extends WirePostProcessorExtension {
+
+
+ public MessageInterceptorWirePostProcessor() {
+ super();
+
+ }
+
+ public void process(OutboundWire source, InboundWire target) {
+ Map<Operation<?>, OutboundInvocationChain> chains = source.getInvocationChains();
+ for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : chains.entrySet()) {
+ Operation<?> sourceOperation = entry.getKey();
+ Operation<?> targetOperation =
+ getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName());
+
+ MessageInterceptor interceptor = new MessageInterceptor(source, sourceOperation, targetOperation);
+
+ 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<Operation<?>, OutboundInvocationChain> callbackChains =
+ target.getSourceCallbackInvocationChains(targetAddress);
+ if (callbackChains == null) {
+ // callback chains could be null
+ return;
+ }
+ for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : callbackChains.entrySet()) {
+ Operation<?> sourceOperation = entry.getKey();
+ Operation<?> targetOperation =
+ getTargetOperation(source.getTargetCallbackInvocationChains().keySet(), sourceOperation.getName());
+ MessageInterceptor interceptor = new MessageInterceptor(source, sourceOperation, targetOperation);
+ 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<Operation<?>, InboundInvocationChain> chains = source.getInvocationChains();
+ for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
+ Operation<?> sourceOperation = entry.getKey();
+ Operation<?> targetOperation =
+ getTargetOperation(target.getInvocationChains().keySet(), sourceOperation.getName());
+
+ // Add the interceptor to the source side
+ MessageInterceptor interceptor = new MessageInterceptor(source, sourceOperation, targetOperation);
+
+ if (isReference) {
+
+ 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<Operation<?>> 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/testing/sca/itest/operation-overloading/src/main/resources/META-INF/sca/application.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/META-INF/sca/application.composite
new file mode 100644
index 0000000000..d92e8372fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/operation-overloading/src/main/resources/META-INF/sca/application.composite
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="OperationOverloadTest">
+
+ <component name="OverloadASourceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadASource" />
+ <reference name="overloadASourceTarget">OverloadATargetComponent</reference>
+ </component>
+
+ <component name="OverloadATargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadATarget" />
+ </component>
+
+
+</composite>
diff --git a/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 b/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
new file mode 100644
index 0000000000..87387d8e49
--- /dev/null
+++ b/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
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.sca.test.opoverload.interceptor">
+
+ <component name="MessageInterceptorWirePostProcessor">
+ <system:implementation.system class="org.apache.tuscany.sca.test.opoverload.interceptor.MessageInterceptorWirePostProcessor" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/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 b/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
new file mode 100644
index 0000000000..74c1b3cf12
--- /dev/null
+++ b/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
@@ -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.sca.test.opoverload.impl;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class OverloadATestCase extends SCATestCase {
+ private OverloadASourceTarget overloadA;
+
+ private CompositeContext context;
+
+
+ public void testOperationAall() {
+ String[] result= overloadA.operationAall();
+ assertEquals(5, result.length);
+ assertEquals(OverloadASourceTarget.opName , result[0]);
+ assertEquals(OverloadASourceTarget.opName + 11, result[1]);
+ assertEquals(OverloadASourceTarget.opName + "eleven", result[2]);
+ assertEquals(OverloadASourceTarget.opName + 3 + "three", result[3]);
+ assertEquals(OverloadASourceTarget.opName + "four" + 4, result[4]);
+ }
+
+// public void testOperationAInt() {
+// String result= overloadA.operationA(29);
+// assertEquals(OverloadASourceTarget.opName + 29, result);
+// }
+//
+// public void testOperationAString() {
+// String result= overloadA.operationA("rick:-)");
+// assertEquals(OverloadASourceTarget.opName + "rick:-)", result);
+// }
+//
+// public void testOperationAIntString() {
+// String result= overloadA.operationA(123, "Tuscany");
+// assertEquals(OverloadASourceTarget.opName +123+ "Tuscany", result);
+// }
+//
+// public void testOperationStringInt() {
+// String result= overloadA.operationA("StringInt", 77);
+// assertEquals(OverloadASourceTarget.opName + "StringInt" + 77, result);
+// }
+//
+
+ @Override
+ protected void setUp() throws Exception {
+ File cdf = new File (".");
+ String currentdir= cdf.getCanonicalPath();
+ addExtension("org.apache.tuscany.sca.test.opoverload.interceptor", new URL("file:///" + currentdir + "/src/main/resources/org/apache/tuscany/sca/test/opoverload/interceptor/MessageInterceptor.scdl"));
+ super.setUp();
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ overloadA = context.locateService(OverloadASourceTarget.class, "OverloadASourceComponent");
+
+ assertNotNull(context);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/pom.xml
new file mode 100644
index 0000000000..63a370d19d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Integration Test Suite</name>
+
+ <profiles>
+ <!-- default profile -->
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <!--module>spec</module-->
+ <module>property</module>
+ <module>exceptions</module>
+ <module>exceptions-crossBinding</module>
+ <module>exceptions-crossBinding-ws</module>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <module>callback-complexType</module>
+ <module>callback-id</module>
+ <module>callback-setCallback</module>
+ <module>callback-setCallbackConversation</module>
+ <module>wsdl</module>
+ <module>conversations</module>
+ <module>bindings</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>spec</module>
+ <module>property</module>
+ <module>exceptions</module>
+ <module>exceptions-crossBinding</module>
+ <module>exceptions-crossBinding-ws</module>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <module>callback-complexType</module>
+ <module>callback-id</module>
+ <module>callback-setCallback</module>
+ <module>callback-setCallbackConversation</module>
+ <module>conversations</module>
+ <module>wsdl</module>
+ <module>bindings</module>
+ <module>databindings</module>
+ <module>operation-overloading</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>spec</module>
+ <module>property</module>
+ <module>exceptions</module>
+ <module>exceptions-crossBinding</module>
+ <module>exceptions-crossBinding-ws</module>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <module>callback-complexType</module>
+ <module>callback-id</module>
+ <module>callback-setCallback</module>
+ <module>callback-setCallbackConversation</module>
+ <module>conversations</module>
+ <module>wsdl</module>
+ <module>bindings</module>
+ <module>databindings</module>
+ <module>operation-overloading</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/pom.xml
new file mode 100644
index 0000000000..40391d6c07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-propertyTest</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA properties</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java
new file mode 100644
index 0000000000..667b854c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.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.sca.itest;
+
+public interface ABCDComponent {
+ String getA();
+ String getB();
+ String getC();
+ String getD();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java
new file mode 100644
index 0000000000..51d4d9b3cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.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.sca.itest;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ABCDComponentImpl implements ABCDComponent {
+ private ABComponent abComponent;
+ private CDComponent cdComponent;
+
+ @Reference
+ public void setAb(ABComponent component) {
+ this.abComponent = component;
+ }
+
+ @Reference
+ public void setCd(CDComponent component) {
+ this.cdComponent = component;
+ }
+
+ public String getA() {
+ return this.abComponent.getA();
+ }
+
+ public String getB() {
+ return this.abComponent.getB();
+ }
+
+ public String getC() {
+ return this.cdComponent.getC();
+ }
+
+ public String getD() {
+ return this.cdComponent.getD();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
new file mode 100644
index 0000000000..4058ce92bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponent.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.sca.itest;
+
+import java.util.Collection;
+
+public interface ABComponent {
+
+ String getA();
+ String getB();
+ String getZ();
+ int getIntValue();
+ String getF();
+ Collection<String> getManyStringValues();
+ Collection<Integer> getManyIntegers();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
new file mode 100644
index 0000000000..b78d6380ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class ABComponentImpl implements ABComponent {
+
+ private String aProperty;
+ private String bProperty;
+ private int intValue;
+ private Collection<String> manyStringValues;
+ private Collection<Integer> manyIntegerValues;
+ private String zProperty;
+ private String fProperty;
+
+ @Property(name="xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+ @Property(name="foobar")
+ public void setManyStringValues(final Collection<String> value) {
+ this.manyStringValues = value;
+ }
+
+ @Property(name="fooInts")
+ public void setManyIntegers(final Collection<Integer> value) {
+ this.manyIntegerValues = value;
+ }
+
+ @Property
+ public void setA(final String A) {
+ this.aProperty = A;
+ }
+
+ @Property
+ public void setB(final String B) {
+ this.bProperty = B;
+ }
+
+ @Property
+ public void setF(final String F) {
+ this.fProperty = F;
+ }
+
+ @Property
+ public void setOne(final int value) {
+ this.intValue = value;
+ }
+
+ public String getA() {
+ return this.aProperty;
+ }
+
+ public String getB() {
+ return this.bProperty;
+ }
+
+ public int getIntValue() {
+ return this.intValue;
+ }
+
+ public String getZ() {
+ return this.zProperty;
+ }
+
+ public String getF() {
+ return this.fProperty;
+ }
+
+ public Collection<String> getManyStringValues() {
+ return manyStringValues;
+ }
+
+ public Collection<Integer> getManyIntegers() {
+ return manyIntegerValues;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
new file mode 100644
index 0000000000..cd3046c62c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponent.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.sca.itest;
+
+import java.util.Collection;
+
+public interface CDComponent {
+
+ String getC();
+ String getC2();
+ String getD();
+ String getNoSource();
+ String getFileProperty();
+ Collection<String> getManyValuesFileProperty();
+ int getOverrideValue();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
new file mode 100644
index 0000000000..aec71d30f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class CDComponentImpl implements CDComponent {
+
+ private String cProperty;
+ private String dProperty;
+ private String nosource;
+ private String fileProperty;
+ private Collection<String> manyValuesFileProperty;
+ private int overrideNumber;
+ private String cProperty2;
+
+ @Property(name="nonFileProperty")
+ public void setC2(final String value) {
+ this.cProperty2 = value;
+ }
+ @Property(name="two")
+ public void setOverrideNumber(final int value) {
+ this.overrideNumber = value;
+ }
+
+ @Property(name="fileProperty")
+ public void setFileProp(final String value) {
+ this.fileProperty = value;
+ }
+
+ @Property(name="manyValuesFileProperty")
+ public void setFileManyValueProp(final Collection<String> values) {
+ this.manyValuesFileProperty = values;
+ }
+
+ @Property
+ public void setC(final String C) {
+ this.cProperty = C;
+ }
+
+ @Property
+ public void setD(final String D) {
+ this.dProperty = D;
+ }
+
+ @Property
+ public void setNosource(final String value) {
+ this.nosource = value;
+ }
+
+ public String getFileProperty() {
+ return this.fileProperty;
+ }
+
+ public String getC() {
+ return this.cProperty;
+ }
+
+ public String getC2() {
+ return this.cProperty2;
+ }
+
+ public String getD() {
+ return this.dProperty;
+ }
+
+ public String getNoSource() {
+ return this.nosource;
+ }
+
+ public int getOverrideValue() {
+ return this.overrideNumber;
+ }
+ public Collection<String> getManyValuesFileProperty() {
+ return this.manyValuesFileProperty;
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
new file mode 100644
index 0000000000..1f3e4a0a41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
@@ -0,0 +1,69 @@
+package org.apache.tuscany.sca.itest;
+
+public class ComplexPropertyBean {
+
+ protected int integerNumber = 25;
+ public float floatNumber = 50;
+ public double doubleNumber = 75;
+ public int[] intArray = null;
+ public double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ public ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ public String toString() {
+ return Double.toString(integerNumber) + " - " +
+ Double.toString(floatNumber) + " - " +
+ Double.toString(doubleNumber) + " \n" +
+ ((intArray == null ) ? "no int array" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "no double array" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "no string array" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "no numberset array" : numberSetArray[0] + " - " + numberSetArray[1] + " \n " ) +
+ ((numberSet == null ) ? "" : numberSet.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java
new file mode 100644
index 0000000000..116cdef48f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideService.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.sca.itest;
+
+public interface OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java
new file mode 100644
index 0000000000..a36bb5e419
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.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.sca.itest;
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
new file mode 100644
index 0000000000..a76f17bcad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.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.sca.itest;
+
+import java.util.Collection;
+
+
+public interface PropertyComponent {
+ public String getLocation();
+ public String getYear();
+ public ComplexPropertyBean getComplexPropertyOne();
+ public ComplexPropertyBean getComplexPropertyTwo();
+ public ComplexPropertyBean getComplexPropertyThree();
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
new file mode 100644
index 0000000000..be99611dfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class PropertyComponentImpl implements PropertyComponent {
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ public String getLocation(){
+ return location;
+ }
+
+ public String getYear(){
+ return year;
+ }
+
+ public ComplexPropertyBean getComplexPropertyOne() {
+ //System.out.println(complexPropertyOne);
+ return complexPropertyOne;
+ }
+
+ public ComplexPropertyBean getComplexPropertyTwo() {
+ //System.out.println(complexPropertyTwo);
+ return complexPropertyTwo;
+ }
+
+ public ComplexPropertyBean getComplexPropertyThree() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyThree;
+ }
+
+ public Collection<ComplexPropertyBean> getComplexPropertyFour() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyFour;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java
new file mode 100644
index 0000000000..f20d295a06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/java/org/apache/tuscany/sca/itest/PropertyService.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.sca.itest;
+
+public interface PropertyService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite
new file mode 100644
index 0000000000..e48a8cc606
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/PropertyTest.composite
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="PropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <property name="number" type="xsd:int">1</property>
+ <property name="complex" type="foo:MyComplexType" >
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>a</foo:a>
+ <foo:b>b</foo:b>
+ <foo:c>c</foo:c>
+ <foo:d>d</foo:d>
+ <foo:x>
+ <foo:y>y</foo:y>
+ <foo:z>z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+
+ <property name="moreComplex" type="foo:MyMoreComplexType">
+ <foo:MyMoreComplexValue xsi:type="foo:MyMoreComplexType">
+ <foo:stringArray>TestString_1</foo:stringArray>
+ <foo:stringArray>TestString_2</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11</foo:floatNumber>
+ <foo:doubleNumber>111</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22</foo:floatNumber>
+ <foo:doubleNumber>222</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:MyMoreComplexValue>
+ </property>
+
+ <component name="ABCDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.ABCDComponentImpl"/>
+ <reference name="ab" target="ABComponent"></reference>
+ <reference name="cd" target="CDComponent"></reference>
+ </component>
+
+ <component name="ABComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.ABComponentImpl"/>
+ <property name="a" source="$complex/foo:MyComplexValue/foo:a"/>
+ <property name="b" source="$complex/foo:MyComplexValue/foo:b"/>
+ <property name="f" source="$complex/foo:MyComplexValue/foo:a">f</property>
+ <property name="xpath" source="$complex/foo:MyComplexValue/foo:x/*[local-name()='z']"/>
+ <property name="one" source="$number"/>
+ <property name="foobar">
+ <value>Apache</value>
+ <value>Tuscany</value>
+ <value>Java SCA</value>
+ </property>
+ <property name="fooInts">
+ <value>123</value>
+ <value>456</value>
+ <value>789</value>
+ </property>
+ </component>
+
+
+ <component name="CDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.CDComponentImpl"/>
+ <property name="c" source="$complex/foo:MyComplexValue/foo:c"/>
+ <property name="d" source="$complex/foo:MyComplexValue/foo:d"/>
+ <property name="nosource">aValue</property>
+ <property name="fileProperty" file="fileProperty.txt"/>
+ <property name="manyValuesFileProperty" file="manyValuesFileProperty.txt"/>
+ <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/>
+ <property name="two" source="$number">2</property>
+ </component>
+
+ <component name="PropertyComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/>
+ <property name="complexPropertyOne" source="$moreComplex"></property>
+ <property name="complexPropertyTwo">
+ <foo:MyAnotherComplexValue>
+ <foo:stringArray>TestString_1</foo:stringArray>
+ <foo:stringArray>TestString_2</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11</foo:floatNumber>
+ <foo:doubleNumber>111</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22</foo:floatNumber>
+ <foo:doubleNumber>222</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:MyAnotherComplexValue>
+ </property>
+ <property name="complexPropertyThree" element="foo:PropertyThreeElement">
+ <foo:PropertyThreeElement>
+ <foo:stringArray>TestElementString_1</foo:stringArray>
+ <foo:stringArray>TestElementString_2</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11</foo:floatNumber>
+ <foo:doubleNumber>111</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSetArray>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22</foo:floatNumber>
+ <foo:doubleNumber>222</foo:doubleNumber>
+ </foo:numberSetArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyThreeElement>
+ </property>
+ <property name="complexPropertyFour" element="foo:PropertyFourElement" >
+ <foo:PropertyFourElement>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11.11</foo:floatNumber>
+ <foo:doubleNumber>111.111</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>11</foo:integerNumber>
+ <foo:floatNumber>1111.1111</foo:floatNumber>
+ <foo:doubleNumber>11111.11111</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ <foo:PropertyFourElement>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22.22</foo:floatNumber>
+ <foo:doubleNumber>222.222</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>22</foo:integerNumber>
+ <foo:floatNumber>2222.2222</foo:floatNumber>
+ <foo:doubleNumber>22222.22222</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ <foo:PropertyFourElement>
+ <foo:integerNumber>3</foo:integerNumber>
+ <foo:floatNumber>33.33</foo:floatNumber>
+ <foo:doubleNumber>333.333</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>33</foo:integerNumber>
+ <foo:floatNumber>3333.3333</foo:floatNumber>
+ <foo:doubleNumber>33333.33333</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ </property>
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt
new file mode 100644
index 0000000000..c530ae892d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/fileProperty.txt
@@ -0,0 +1 @@
+<filePropertyTest>fileValue</filePropertyTest>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt
new file mode 100644
index 0000000000..328b9b3767
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/main/resources/manyValuesFileProperty.txt
@@ -0,0 +1,6 @@
+<manyFilePropertyValues>
+ <value>fileValueOne</value>
+ <value>fileValueTwo</value>
+ <value>fileValueThree</value>
+ <value>fileValueFour</value>
+</manyFilePropertyValues>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
new file mode 100644
index 0000000000..e72cdd24bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/property/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class PropertyTestCase {
+ private static ABComponent abService;
+ private static CDComponent cdService;
+ private static ABCDComponent abcdService;
+ private static PropertyComponent propertyService;
+
+ @Test
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ @Test
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ @Test
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ @Test
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+
+ @Test
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ @Test
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ @Test
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+ @Test
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ @Test
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ @Test
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ @Test
+ public void testManyValuesFileProperty() {
+ Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+ iterator.next();
+ String secondValue = iterator.next();
+ assertEquals(4, cdService.getManyValuesFileProperty().size());
+ assertEquals("fileValueTwo", secondValue);
+ }
+
+ @Test
+ public void testABCD() {
+ assertEquals("a", abcdService.getA());
+ assertEquals("b", abcdService.getB());
+ assertEquals("c", abcdService.getC());
+ assertEquals("d", abcdService.getD());
+ }
+
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = abService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = abService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+
+ @Test
+ public void testComplexPropertyOne() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
+ assertNotNull(propBean);
+ assertEquals("TestString_1", propBean.getStringArray()[0]);
+ assertEquals(2, propBean.numberSetArray[1].integerNumber);
+ }
+
+ @Test
+ public void testComplexPropertyTwo() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
+ assertNotNull(propBean);
+ assertEquals(10, propBean.intArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ @Test
+ public void testComplexPropertyThree() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
+ assertNotNull(propBean);
+ assertEquals("TestElementString_1", propBean.stringArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ @Test
+ public void testComplexPropertyFour() {
+ Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray();
+ assertNotNull(propBeanCollection);
+ assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber());
+ assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber());
+ assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber());
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ SCARuntime.start("PropertyTest.composite");
+ abService = CurrentCompositeContext.getContext().locateService(ABComponent.class, "ABComponent");
+ cdService = CurrentCompositeContext.getContext().locateService(CDComponent.class, "CDComponent");
+ abcdService = CurrentCompositeContext.getContext().locateService(ABCDComponent.class, "ABCDComponent");
+ propertyService =
+ CurrentCompositeContext.getContext().locateService(PropertyComponent.class, "PropertyComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/pom.xml
new file mode 100644
index 0000000000..74f389f743
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-spec</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA Spec APIs</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
new file mode 100644
index 0000000000..7fe9fa4909
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.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.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
new file mode 100644
index 0000000000..a381fc62dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.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.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ //FIXME renaming method due to TUSCANY-1173. Original name getHolidays
+ String[] getHolidaysByYear(int year);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
new file mode 100644
index 0000000000..fbb2161df3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
new file mode 100644
index 0000000000..98490c4e3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ //FIXME renaming method due to TUSCANY-1173. Original name nextHoliday
+ Date nextHolidayByDate(Date date);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
new file mode 100644
index 0000000000..6a4cfc1f79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.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.sca.test.spec;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
new file mode 100644
index 0000000000..2b54ce2740
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.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.sca.test.spec;
+
+import org.osoa.sca.CompositeContext;
+
+public interface SCAComponentService {
+ String getComponentName();
+
+ CompositeContext getContext();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
new file mode 100644
index 0000000000..5170c32cd2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.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.sca.test.spec.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = false)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidaysByYear(new Integer(year).intValue());
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (int i = 0; i < myListServicesList.size(); i++) {
+ myService = myListServicesList.get(i);
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (int i = 0; i < myListServicesArray.length; i++) {
+ myService = myListServicesArray[i];
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
new file mode 100644
index 0000000000..7e8575a0a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ private String componentName;
+
+ @Context
+ private CompositeContext context;
+
+ public MyServiceImpl() {
+ // System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHolidayByDate(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHolidayByDate(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (int j = 0; j < days.length; j++) {
+ d1 = new Date(days[j]);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidaysByYear(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ // System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ // System.out.println("Stop service..");
+
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public CompositeContext getContext() {
+ return context;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..9d382341e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.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.sca.test.spec.impl;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidaysByYear(int year) {
+ return myListServiceByYear.getHolidaysByYear(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public CompositeContext getContext() {
+ return myService.getContext();
+ }
+
+ public Date nextHolidayByDate(Date date) {
+ return myServiceByDate.nextHolidayByDate(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite
new file mode 100644
index 0000000000..fdaa23379c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="CompositeTest">
+
+ <include name="myTotalService" scdlLocation="myTotalService.composite"/>
+ <include name="myListService" scdlLocation="myListService.composite"/>
+ <include name="mySimpleServiceInRecursive" scdlLocation="mySimpleServiceInRecursive.composite"/>
+ <include name="myServiceInRecursive" scdlLocation="myServiceInRecursive.composite"/>
+ <include name="mySimpleServiceInRecursive2" scdlLocation="mySimpleServiceInRecursive2.composite"/>
+ <include name="MyTotalServiceInRecursive" scdlLocation="myTotalServiceInRecursive.composite"/>
+ <include name="MyTotalServiceInRecursiveForReferenceOverride" scdlLocation="myTotalServiceInRecursiveForReferenceOverride.composite"/>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite
new file mode 100644
index 0000000000..0094d119e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyListServiceTest">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <reference name="myListServiceList" target="MyNCService/MyListService"></reference>
+ <reference name="myListServiceArray" target="MyListServiceFor2006/MyListService"></reference>
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite
new file mode 100644
index 0000000000..0d689e2c9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceInCompositeTest">
+
+ <service name="MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceComponent/MyService</reference>
+ </service>
+
+
+ <service name="MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceComponent/MyListService</reference>
+ </service>
+
+
+ <service name="MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceComponent/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceComponent/MyServiceByDate</reference>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite
new file mode 100644
index 0000000000..59341c9f8a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceInRecursiveTest">
+
+ <service name="MyServiceInRecursiveMyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceInRecursive/MyListService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceInRecursive/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceInRecursive/MyServiceByDate</reference>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite scdlLocation="myServiceInComposite.composite"/>
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite
new file mode 100644
index 0000000000..65140fced8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceTest">
+
+ <service name="MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceComponent/MyService</reference>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite
new file mode 100644
index 0000000000..e6925ee7f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite scdlLocation="mySimpleService.composite"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite
new file mode 100644
index 0000000000..4895691c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleServiceDefault">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleService</reference>
+ </service>
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceNo</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMay</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMust</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite scdlLocation="mySimpleServiceInRecursive.composite"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite
new file mode 100644
index 0000000000..d01558cdfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <include name="myservice" scdlLocation="myservice.composite"/>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyNCService/MyService"></reference>
+ <reference name="myListService" target="MyNCService/MyListService"></reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite
new file mode 100644
index 0000000000..2359323058
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceReferenceOverrideTest">
+
+ <service name="MyTotalService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponent</reference>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"></reference>
+ <reference name="myListService"></reference>
+ </component>
+
+ <reference name="MyServiceRef" promote="MyTotalServiceComponent/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef" promote="MyTotalServiceComponent/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
new file mode 100644
index 0000000000..96a8f00740
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentNo</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"></reference>
+ <reference name="myListService"></reference>
+ </component>
+
+ <reference name="MyServiceRefNo" override="no" promote="MyTotalServiceComponentNo/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" promote="MyTotalServiceComponentNo/myListService" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMay</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"></reference>
+ <reference name="myListService"></reference>
+ </component>
+
+ <reference name="MyServiceRefMay" override="may" promote="MyTotalServiceComponentMay/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" override="may" promote="MyTotalServiceComponentMay/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMust</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService"></reference>
+ <reference name="myListService"></reference>
+ </component>
+
+ <reference name="MyServiceRefMust" override="must" promote="MyTotalServiceComponentMust/myService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" override="must" promote="MyTotalServiceComponentMust/myListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite
new file mode 100644
index 0000000000..36802c75a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite scdlLocation="myServiceInComposite.composite"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceInComposite/MyService"></reference>
+ <reference name="myListService" target="MyServiceInComposite/MyListService"></reference>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceInCompositeWithRecursive</reference>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceInCompositeWithComponentService</reference>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.composite"/>
+ <reference name="MyServiceRef" target="MyServiceInComposite/MyService"></reference>
+ <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"></reference>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.composite"/>
+ <reference name="MyServiceRef" target="MyServiceInComponent/MyService"></reference>
+ <reference name="MyListServiceRef" target="MyServiceInComponent/MyListService"></reference>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
new file mode 100644
index 0000000000..4eccde41f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceNo</reference>
+ </service>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceMay</reference>
+ </service>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceMust</reference>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite scdlLocation="myTotalServiceInCompositeForReferenceOverride.composite"/>
+ <reference name="MyServiceRefNo" target="MyServiceInComposite/MyService"></reference>
+ <reference name="MyListServiceRefNo" target="MyServiceInComposite/MyListService"></reference>
+ <reference name="MyServiceRefMay" target="MyServiceInComposite/MyService"></reference>
+ <reference name="MyListServiceRefMay" target="MyServiceInComposite/MyListService"></reference>
+ <reference name="MyServiceRefMust" target="MyServiceInComposite/MyService"></reference>
+ <reference name="MyListServiceRefMust" target="MyServiceInComposite/MyListService"></reference>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite
new file mode 100644
index 0000000000..1e5f9edbd7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="MyServiceComposite">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java
new file mode 100644
index 0000000000..fe2780ed9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.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.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class ComponentServiceReferenceListTestCase extends TestCase {
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myListService = context.locateService(MyListService.class, "MyNewListService");
+ myListServiceByYear = context.locateService(MyListServiceByYear.class, "MyNewListService");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java
new file mode 100644
index 0000000000..087f77c950
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.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.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class ComponentServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService;
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHolidayByDate(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ private void test(CompositeContext context) {
+ assertNotNull("composite name is null", context.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ if (context.getRequestContext() == null)
+ System.out.println("Request context:" + context.getRequestContext());
+ else
+ display(context.getRequestContext());
+ }
+
+ private void display(RequestContext context) {
+ System.out.println("\tService name:" + context.getServiceName());
+ System.out.println("\tSecurity subject:" + context.getSecuritySubject());
+ //System.out.println("\tService reference:" + context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyTotalService.class, "MyTotalService");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java
new file mode 100644
index 0000000000..ca3ed8051d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class ComponentTestCase extends TestCase {
+ private MyService myService;
+ private MyServiceByDate myServiceByDate;
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+ private MyService myNCService;
+ private MyListService myListServiceFor2006;
+
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ private void test(CompositeContext context) {
+ assertNotNull("composite name is null", context.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ if (context.getRequestContext() == null)
+ System.out.println("Request context:" + context.getRequestContext());
+ else
+ display(context.getRequestContext());
+ }
+
+ private void display(RequestContext context) {
+ System.out.println("\tService name:" + context.getServiceName());
+ System.out.println("\tSecurity subject:" + context.getSecuritySubject());
+ //System.out.println("\tService reference:" + (Object)context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyService.class, "MyService");
+ myServiceByDate = context.locateService(MyServiceByDate.class, "MyServiceByDate");
+ myListService = context.locateService(MyListService.class, "MyListService");
+ myListServiceByYear = context.locateService(MyListServiceByYear.class, "MyListServiceByYear");
+ myNCService = context.locateService(MyService.class, "MyNCService");
+ myListServiceFor2006 = context.locateService(MyListService.class, "MyListServiceFor2006");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java
new file mode 100644
index 0000000000..ad89590600
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.test.spec;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+@SuppressWarnings("deprecation")
+public class CompositeOneService2LevelTestCase extends TestCase {
+ private static MyService myService;
+ private static MyService myServiceDefault;
+ private static MyService myServiceNo;
+ private static MyService myServiceMay;
+ private static MyService myServiceMust;
+
+ static private CompositeContext context;
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(CompositeOneService2LevelTestCase.class);
+ TestSetup wrapper = new TestSetup(suite) {
+ public void setUp() {
+ setupStatic();
+ }
+
+ public void tearDown() {
+ tearDownStatic();
+ }
+
+ };
+ return wrapper;
+ }
+
+ public static void setupStatic() {
+ if (null != context)
+ return;
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ myService = context.locateService(MyService.class, "MySimpleServiceInRecursiveComponent/MySimpleService");
+ myServiceDefault = context.locateService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = context.locateService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = context.locateService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = context.locateService(MyService.class, "MySimpleServiceMust");
+
+ }
+
+ public static void tearDownStatic() {
+ if (context != null) {
+
+ context = null;
+ SCARuntime.stop();
+ }
+ }
+
+ public void setUp() {
+ setupStatic();
+ }
+
+ static Object foo = new Object() {
+ public void finalize() throws Throwable {
+ foo = null;
+ tearDownStatic();
+ }
+
+ };
+
+ public void testPropertyFromComponent() {
+
+ assertNotNull(myService);
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+
+ assertNotNull(myServiceDefault);
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+
+ assertNotNull(myServiceNo);
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+
+ assertNotNull(myServiceMay);
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+
+ assertNotNull(myServiceMust);
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ // FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ * assertNotNull("Service component name is null",
+ * myService.getComponentName()); assertNotNull("service context is
+ * null", myService.getContext()); System.out.println("Service component
+ * name :" + myService.getComponentName()); System.out.println("service
+ * context :" + myService.getContext()); test(context);
+ */
+ }
+
+ private void test(CompositeContext context) {
+
+ assertNotNull("composite name is null", context.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ if (context.getRequestContext() == null)
+ System.out.println("Request context:" + context.getRequestContext());
+ else
+ display(context.getRequestContext());
+ }
+
+ private void display(RequestContext context) {
+ System.out.println("\tService name:" + context.getServiceName());
+ System.out.println("\tSecurity subject:" + context.getSecuritySubject());
+ // System.out.println("\tService reference:" +
+ // (Object)context.getServiceReference());
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java
new file mode 100644
index 0000000000..1b41672700
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.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 org.apache.tuscany.sca.test.spec;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeOneServiceTestCase extends TestCase {
+ private MyService myService;
+ private CompositeContext context;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ private void test(CompositeContext context) {
+ assertNotNull("composite name is null", context.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ if (context.getRequestContext() == null)
+ System.out.println("Request context:" + context.getRequestContext());
+ else
+ display(context.getRequestContext());
+ }
+
+ private void display(RequestContext context) {
+ System.out.println("\tService name:" + context.getServiceName());
+ System.out.println("\tSecurity subject:" + context.getSecuritySubject());
+ //System.out.println("\tService reference:" + context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyService.class, "MySimpleServiceInRecursive");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java
new file mode 100644
index 0000000000..7023d7981c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.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.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CompositeServiceReferenceForRefOverrideTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private CompositeContext context;
+
+ public void testPropertyWithServiceFromReferenceNo() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceFromReferenceMay() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceFromReferenceMust() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromReferenceNo() {
+ System.out.println("nextHolday()" + myService1.nextHoliday());
+ System.out.println("nextHolday(Date)" + myService1.nextHolidayByDate(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService1 = context.locateService(MyTotalService.class, "MyTotalServiceNo");
+ myService2 = context.locateService(MyTotalService.class, "MyTotalServiceMay");
+ myService3 = context.locateService(MyTotalService.class, "MyTotalServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java
new file mode 100644
index 0000000000..6128d108ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CompositeServiceReferenceTestCase extends TestCase {
+ private MyTotalService myService1;
+ private MyTotalService myService2;
+ private MyTotalService myService3;
+ private MyTotalService myService4;
+ private MyTotalService myService5;
+ private CompositeContext context;
+
+ public void testPropertyWithServiceFromRecursive() {
+ assertEquals("CARY", myService1.getLocation());
+ assertEquals("2007", myService1.getYear());
+ }
+
+ public void testPropertyWithServiceInCompositeFromRecursive() {
+ assertEquals("CARY", myService2.getLocation());
+ assertEquals("2007", myService2.getYear());
+
+ }
+
+ public void testPropertyWithServiceInCompositeFromComponent() {
+ assertEquals("CARY", myService3.getLocation());
+ assertEquals("2007", myService3.getYear());
+ }
+
+ public void testServiceFromRecursive() {
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHolidayByDate(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHolidayByDate(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidaysByYear(2007)[0]);
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService1 = context.locateService(MyTotalService.class, "MyTotalServiceFromRecursive");
+ myService2 = context.locateService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursive");
+ myService3 = context.locateService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentService");
+ myService4 = context.locateService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursiveUseService");
+ myService5 =
+ context.locateService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentServiceUseService");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java
new file mode 100644
index 0000000000..7c50a90e60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.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 org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeTestCase extends TestCase {
+ private MyService myService;
+ private MyServiceByDate myServiceByDate;
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+
+ private CompositeContext context;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ assertNotNull("Service component name is null", myService.getComponentName());
+ assertNotNull("service context is null", myService.getContext());
+
+ System.out.println("Service component name :" + myService.getComponentName());
+ System.out.println("service context :" + myService.getContext());
+
+ test(context);
+ */
+ }
+
+ private void test(CompositeContext context) {
+ assertNotNull("composite name is null", context.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ if (context.getRequestContext() == null)
+ System.out.println("Request context:" + context.getRequestContext());
+ else
+ display(context.getRequestContext());
+ }
+
+ private void display(RequestContext context) {
+ System.out.println("\tService name:" + context.getServiceName());
+ System.out.println("\tSecurity subject:" + context.getSecuritySubject());
+ //System.out.println("\tService reference:" + (Object)context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyService.class, "MyServiceInRecursiveMyService");
+ myServiceByDate = context.locateService(MyServiceByDate.class, "MyServiceInRecursiveMyServiceByDate");
+ myListService = context.locateService(MyListService.class, "MyServiceInRecursiveMyListService");
+ myListServiceByYear =
+ context.locateService(MyListServiceByYear.class, "MyServiceInRecursiveMyListServiceByYear");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/pom.xml
new file mode 100644
index 0000000000..49e697a0c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>iTest-wsdl</artifactId>
+ <version>${testing.version}</version>
+ <packaging>jar</packaging>
+ <name>Test Suite for SCA WSDL IDL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <scope>compile</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>${sdo.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile>
+ <javaPackage>com.bigbank.account</javaPackage>
+ <prefix>Account</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..501d43734c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.services.accountdata;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@DataType(name="commonj.sdo.DataObject")
+@AllowsPassByReference
+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
+ */
+ @DataType(name = "commonj.sdo.DataObject")
+ 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/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..32f77eb61a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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.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) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+ CustomerProfileData data = AccountFactory.INSTANCE.createCustomerProfileData();
+ data.setLoginID(customerProfile.getLoginID());
+ data.setAddress(customerProfile.getAddress());
+ data.setEmail(customerProfile.getEmail());
+ data.setFirstName(customerProfile.getFirstName());
+ data.setId(customerProfile.getId());
+ data.setLastName(customerProfile.getLastName());
+ data.setPassword(customerProfile.getPassword());
+ return data;
+ }
+
+ 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/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..d53b26cd04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class AccountServiceClientImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..b60b2b9b7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component2aImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..0898bbf7a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component2bImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..6073ce75b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component3aImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..81d6e0a5f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component3bImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) 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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
new file mode 100644
index 0000000000..e747eb041f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/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/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c9076ebba6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/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/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..bd527ff8e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/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/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..d706517b76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/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/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
new file mode 100644
index 0000000000..9d147dc013
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.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.sca.itest;
+
+import helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component2aImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java
new file mode 100644
index 0000000000..7556e02b36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.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.sca.itest;
+
+import helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component2bImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java
new file mode 100644
index 0000000000..e7031ff41c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.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.sca.itest;
+
+import helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component3aImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
new file mode 100644
index 0000000000..7a049ed7b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.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.sca.itest;
+
+import helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component3bImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..b56d120acf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/SDOWSDLTest.composite
@@ -0,0 +1,402 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="SDOWSDLTest">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ factory="com.bigbank.account.AccountFactory" />
+
+ <service name="AccountService1a2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3a4a</reference>
+ </service>
+ <service name="AccountService1a2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3a4b</reference>
+ </service>
+ <service name="AccountService1a2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3b4a</reference>
+ </service>
+ <service name="AccountService1a2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3b4b</reference>
+ </service>
+ <service name="AccountService1a2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3a4a</reference>
+ </service>
+ <service name="AccountService1a2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3a4b</reference>
+ </service>
+ <service name="AccountService1a2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3b4a</reference>
+ </service>
+ <service name="AccountService1a2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3b4b</reference>
+ </service>
+ <service name="AccountService1b2a3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3a4a</reference>
+ </service>
+ <service name="AccountService1b2a3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3a4b</reference>
+ </service>
+ <service name="AccountService1b2a3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3b4a</reference>
+ </service>
+ <service name="AccountService1b2a3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2a3b4b</reference>
+ </service>
+ <service name="AccountService1b2b3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3a4a</reference>
+ </service>
+ <service name="AccountService1b2b3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3a4b</reference>
+ </service>
+ <service name="AccountService1b2b3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3b4a</reference>
+ </service>
+ <service name="AccountService1b2b3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>Component2b3b4b</reference>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4a">Component3a4a</reference>
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4b">Component3a4b</reference>
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4a">Component3b4a</reference>
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4b">Component3b4b</reference>
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4a">Component3a4a</reference>
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4b">Component3a4b</reference>
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4a">Component3b4a</reference>
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4b">Component3b4b</reference>
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ <reference name="accountService" target="Ref4a">Ref4a</reference>
+ </component>
+ <component name="Component3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ <reference name="accountService" target="Ref4b">Ref4b</reference>
+ </component>
+ <component name="Component3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ <reference name="accountService" target="Ref4a">Ref4a</reference>
+ </component>
+ <component name="Component3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ <reference name="accountService" target="Ref4b">Ref4b</reference>
+ </component>
+
+ <reference name="Ref4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountService.wsdl" />
+ </reference>
+
+ <reference name="Ref4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountService.wsdl" />
+ </reference>
+
+
+ <!-- target service -->
+
+ <service name="AccountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <!-- interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" / -->
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/AccountService.wsdl" />
+ <reference>AccountServiceComponent</reference>
+ </service>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceImpl" />
+ </component>
+
+ <!-- test client -->
+
+ <component name="AccountServiceClient">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="AccountServiceRef">AccountServiceRef</reference>
+ </component>
+
+ <reference name="AccountServiceRef">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <!-- interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)" wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" / -->
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountService.wsdl" />
+ </reference>
+
+ <!-- clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2a3a4a">ClientRef1a2a3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2a3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2a3a4b">ClientRef1a2a3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2a3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2a3b4a">ClientRef1a2a3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2a3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2a3b4b">ClientRef1a2a3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2a3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2b3a4a">ClientRef1a2b3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2b3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2b3a4b">ClientRef1a2b3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2b3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2b3b4a">ClientRef1a2b3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2b3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1a2b3b4b">ClientRef1a2b3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1a2b3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2a3a4a">ClientRef1b2a3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2a3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2a3a4b">ClientRef1b2a3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2a3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2a3b4a">ClientRef1b2a3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2a3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2a3b4b">ClientRef1b2a3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2a3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2b3a4a">ClientRef1b2b3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2b3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2b3a4b">ClientRef1b2b3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2b3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2b3b4a">ClientRef1b2b3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2b3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ <reference name="accountService" target="ClientRef1b2b3b4b">ClientRef1b2b3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws endpoint="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ location="wsdl/AccountServiceC1b2b3b4b.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..61499b94e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/WSDLTest.composite
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+
+ name="WSDLTest">
+
+ <service name="HelloWorldService1a2a3a4a">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3a4a</reference>
+ </service>
+ <service name="HelloWorldService1a2a3a4b">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3a4b</reference>
+ </service>
+ <service name="HelloWorldService1a2a3b4a">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3b4a</reference>
+ </service>
+ <service name="HelloWorldService1a2a3b4b">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3b4b</reference>
+ </service>
+ <service name="HelloWorldService1a2b3a4a">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3a4a</reference>
+ </service>
+ <service name="HelloWorldService1a2b3a4b">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3a4b</reference>
+ </service>
+ <service name="HelloWorldService1a2b3b4a">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3b4a</reference>
+ </service>
+ <service name="HelloWorldService1a2b3b4b">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3b4b</reference>
+ </service>
+
+ <service name="HelloWorldService1b2a3a4a">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3a4a</reference>
+ </service>
+ <service name="HelloWorldService1b2a3a4b">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3a4b</reference>
+ </service>
+ <service name="HelloWorldService1b2a3b4a">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3b4a</reference>
+ </service>
+ <service name="HelloWorldService1b2a3b4b">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2a3b4b</reference>
+ </service>
+ <service name="HelloWorldService1b2b3a4a">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3a4a</reference>
+ </service>
+ <service name="HelloWorldService1b2b3a4b">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3a4b</reference>
+ </service>
+ <service name="HelloWorldService1b2b3b4a">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3b4a</reference>
+ </service>
+ <service name="HelloWorldService1b2b3b4b">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>Component2b3b4b</reference>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4a">Component3a4a</reference>
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4b">Component3a4b</reference>
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4a">Component3b4a</reference>
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4b">Component3b4b</reference>
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4a">Component3a4a</reference>
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4b">Component3a4b</reference>
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4a">Component3b4a</reference>
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4b">Component3b4b</reference>
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" target="Ref4a">Ref4a</reference>
+ </component>
+ <component name="Component3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" target="Ref4b">Ref4b</reference>
+ </component>
+ <component name="Component3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" target="Ref4a">Ref4a</reference>
+ </component>
+ <component name="Component3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" target="Ref4b">Ref4b</reference>
+ </component>
+
+ <reference name="Ref4a">
+ <interface.java class="helloworld.HelloWorldService" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworld.wsdl" />
+ </reference>
+
+ <reference name="Ref4b">
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworld.wsdl" />
+ </reference>
+
+
+<!-- the servive -->
+
+ <service name="HelloWorldWebService">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)" location="wsdl/helloworld.wsdl" />
+ <reference>HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+<!-- the clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2a3a4a">ClientRef1a2a3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3a4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2a3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2a3a4b">ClientRef1a2a3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3a4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2a3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2a3b4a">ClientRef1a2a3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3b4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2a3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2a3b4b">ClientRef1a2a3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2a3b4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2a3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2b3a4a">ClientRef1a2b3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3a4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2b3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2b3a4b">ClientRef1a2b3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3a4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2b3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2b3b4a">ClientRef1a2b3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3b4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2b3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1a2b3b4b">ClientRef1a2b3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1a2b3b4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1a2b3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2a3a4a">ClientRef1b2a3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3a4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2a3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2a3a4b">ClientRef1b2a3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3a4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2a3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2a3b4a">ClientRef1b2a3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3b4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2a3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2a3b4b">ClientRef1b2a3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2a3b4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2a3b4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2b3a4a">ClientRef1b2b3a4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3a4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2b3a4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2b3a4b">ClientRef1b2b3a4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3a4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2b3a4b.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2b3b4a">ClientRef1b2b3b4a</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3b4a">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2b3b4a.wsdl" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" target="ClientRef1b2b3b4b">ClientRef1b2b3b4b</reference>
+ </component>
+
+ <reference name="ClientRef1b2b3b4b">
+ <!-- interface.java class="helloworld.HelloWorldService" / -->
+ <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ interface="http://helloworld#wsdl.interface(HelloWorld)"
+ wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ location="wsdl/helloworldC1b2b3b4b.wsdl" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType
new file mode 100644
index 0000000000..2f346a2b0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="Component2Service">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType
new file mode 100644
index 0000000000..fbce84f82f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="Component3Service">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType
new file mode 100644
index 0000000000..44d2acbd05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="Component2Service">
+ <!-- interface.java interface="org.apache.tuscany.sca.itest.Component" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType
new file mode 100644
index 0000000000..44d2acbd05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="Component2Service">
+ <!-- interface.java interface="org.apache.tuscany.sca.itest.Component" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..8802f91b9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4a.wsdl
new file mode 100644
index 0000000000..c0e798b0be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2a3a4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4b.wsdl
new file mode 100644
index 0000000000..02de68d566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3a4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2a3b4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4a.wsdl
new file mode 100644
index 0000000000..02de68d566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2a3b4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4b.wsdl
new file mode 100644
index 0000000000..b576af290d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2a3b4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2a3b4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4a.wsdl
new file mode 100644
index 0000000000..009fb9a7a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2b3a4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4b.wsdl
new file mode 100644
index 0000000000..359114437a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3a4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2b3a4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4a.wsdl
new file mode 100644
index 0000000000..ac0ef22f9e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2b3b4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4b.wsdl
new file mode 100644
index 0000000000..dd2a8497e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1a2b3b4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1a2b3b4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4a.wsdl
new file mode 100644
index 0000000000..a8d211230d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2a3a4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4b.wsdl
new file mode 100644
index 0000000000..9622d55219
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3a4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2a3a4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4a.wsdl
new file mode 100644
index 0000000000..2b5bf5d1a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2a3b4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4b.wsdl
new file mode 100644
index 0000000000..1ea8cd7453
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2a3b4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2a3b4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4a.wsdl
new file mode 100644
index 0000000000..af4a50551b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2b3a4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4b.wsdl
new file mode 100644
index 0000000000..a9efab3bd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3a4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2b3a4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4a.wsdl
new file mode 100644
index 0000000000..8d4b924406
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4a.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2b3b4a" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4b.wsdl
new file mode 100644
index 0000000000..b792d414c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/AccountServiceC1b2b3b4b.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+ targetNamespace="http://www.bigbank.com/account"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/account"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/account"
+
+ > <!-- xmlns:sdojava="commonj.sdo/java" sdojava:package="org.apache.tuscany.samples.bigbank.account" -->
+
+
+<!-- <xsd:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="accountType" type="xsd:string" />
+ <xsd:attribute name="balance" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService1b2b3b4b" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..68174d1ecd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4a.wsdl
new file mode 100644
index 0000000000..84a5ae6c23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2a3a4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4b.wsdl
new file mode 100644
index 0000000000..9951878f5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3a4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2a3a4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4a.wsdl
new file mode 100644
index 0000000000..cfc9c4815c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2a3b4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4b.wsdl
new file mode 100644
index 0000000000..9b293ebbae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2a3b4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2a3b4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4a.wsdl
new file mode 100644
index 0000000000..c8a7e3305f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2b3a4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4b.wsdl
new file mode 100644
index 0000000000..95e8af69fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3a4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2b3a4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4a.wsdl
new file mode 100644
index 0000000000..a51c36f2bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2b3b4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4b.wsdl
new file mode 100644
index 0000000000..d1e9a11251
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1a2b3b4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1a2b3b4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4a.wsdl
new file mode 100644
index 0000000000..cb0a7db5d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2a3a4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4b.wsdl
new file mode 100644
index 0000000000..b7b85fc83e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3a4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2a3a4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4a.wsdl
new file mode 100644
index 0000000000..dd7c687c35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2a3b4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4b.wsdl
new file mode 100644
index 0000000000..13c0f36c8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2a3b4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2a3b4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4a.wsdl
new file mode 100644
index 0000000000..00cc052ac4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2b3a4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4b.wsdl
new file mode 100644
index 0000000000..00cc052ac4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3a4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2b3a4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4a.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4a.wsdl
new file mode 100644
index 0000000000..7579552aba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4a.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2b3b4a"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4b.wsdl b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4b.wsdl
new file mode 100644
index 0000000000..8bff3de3fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/main/resources/wsdl/helloworldC1b2b3b4b.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/HelloWorldService1b2b3b4b"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..c74abc7223
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.sca.itest;
+
+import java.rmi.RemoteException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.CustomerProfileData;
+
+/**
+ * Tests all the combinations of wiring services, components, and references
+ * which use either interface.java or interface.wsdl.
+ *
+ * The tests use a service (1) wired to a components (2) wired to another
+ * component (3) wired to a reference (4). Each of those uses either
+ * interface.java (a) or interface.wsdl (b). This results in 16 different
+ * combinations 1a2a3a4a thru 1b2b3b4b.
+ */
+public class SDOWSDLTestCase extends TestCase {
+
+ public void testClient1a2a3a4a() throws RemoteException {
+
+ doit("Client1a2a3a4a");
+ doit("Client1a2a3a4b");
+ doit("Client1a2a3b4a");
+ doit("Client1a2a3b4b");
+ doit("Client1a2b3a4a");
+ doit("Client1a2b3a4b");
+ doit("Client1a2b3b4a");
+ doit("Client1a2b3b4b");
+ doit("Client1b2a3a4a");
+ doit("Client1b2a3a4b");
+ doit("Client1b2a3b4a");
+ doit("Client1b2a3b4b");
+
+// TODO: TUSCANY-1135, service using wsdl wired to component using wsdl fails
+// doit("Client1b2b3a4a");
+// doit("Client1b2b3a4b");
+// doit("Client1b2b3b4a");
+// doit("Client1b2b3b4b");
+ }
+
+ private void doit(String compName) throws RemoteException {
+ AccountDataService client = CurrentCompositeContext.getContext().locateService(AccountDataService.class, compName);
+ CustomerProfileData dataIn = AccountFactory.INSTANCE.createCustomerProfileData();
+ dataIn.setAddress("home");
+ dataIn.setEmail("petra@home");
+ dataIn.setFirstName("petra");
+ dataIn.setId(1);
+ dataIn.setLastName("A");
+ dataIn.setLoginID("petra");
+ dataIn.setPassword("ant");
+
+ CustomerProfileData dataOut = client.createAccount(dataIn , false, false);
+
+ assertEquals(dataIn.getAddress(), dataOut.getAddress());
+ assertEquals(dataIn.getEmail(), dataOut.getEmail());
+ assertEquals(dataIn.getFirstName(), dataOut.getFirstName());
+ assertEquals(dataIn.getId(), dataOut.getId());
+ assertEquals(dataIn.getLastName(), dataOut.getLastName());
+ assertEquals(dataIn.getLoginID(), dataOut.getLoginID());
+ assertEquals(dataIn.getPassword(), dataOut.getPassword());
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("SDOWSDLTest.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
new file mode 100644
index 0000000000..59c4c17b1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * Tests all the combinations of wiring services, components, and references
+ * which use either interface.java or interface.wsdl.
+ *
+ * The tests use a service (1) wired to a components (2) wired to another
+ * component (3) wired to a reference (4). Each of those uses either
+ * interface.java (a) or interface.wsdl (b). This results in 16 different
+ * combinations 1a2a3a4a thru 1b2b3b4b.
+ */
+public class WSDLTestCase extends TestCase {
+
+ public void testClient1a2a3a4a() {
+ HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ HelloWorldService client1 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3a4b");
+ assertEquals("Hi petra", client1.getGreetings("petra"));
+ HelloWorldService client2 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3b4a");
+ assertEquals("Hi petra", client2.getGreetings("petra"));
+ HelloWorldService client3 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3b4b");
+ assertEquals("Hi petra", client3.getGreetings("petra"));
+ HelloWorldService client4 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3a4a");
+ assertEquals("Hi petra", client4.getGreetings("petra"));
+ HelloWorldService client5 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3a4b");
+ assertEquals("Hi petra", client5.getGreetings("petra"));
+ HelloWorldService client6 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3b4a");
+ assertEquals("Hi petra", client6.getGreetings("petra"));
+ HelloWorldService client7 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3b4b");
+ assertEquals("Hi petra", client7.getGreetings("petra"));
+ HelloWorldService client8 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3a4a");
+ assertEquals("Hi petra", client8.getGreetings("petra"));
+ HelloWorldService client9 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3a4b");
+ assertEquals("Hi petra", client9.getGreetings("petra"));
+ HelloWorldService client10 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3b4a");
+ assertEquals("Hi petra", client10.getGreetings("petra"));
+ HelloWorldService client11 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3b4b");
+ assertEquals("Hi petra", client11.getGreetings("petra"));
+//TODO: TUSCANY-1124 DataBindingInterceptor incorrect when binding.ws wired to java component using interface.wsdl
+// HelloWorldService client12 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3a4a");
+// assertEquals("Hi petra", client12.getGreetings("petra"));
+// HelloWorldService client13 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3a4b");
+// assertEquals("Hi petra", client13.getGreetings("petra"));
+// HelloWorldService client14 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3b4a");
+// assertEquals("Hi petra", client14.getGreetings("petra"));
+// HelloWorldService client15 = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3b4b");
+// assertEquals("Hi petra", client15.getGreetings("petra"));
+ }
+
+ // TODO: TUSCANY-1125, Testcases fail with out of heap space if too many individual test run in one testcase
+// public void testClient1a2a3a4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3a4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2a3a4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3a4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2a3b4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3b4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2a3b4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2a3b4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2b3a4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3a4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2b3a4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3a4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2b3b4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3b4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1a2b3b4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1a2b3b4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2a3a4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3a4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2a3a4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3a4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2a3b4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3b4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2a3b4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2a3b4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2b3a4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3a4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2b3a4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3a4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2b3b4a() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3b4a");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+// public void testClient1b2b3b4b() {
+// HelloWorldService client = CurrentCompositeContext.getContext().locateService(HelloWorldService.class, "Client1b2b3b4b");
+// assertEquals("Hi petra", client.getGreetings("petra"));
+// }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("WSDLTest.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/pom.xml
new file mode 100644
index 0000000000..da333bc066
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/pom.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca</artifactId>
+ <version>0.1-integration-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA tests</name>
+ <properties>
+ <testing.version>0.1-integration-incubating-SNAPSHOT</testing.version>
+
+ <sca.version>0.1-integration-incubating-SNAPSHOT</sca.version>
+ <scaSpecVersion>1.0</scaSpecVersion>
+
+ <scaKernelVersion>0.1-integration-incubating-SNAPSHOT</scaKernelVersion>
+
+ <sdo.version>1.0-incubator-SNAPSHOT</sdo.version>
+ <specVersionSDO>2.1</specVersionSDO>
+
+ </properties>
+
+ <profiles>
+
+ <!-- default profile -->
+ <profile>
+ <id>stable</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>itest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>integration</id>
+ <modules>
+ <module>itest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>unstable</id>
+ <modules>
+ <module>itest</module>
+ <module>interop</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>buildtools</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <configLocation>tuscany-checkstyle.xml</configLocation>
+ <suppressionsLocation>tuscany-suppressions.xml</suppressionsLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+ <linkXRef>false</linkXRef>
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <propertyExpansion>${checkstyle.properties}</propertyExpansion>
+ </configuration>
+ <goals>
+ <goal>checkstyle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+ <ruleset>${basedir}/.ruleset</ruleset>
+ </rulesets>
+ <linkXRef>false</linkXRef>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx128m</argLine>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <jdk>1.5</jdk>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>